List of usage examples for android.view.inputmethod InputMethodManager SHOW_FORCED
int SHOW_FORCED
To view the source code for android.view.inputmethod InputMethodManager SHOW_FORCED.
Click Source Link
From source file:com.example.giggle.oschina2.emoji.KJEmojiFragment.java
/** * // w w w .j a va2s .c o m */ public void showSoftKeyboard() { mEt.requestFocus(); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(mEt, InputMethodManager.SHOW_FORCED); }
From source file:calibrationapp.spectoccular.com.keyboardtolinux.MainActivity.java
private void showSoftInput() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); }
From source file:org.openintents.historify.ui.fragments.ContactsListFragment.java
public void onSearchSelected() { boolean needToShow = mSearchBar.getVisibility() == View.GONE; if (needToShow && mAdapter.isEmpty()) return;/*from w ww .ja v a2 s .c om*/ if (!needToShow) { //hide search mEditSearch.setText(""); } mSearchBar.setVisibility(needToShow ? View.VISIBLE : View.GONE); InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); if (needToShow) { mEditSearch.requestFocus(); imm.showSoftInput(mEditSearch, InputMethodManager.SHOW_FORCED); } else { imm.hideSoftInputFromWindow(mEditSearch.getWindowToken(), 0); } }
From source file:ua.com.spacetv.mycookbook.dialogs.FragDialog.java
/** * Showing software keyboard/*ww w . ja v a 2 s . c om*/ */ private void showKeyboard() { InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
From source file:org.akvo.caddisfly.sensor.colorimetry.liquid.SaveCalibrationDialogFragment.java
@NonNull @Override/*w w w . j a va2 s. c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { String testCode = CaddisflyApp.getApp().getCurrentTestInfo().getId(); final Context context = getActivity(); LayoutInflater i = getActivity().getLayoutInflater(); @SuppressLint("InflateParams") View view = i.inflate(R.layout.fragment_save_calibration, null); final DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, monthOfYear); calendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); String date = new SimpleDateFormat("dd MMM yyyy", Locale.US).format(calendar.getTime()); editExpiryDate.setText(date); } }; editExpiryDate = (EditText) view.findViewById(R.id.editExpiryDate); editBatchCode = (EditText) view.findViewById(R.id.editBatchCode); editRgb = (EditText) view.findViewById(R.id.editRgb); long milliseconds = PreferencesUtil.getLong(getActivity(), CaddisflyApp.getApp().getCurrentTestInfo().getId(), R.string.calibrationExpiryDateKey); if (milliseconds > new Date().getTime()) { editBatchCode.setText(PreferencesUtil.getString(context, testCode, R.string.batchNumberKey, "").trim()); long expiryDate = PreferencesUtil.getLong(getContext(), testCode, R.string.calibrationExpiryDateKey); if (expiryDate >= 0) { calendar.setTimeInMillis(expiryDate); editExpiryDate.setText(new SimpleDateFormat("dd-MMM-yyyy", Locale.US).format(new Date(expiryDate))); } } editRgb.setText(PreferencesUtil.getString(context, testCode, R.string.ledRgbKey, "").trim()); if (!AppPreferences.useExternalCamera()) { editRgb.setVisibility(View.GONE); view.findViewById(R.id.textRgb).setVisibility(View.GONE); } final DatePickerDialog datePickerDialog = new DatePickerDialog(context, onDateSetListener, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); Calendar date = Calendar.getInstance(); date.add(Calendar.DATE, 1); date.set(Calendar.HOUR_OF_DAY, date.getMinimum(Calendar.HOUR_OF_DAY)); date.set(Calendar.MINUTE, date.getMinimum(Calendar.MINUTE)); date.set(Calendar.SECOND, date.getMinimum(Calendar.SECOND)); date.set(Calendar.MILLISECOND, date.getMinimum(Calendar.MILLISECOND)); datePickerDialog.getDatePicker().setMinDate(date.getTimeInMillis()); date.add(Calendar.MONTH, CaddisflyApp.getApp().getCurrentTestInfo().getMonthsValid()); date.set(Calendar.HOUR_OF_DAY, date.getMaximum(Calendar.HOUR_OF_DAY)); date.set(Calendar.MINUTE, date.getMaximum(Calendar.MINUTE)); date.set(Calendar.SECOND, date.getMaximum(Calendar.SECOND)); date.set(Calendar.MILLISECOND, date.getMaximum(Calendar.MILLISECOND)); datePickerDialog.getDatePicker().setMaxDate(date.getTimeInMillis()); editExpiryDate.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (b) { closeKeyboard(getContext(), editBatchCode); datePickerDialog.show(); } } }); editExpiryDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { closeKeyboard(getContext(), editBatchCode); datePickerDialog.show(); } }); editName = (EditText) view.findViewById(R.id.editName); if (!isEditing && AppPreferences.isDiagnosticMode()) { editName.requestFocus(); } else { editName.setVisibility(View.GONE); editBatchCode.requestFocus(); } InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); AlertDialog.Builder b = new AlertDialog.Builder(getActivity()).setTitle(R.string.calibrationDetails) .setPositiveButton(R.string.save, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { closeKeyboard(context, editName); dismiss(); } }); b.setView(view); return b.create(); }
From source file:nl.jalava.appostle.AppListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.app_list, container, false); appList = (ListView) view.findViewById(R.id.listView1); progress = (ProgressBar) view.findViewById(R.id.progressBar); progress_loading = (TextView) view.findViewById(R.id.progress_loading); progress.bringToFront();//from ww w . java2 s. co m progress_loading.bringToFront(); mContext = view.getContext(); // Make list clickable and fast scrollable. appList.setClickable(true); appList.setFastScrollEnabled(true); // OnClick appList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { AppInfo o = (AppInfo) appList.getItemAtPosition(position); listener.onAppSelected(o); } }); // Swipe to refresh. mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_apps); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { new UpdateAppList().execute(); } }); mSearchEdit = (RelativeLayout) view.findViewById(R.id.search_layout); // Restore the last visibility state of the text edit. if (mSearchEditOpen) mSearchEdit.setVisibility(View.VISIBLE); else mSearchEdit.setVisibility(View.GONE); mSearchText = (EditText) view.findViewById(R.id.search_app_edit); // Restore text and cursor position. mSearchText.setText(mSearchEditText); mSearchText.setSelection(mSearchEditTextPosition); mSearchText.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { if (mAppInfoAdapter != null) mAppInfoAdapter.getFilter().filter(s); mSearchEditText = s.toString(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } }); // Activate keyboard if search text edit is opened. // Close if no focus. mSearchText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { // Open keyboard ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .showSoftInput(v, InputMethodManager.SHOW_FORCED); } else { // Close keyboard. ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(v.getWindowToken(), 0); } } }); // Clear text button. Button clear = (Button) view.findViewById(R.id.search_clear_button); clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSearchText.setText(""); } }); // Close search. Button close = (Button) view.findViewById(R.id.search_close_button); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSearchEdit.setVisibility(View.GONE); mSearchEditOpen = false; } }); // Prevent always refreshing when pulling listview down. appList.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (firstVisibleItem == 0) { mSwipeRefreshLayout.setEnabled(true); } else mSwipeRefreshLayout.setEnabled(false); } }); pm = mContext.getPackageManager(); doUpdate(-1); return view; }
From source file:org.linphone.ContactEditorFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.inflater = inflater; contact = null;/*from w w w . j a v a2s . c om*/ if (getArguments() != null) { if (getArguments().getSerializable("Contact") != null) { contact = (Contact) getArguments().getSerializable("Contact"); isNewContact = false; contactID = Integer.parseInt(contact.getID()); contact.refresh(getActivity().getContentResolver()); if (getArguments().getString("NewSipAdress") != null) { newSipOrNumberToAdd = getArguments().getString("NewSipAdress"); } } else if (getArguments().getString("NewSipAdress") != null) { newSipOrNumberToAdd = getArguments().getString("NewSipAdress"); isNewContact = true; } } contactsManager = ContactsManager.getInstance(); view = inflater.inflate(R.layout.contact_edit, container, false); deleteContact = (ImageView) view.findViewById(R.id.delete_contact); cancel = (ImageView) view.findViewById(R.id.cancel); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getFragmentManager().popBackStackImmediate(); } }); ok = (ImageView) view.findViewById(R.id.ok); ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (isNewContact) { boolean areAllFielsEmpty = true; for (NewOrUpdatedNumberOrAddress nounoa : numbersAndAddresses) { if (nounoa.newNumberOrAddress != null && !nounoa.newNumberOrAddress.equals("")) { areAllFielsEmpty = false; break; } } if (areAllFielsEmpty) { getFragmentManager().popBackStackImmediate(); return; } contactsManager.createNewContact(ops, firstName.getText().toString(), lastName.getText().toString()); setContactPhoto(); } else { contactsManager.updateExistingContact(ops, contact, firstName.getText().toString(), lastName.getText().toString()); setContactPhoto(); } for (NewOrUpdatedNumberOrAddress numberOrAddress : numbersAndAddresses) { numberOrAddress.save(); } try { getActivity().getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); addLinphoneFriendIfNeeded(); removeLinphoneTagIfNeeded(); contactsManager.prepareContactsInBackground(); } catch (Exception e) { e.printStackTrace(); } getFragmentManager().popBackStackImmediate(); if (LinphoneActivity.instance().getResources().getBoolean(R.bool.isTablet)) ContactsListFragment.instance().invalidate(); } }); lastName = (EditText) view.findViewById(R.id.contactLastName); // Hack to display keyboard when touching focused edittext on Nexus One if (Version.sdkStrictlyBelow(Version.API11_HONEYCOMB_30)) { lastName.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { InputMethodManager imm = (InputMethodManager) LinphoneActivity.instance() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } }); } lastName.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (lastName.getText().length() > 0 || firstName.getText().length() > 0) { ok.setEnabled(true); } else { ok.setEnabled(false); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); firstName = (EditText) view.findViewById(R.id.contactFirstName); firstName.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (firstName.getText().length() > 0 || lastName.getText().length() > 0) { ok.setEnabled(true); } else { ok.setEnabled(false); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); if (!isNewContact) { String fn = findContactFirstName(String.valueOf(contactID)); String ln = findContactLastName(String.valueOf(contactID)); if (fn != null || ln != null) { firstName.setText(fn); lastName.setText(ln); } else { lastName.setText(contact.getName()); firstName.setText(""); } deleteContact.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = LinphoneActivity.instance() .displayDialog(getString(R.string.delete_text)); Button delete = (Button) dialog.findViewById(R.id.delete_button); Button cancel = (Button) dialog.findViewById(R.id.cancel); delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { deleteExistingContact(); ContactsManager.getInstance().removeContactFromLists(getActivity().getContentResolver(), contact); LinphoneActivity.instance().displayContacts(false); dialog.dismiss(); } }); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); } }); } else { deleteContact.setVisibility(View.INVISIBLE); } contactPicture = (ImageView) view.findViewById(R.id.contact_picture); if (contact != null && contact.getPhotoUri() != null) { InputStream input = Compatibility.getContactPictureInputStream(getActivity().getContentResolver(), contact.getID()); contactPicture.setImageBitmap(BitmapFactory.decodeStream(input)); } else { contactPicture.setImageResource(R.drawable.avatar); } contactPicture.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { pickImage(); } }); numbersAndAddresses = new ArrayList<NewOrUpdatedNumberOrAddress>(); sipAddresses = initSipAddressFields(contact); numbers = initNumbersFields(contact); addSipAddress = (ImageView) view.findViewById(R.id.add_address_field); addSipAddress.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { addEmptyRowToAllowNewNumberOrAddress(sipAddresses, true); } }); addNumber = (ImageView) view.findViewById(R.id.add_number_field); addNumber.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { addEmptyRowToAllowNewNumberOrAddress(numbers, false); } }); ops = new ArrayList<ContentProviderOperation>(); lastName.requestFocus(); return view; }
From source file:com.twentyfourseven.zira.DriverProfileInformation.java
@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.btnSeeDriverLocation: // Building Parameters tripId and DriverId if (Util.isNetworkAvailable(DriverProfileInformation.this)) { ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("DriverId", mTripDetailsModel.getGetTrip_DriverId())); params.add(new BasicNameValuePair("TripId", SingleTon.getInstance().getDriverTripId())); Log.d("tag", "GetDriver Location::" + params.toString()); AsyncTaskForZira mWebPageTask1 = new AsyncTaskForZira(DriverProfileInformation.this, "GetDriverLocation", params, false, ""); mWebPageTask1.delegate = (AsyncResponseForZira) DriverProfileInformation.this; mWebPageTask1.execute();//from w w w . ja v a 2 s . c o m } else { Util.alertMessage(DriverProfileInformation.this, "Please check your internet connection"); } break; case R.id.imageView_Message: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); layoutDialog.setVisibility(View.VISIBLE); break; case R.id.buttonSend: try { InputMethodManager imm1 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm1.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } catch (Exception e) { // TODO: handle exception } if (edtMessage.getText().length() == 0) { Util.alertMessage(DriverProfileInformation.this, "Please Write Message"); } else { String userid = mTripDetailsModel.getGetTrip_DriverId(); String message = edtMessage.getText().toString(); String trigger = "sms"; Log.i("tag", "userid:" + userid); Log.i("tag", "message:" + message); Log.i("tag", "trigger:" + trigger); // Building Parameters if (Util.isNetworkAvailable(DriverProfileInformation.this)) { ArrayList<NameValuePair> params1 = new ArrayList<NameValuePair>(); params1.add(new BasicNameValuePair("Id", userid)); params1.add(new BasicNameValuePair("message", message)); params1.add(new BasicNameValuePair("trigger", trigger)); Log.d("tag", "SendRequest::" + params1.toString()); AsyncTaskForZira mWebPageTask = new AsyncTaskForZira(DriverProfileInformation.this, sendMessages, params1, true, "Sending message..."); mWebPageTask.delegate = (AsyncResponseForZira) DriverProfileInformation.this; mWebPageTask.execute(); } else { Util.alertMessage(DriverProfileInformation.this, "Please check your internet connection"); } // new SendMessageParsing().execute(); edtMessage.setText(""); } break; case R.id.imageViewDelete: try { InputMethodManager imm1 = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm1.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } catch (Exception e) { // TODO: handle exception } edtMessage.setText(""); layoutDialog.setVisibility(View.GONE); break; /*case R.id.imageView_Phone: Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(jsonmobileno)); startActivity(callIntent); System.err.println("callllllllll"); break;*/ } }
From source file:io.github.mkjung.ivi.gui.helpers.UiTools.java
public static void setKeyboardVisibility(final View v, final boolean show) { final InputMethodManager inputMethodManager = (InputMethodManager) VLCApplication.getAppContext() .getSystemService(Activity.INPUT_METHOD_SERVICE); sHandler.post(new Runnable() { @Override// www .ja v a 2s . c om public void run() { if (show) inputMethodManager.showSoftInput(v, InputMethodManager.SHOW_FORCED); else inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0); } }); }
From source file:com.brookmanholmes.bma.ui.newmatchwizard.CreateNewMatchActivity.java
public void showKeyboard() { if (pager.getCurrentItem() == 0) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); }/* ww w . ja v a 2s .co m*/ }