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:net.gsantner.opoc.util.ActivityUtils.java
public void showSoftKeyboard() { InputMethodManager imm = (InputMethodManager) _activity.getSystemService(Activity.INPUT_METHOD_SERVICE); if (imm != null && _activity.getCurrentFocus() != null && _activity.getCurrentFocus().getWindowToken() != null) { imm.showSoftInput(_activity.getCurrentFocus(), InputMethodManager.SHOW_FORCED); }/*ww w . j av a 2 s .c om*/ }
From source file:de.appetites.android.menuItemSearchAction.MenuItemSearchAction.java
private void createMenuItem(Menu menu, Drawable drawable, final LinearLayout list) { ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); setLayoutParams(layoutParams);/*w w w . j ava 2 s. c o m*/ setHint(R.string.menu_item_search_action_hint); searchItem = menu.add(R.string.menu_item_search_action_menu_text).setIcon(drawable); searchItem.setActionView(this).setTitle("Search"); searchItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { // open keyboard list.setVisibility(View.VISIBLE); MenuItemSearchAction.this.setText(""); MenuItemSearchAction.this.requestFocus(); MenuItemSearchAction.this.postDelayed(new Runnable() { @Override public void run() { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } }, 200); return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { // close keyboard list.setVisibility(View.GONE); InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(MenuItemSearchAction.this.getWindowToken(), 0); return true; } }); setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { // perform Search searchPerformListener.performSearch(MenuItemSearchAction.this.getText().toString()); searchItem.collapseActionView(); return true; } return false; } }); }
From source file:com.jefftharris.passwdsafe.lib.view.GuiUtils.java
/** * Set the keyboard visibility on a view */// www.j a v a 2 s .c o m public static void setKeyboardVisible(View v, Context ctx, boolean visible) { InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { if (ApiCompat.SDK_VERSION >= ApiCompat.SDK_HONEYCOMB) { imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT); } else { imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } } else { imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } }
From source file:com.shopgun.android.utils.KeyboardUtils.java
/** * Request to show/hide the soft input window from the context of the window that is currently accepting input. * * @param context A context/*w w w.java2s . co m*/ * @param windowToken A window token (IBinder) * @param visible True to show input window, false to hide */ public static void setKeyboardVisible(Context context, IBinder windowToken, boolean visible) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } else if (windowToken != null) { imm.hideSoftInputFromWindow(windowToken, 0); } }
From source file:th.in.ffc.person.PersonListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case R.id.add: Intent add = new Intent(Action.INSERT); add.addCategory(Category.PERSON); add.addCategory(Category.DEFAULT); if (mHcode != null) { add.putExtra(Person.HCODE, mHcode); }// w w w.ja va 2s . c o m getFFCActivity().startActivity(add); break; case R.id.search: InputMethodManager imm = (InputMethodManager) getFFCActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (!mInput.isShown()) { mInput.setVisibility(View.VISIBLE); mInput.requestFocus(); imm.showSoftInput(mInput, InputMethodManager.SHOW_FORCED); item.setIcon(R.drawable.ic_action_close); } else { imm.hideSoftInputFromInputMethod(mInput.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); mInput.setVisibility(View.GONE); mInput.setText(null); item.setIcon(R.drawable.ic_action_search); } break; default: break; } return super.onOptionsItemSelected(item); }
From source file:ch.jeda.platform.android.Main.java
void setVirtualKeyboardVisible(final boolean visible) { this.virtualKeyboardVisible = visible; if (visible) { this.getInputMethodManager().showSoftInput(this.contentView, InputMethodManager.SHOW_FORCED); } else {/* w w w . j av a2 s .co m*/ this.getInputMethodManager().hideSoftInputFromWindow(this.contentView.getWindowToken(), 0); } }
From source file:com.nice295.fridgeplease.MainActivity.java
private void showAddDialog() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this, R.style.DialogTheme); LayoutInflater inflater = this.getLayoutInflater(); final View dialogView = inflater.inflate(R.layout.dialog_add, null); dialogBuilder.setView(dialogView);/*from www . ja va 2s . com*/ final EditText etNewString = (EditText) dialogView.findViewById(R.id.edit); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); dialogBuilder.setTitle(getString(R.string.add_new_string)); //dialogBuilder.setMessage(""); dialogBuilder.setPositiveButton(getString(R.string.add), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (etNewString.getText() != null) { addNewMyItem(etNewString.getText().toString(), 0, "https://firebasestorage.googleapis.com/v0/b/fridgeplease.appspot.com/o/items%2Fgeneral.png?alt=media&token=b47ab1e6-1d1f-4c9d-b8f2-d2ac9e3f8374"); etNewString.clearFocus(); etNewString.setText(""); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } else { Log.e(TAG, "Input Text!"); } } }); dialogBuilder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } }); AlertDialog b = dialogBuilder.create(); b.show(); }
From source file:th.in.ffc.person.PersonListFragment.java
public void onSearchRequest() { if (!mInput.isShown()) { mInput.setVisibility(View.VISIBLE); mInput.requestFocus();//from ww w. ja v a 2s .com InputMethodManager imm = (InputMethodManager) getFFCActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mInput, InputMethodManager.SHOW_FORCED); } }
From source file:com.bjerva.tsplex.fragments.PagerFragment.java
@Override public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) { final Locale swedishLocale = new Locale("sv", "SE"); InputMethodManager imm;/*from ww w.j a v a 2s .c o m*/ switch (item.getItemId()) { case MainActivity.ID_SEARCH_BUTTON: search = (EditText) item.getActionView(); final SignListFragment signListFragment = (SignListFragment) mAdapter.getItem(0); search.requestFocus(); search.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence cs, int start, int before, int count) { signListFragment.getmAdapter().getFilter().filter(cs); try { String word = ((SimpleGson) signListFragment.getListView().getItemAtPosition(0)).getWord(); signListFragment.getTextHeader().setText(word.substring(0, 1).toUpperCase(swedishLocale)); } catch (IndexOutOfBoundsException e) { Log.w("IndexErr", "IndexErr after change text"); } signListFragment.setOldSearch(cs.toString()); } }); search.setText(""); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); break; case MainActivity.ID_COLLAPSE_BUTTON: ((SignCategoryFragment) mAdapter.getItem(1)).collapseaAll(); break; case MainActivity.ID_EDIT_BUTTON: FavouritesFragment favFrag = (FavouritesFragment) mAdapter.getItem(2); mMenu.clear(); if (!favFrag.checkBoxesVisible()) { mMenu.add(0, MainActivity.ID_EDIT_BUTTON, 1, R.string.edit_favs).setIcon(R.drawable.recyclebin) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); ; } else { favFrag.deleteChecked(); mMenu.add(0, MainActivity.ID_EDIT_BUTTON, 1, R.string.edit_favs).setIcon(R.drawable.edit_query) .setShowAsAction( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); ; } ma.onPrepareOptionsMenu(mMenu); favFrag.toggleCheckBoxes(); break; } return true; }
From source file:de.azapps.mirakel.new_ui.fragments.TaskFragment.java
private void toggleKeyboard() { inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }