List of usage examples for android.view.inputmethod InputMethodManager SHOW_IMPLICIT
int SHOW_IMPLICIT
To view the source code for android.view.inputmethod InputMethodManager SHOW_IMPLICIT.
Click Source Link
From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.editor.TaskDetailFragment.java
@Override public void onActivityCreated(final Bundle state) { super.onActivityCreated(state); if (dontLoad) { return;/* w ww . ja v a 2 s . com*/ } boolean openKb = false; final Bundle args = new Bundle(); long idToOpen = mListener.getEditorTaskId(); getArguments().putLong(ARG_ITEM_ID, idToOpen); if (idToOpen > 0) { // Load data from database args.putLong(ARG_ITEM_ID, idToOpen); getLoaderManager().restartLoader(LOADER_EDITOR_TASK, args, loaderCallbacks); } else { // If not valid, find a valid list long listId = mListener.getListOfTask(); if (listId < 1) { listId = getARealList(getActivity(), -1); } // Fail if still not valid if (listId < 1) { // throw new InvalidParameterException( // "Must specify a list id to create a note in!"); Toast.makeText(getActivity(), "Must specify a list id to create a note in!", Toast.LENGTH_SHORT) .show(); getActivity().finish(); return; } getArguments().putLong(ARG_ITEM_LIST_ID, listId); args.putLong(ARG_ITEM_LIST_ID, listId); getLoaderManager().restartLoader(LOADER_EDITOR_TASKLISTS, args, loaderCallbacks); openKb = true; mTaskOrg = new Task(); mTask = new Task(); mTask.dblist = listId; // New note but start with the text given mTask.setText(mListener.getInitialTaskText()); fillUIFromTask(); } if (openKb) { /** * Only show keyboard for new/empty notes But not if the showcase * view is showing */ taskText.requestFocus(); inputManager.showSoftInput(taskText, InputMethodManager.SHOW_IMPLICIT); } }
From source file:de.incoherent.suseconferenceclient.activities.HomeActivity.java
@Override public boolean onMenuItemActionExpand(MenuItem item) { final EditText searchText = (EditText) item.getActionView(); searchText.post(new Runnable() { @Override//www. j av a 2 s . c om public void run() { searchText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(searchText, InputMethodManager.SHOW_IMPLICIT); } }); return true; }
From source file:com.hughes.android.dictionary.DictionaryActivity.java
private void showKeyboard() { // For some reason, this doesn't always work the first time. // One way to replicate the problem: // Press the "task switch" button repeatedly to pause and resume for (int delay = 1; delay <= 101; delay += 100) { searchView.postDelayed(new Runnable() { @Override/*from w w w . ja v a 2 s .c o m*/ public void run() { Log.d(LOG, "Trying to show soft keyboard."); final boolean searchTextHadFocus = searchView.hasFocus(); searchView.requestFocusFromTouch(); final InputMethodManager manager = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); manager.showSoftInput(searchView, InputMethodManager.SHOW_IMPLICIT); if (!searchTextHadFocus) { defocusSearchText(); } } }, delay); } }
From source file:com.github.irshulx.Components.InputExtensions.java
public void setFocus(CustomEditText view) { if (editorCore.isStateFresh() && !editorCore.getAutoFucus()) { editorCore.setStateFresh(false); return;//from ww w . j a v a 2 s .co m } view.requestFocus(); InputMethodManager mgr = (InputMethodManager) editorCore.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); view.setSelection(view.getText().length()); editorCore.setActiveView(view); }
From source file:com.push.app.HomeActivity.java
private void handleMenuSearch() { ActionBar action = getSupportActionBar(); //get the actionbar if (isSearchOpened) { //test if the search is open updateViews(false);/*from w w w .java2s . com*/ //hides the keyboard imm.hideSoftInputFromWindow(editSearch.getWindowToken(), 0); showDefaultActionBar(); } else { //open the search entry updateViews(true); if (((ObservableListView) findViewById(R.id.searchList)).getAdapter() != null && !((ObservableListView) findViewById(R.id.searchList)).getAdapter().isEmpty()) { ((TextView) findViewById(R.id.searchResults)).setText(getString(R.string.recent_results)); } action.setDisplayShowCustomEnabled(true); //enable it to display a View view = getLayoutInflater().inflate(R.layout.search_bar, null); ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT); action.setCustomView(view, layoutParams);//add the custom view action.setDisplayShowTitleEnabled(false); //hide the title Toolbar parent = (Toolbar) view.getParent(); parent.setContentInsetsAbsolute(0, 0); editSearch = (EditText) action.getCustomView().findViewById(R.id.edtSearch); //the text editor //this is a listener to do a search when the user clicks on search button editSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { imm.hideSoftInputFromWindow(editSearch.getWindowToken(), 0); doSearch(editSearch.getText().toString()); editSearch.setText(""); return true; } return false; } }); editSearch.requestFocus(); //open the keyboard focused in the edtSearch imm.showSoftInput(editSearch, InputMethodManager.SHOW_IMPLICIT); //add the close icon mSearchAction.setIcon(getResources().getDrawable(R.mipmap.ic_action_cancel)); isSearchOpened = true; } }
From source file:it.reyboz.bustorino.ActivityMain.java
private void showKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); View view = searchMode == SEARCH_BY_ID ? busStopSearchByIDEditText : busStopSearchByNameEditText; imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); }
From source file:com.chatwing.whitelabel.fragments.CommunicationMessagesFragment.java
private void showKeyboard() { mInputMethodManager.showSoftInput(mCommunicationBoxEditText, InputMethodManager.SHOW_IMPLICIT); }
From source file:org.yaaic.fragment.ConversationFragment.java
/** * Open the soft keyboard (helper function) *///from w ww .ja va 2 s . c om private void openSoftKeyboard(View view) { ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); }
From source file:com.nearnotes.NoteEdit.java
@SuppressWarnings("deprecation") private void populateFields() { if (mRowId != null) { int settingsResult = mDbHelper.fetchSetting(); if (settingsResult == mRowId) { mCheckBox.setChecked(true);// w ww. j ava 2 s.c o m } else mCheckBox.setChecked(false); Cursor note = mDbHelper.fetchNote(mRowId); getActivity().startManagingCursor(note); mTitleText.setText(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE))); mBodyText.setText(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)), TextView.BufferType.SPANNABLE); autoCompView.setAdapter(null); autoCompView.setText(note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_LOCATION))); autoCompView.setAdapter(new PlacesAutoCompleteAdapter(getActivity(), R.layout.list_item)); location = note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_LOCATION)); longitude = note.getDouble(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_LNG)); latitude = note.getDouble(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_LAT)); checkString = note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_CHECK)); mChecklist = Boolean.parseBoolean(checkString); } else { autoCompView.requestFocus(); InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(autoCompView, InputMethodManager.SHOW_IMPLICIT); } }
From source file:dev.ukanth.ufirewall.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { /*case android.R.id.home: disableOrEnable();//from w w w . j a v a 2 s . c o m return true;*/ case R.id.menu_toggle: disableOrEnable(); return true; case R.id.menu_apply: applyOrSaveRules(); return true; case R.id.menu_exit: finish(); System.exit(0); return false; case R.id.menu_help: showAbout(); return true; /*case R.id.menu_setpwd: setPassword(); return true;*/ case R.id.menu_log: showLog(); return true; case R.id.menu_rules: showRules(); return true; case R.id.menu_setcustom: setCustomScript(); return true; case R.id.menu_preference: showPreferences(); return true; /*case R.id.menu_reload: Api.applications = null; showOrLoadApplications(); return true;*/ case R.id.menu_search: item.setActionView(R.layout.searchbar); final EditText filterText = (EditText) item.getActionView().findViewById(R.id.searchApps); filterText.addTextChangedListener(filterTextWatcher); filterText.setEllipsize(TruncateAt.END); filterText.setSingleLine(); MenuItemCompat.setOnActionExpandListener(item, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { // Do something when collapsed return true; // Return true to collapse action view } @Override public boolean onMenuItemActionExpand(MenuItem item) { filterText.post(new Runnable() { @Override public void run() { filterText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); imm.showSoftInput(filterText, InputMethodManager.SHOW_IMPLICIT); } }); return true; // Return true to expand action view } }); return true; case R.id.menu_export: new MaterialDialog.Builder(this).title(R.string.exports).cancelable(false) .items(new String[] { getString(R.string.export_rules), getString(R.string.export_all) }) .itemsCallbackSingleChoice(-1, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { switch (which) { case 0: Api.saveSharedPreferencesToFileConfirm(MainActivity.this); break; case 1: Api.saveAllPreferencesToFileConfirm(MainActivity.this); break; } return true; } }).positiveText(R.string.exports).negativeText(R.string.Cancel).show(); return true; case R.id.menu_import: new MaterialDialog.Builder(this).title(R.string.imports).cancelable(false) .items(new String[] { getString(R.string.import_rules), getString(R.string.import_all), getString(R.string.import_rules_droidwall) }) .itemsCallbackSingleChoice(-1, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { switch (which) { case 0: //Intent intent = new Intent(MainActivity.this, FileChooserActivity.class); //startActivityForResult(intent, FILE_CHOOSER_LOCAL); File mPath = new File(Environment.getExternalStorageDirectory() + "//afwall//"); FileDialog fileDialog = new FileDialog(MainActivity.this, mPath, true); //fileDialog.setFlag(true); //fileDialog.setFileEndsWith(new String[] {"backup", "afwall-backup"}, "all"); fileDialog.addFileListener(new FileDialog.FileSelectedListener() { public void fileSelected(File file) { String fileSelected = file.toString(); StringBuilder builder = new StringBuilder(); if (Api.loadSharedPreferencesFromFile(MainActivity.this, builder, fileSelected)) { Api.applications = null; showOrLoadApplications(); Api.toast(MainActivity.this, getString(R.string.import_rules_success) + fileSelected); } else { if (builder.toString().equals("")) { Api.toast(MainActivity.this, getString(R.string.import_rules_fail)); } else { Api.toast(MainActivity.this, builder.toString()); } } } }); fileDialog.showDialog(); break; case 1: if (Api.getCurrentPackage(MainActivity.this).equals("dev.ukanth.ufirewall.donate") || G.isDo(getApplicationContext())) { File mPath2 = new File( Environment.getExternalStorageDirectory() + "//afwall//"); FileDialog fileDialog2 = new FileDialog(MainActivity.this, mPath2, false); //fileDialog2.setFlag(false); //fileDialog2.setFileEndsWith(new String[] {"backup_all", "afwall-backup-all"}, "" ); fileDialog2.addFileListener(new FileDialog.FileSelectedListener() { public void fileSelected(File file) { String fileSelected = file.toString(); StringBuilder builder = new StringBuilder(); if (Api.loadAllPreferencesFromFile(MainActivity.this, builder, fileSelected)) { Api.applications = null; showOrLoadApplications(); Api.toast(MainActivity.this, getString(R.string.import_rules_success) + fileSelected); Intent intent = getIntent(); finish(); startActivity(intent); } else { if (builder.toString().equals("")) { Api.toast(MainActivity.this, getString(R.string.import_rules_fail)); } else { Api.toast(MainActivity.this, builder.toString()); } } } }); fileDialog2.showDialog(); } else { new MaterialDialog.Builder(MainActivity.this).cancelable(false) .title(R.string.buy_donate).content(R.string.donate_only) .positiveText(R.string.buy_donate).negativeText(R.string.close) .icon(getResources().getDrawable(R.drawable.ic_launcher)) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://search?q=pub:ukpriya")); startActivity(intent); } @Override public void onNegative(MaterialDialog dialog) { dialog.cancel(); } }).show(); } break; case 2: new MaterialDialog.Builder(MainActivity.this).cancelable(false) .title(R.string.import_rules_droidwall).content(R.string.overrideRules) .positiveText(R.string.Yes).negativeText(R.string.No) .icon(getResources().getDrawable(R.drawable.ic_launcher)) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { if (ImportApi .loadSharedPreferencesFromDroidWall(MainActivity.this)) { Api.applications = null; showOrLoadApplications(); Api.toast(MainActivity.this, getString(R.string.import_rules_success) + Environment .getExternalStorageDirectory().getAbsolutePath() + "/afwall/"); } else { Api.toast(MainActivity.this, getString(R.string.import_rules_fail)); } } @Override public void onNegative(MaterialDialog dialog) { dialog.cancel(); } }).show(); break; } return true; } }).positiveText(R.string.imports).negativeText(R.string.Cancel).show(); return true; default: return super.onOptionsItemSelected(item); } }