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:com.example.skode6.scanenvy.MainActivity.java
private AlertDialog enterDialog(final EditText edit) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); edit.setKeyListener(new DigitsKeyListener()); final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(edit, InputMethodManager.SHOW_IMPLICIT); //edit.setFocusableInTouchMode(true); edit.setFocusable(true);//from ww w .j a va 2 s .co m //edit.setOnClickListener(clickText()); //edit.requestFocusFromTouch(); edit.requestFocus(); dialog.setView(edit); dialog.setCancelable(true); dialog.setTitle("Enter UPC"); dialog.setPositiveButton("Submit", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String upc = edit.getText().toString(); try { Product p = run.lookUp(upc); adapter.add(p); //run.addProduct(p); } catch (IOException e) { Toast error = Toast.makeText(getApplicationContext(), "Couldn't find" + upc, Toast.LENGTH_LONG); error.show(); } } }); dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); return dialog.create(); }
From source file:com.appsimobile.appsii.module.search.SearchController.java
void focusSearchView() { if (mSearchView != null && isUserVisible()) { mSearchView.requestFocus();//from w ww .j a va 2s . c o m InputMethodManager imm = mInputMethodManager; imm.showSoftInput(mSearchView, InputMethodManager.SHOW_IMPLICIT); } }
From source file:com.ywesee.amiko.MainActivity.java
/** * Show soft keyboard// ww w . j ava 2s . c o m */ private void showSoftKeyboard(int duration) { mSearch.requestFocus(); mSearch.postDelayed(new Runnable() { @Override public void run() { // Display keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mSearch, InputMethodManager.SHOW_IMPLICIT); } }, duration); }
From source file:net.olejon.mdapp.NotesActivity.java
private void getNotes() { if (mIsAuthenticated) { GetNotesTask getNotesTask = new GetNotesTask(); getNotesTask.execute();/*from w ww .j a v a2s . com*/ } else { new MaterialDialog.Builder(mContext).title(getString(R.string.notes_dialog_verify_pin_code_title)) .customView(R.layout.activity_notes_dialog_verify_pin_code, true) .positiveText(getString(R.string.notes_dialog_verify_pin_code_positive_button)) .negativeText(getString(R.string.notes_dialog_verify_pin_code_negative_button)) .neutralText(getString(R.string.notes_dialog_verify_pin_code_neutral_button)) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { EditText pinCodeEditText = (EditText) dialog .findViewById(R.id.notes_dialog_verify_pin_code); String pinCode = pinCodeEditText.getText().toString(); if (pinCode.equals(mTools.getSharedPreferencesString("NOTES_PIN_CODE"))) { GetNotesTask getNotesTask = new GetNotesTask(); getNotesTask.execute(); dialog.dismiss(); } else { mTools.showToast(getString(R.string.notes_dialog_verify_pin_code_wrong), 1); } } @Override public void onNegative(MaterialDialog dialog) { dialog.dismiss(); finish(); } @Override public void onNeutral(MaterialDialog dialog) { dialog.dismiss(); new MaterialDialog.Builder(mContext) .title(getString(R.string.notes_dialog_reset_pin_code_title)) .content(getString(R.string.notes_dialog_reset_pin_code_message)) .positiveText(getString(R.string.notes_dialog_reset_pin_code_positive_button)) .neutralText(getString(R.string.notes_dialog_reset_pin_code_neutral_button)) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { mTools.setSharedPreferencesString("NOTES_PIN_CODE", ""); SQLiteDatabase sqLiteDatabase = new NotesSQLiteHelper(mContext) .getWritableDatabase(); sqLiteDatabase.delete(NotesSQLiteHelper.TABLE, null, null); sqLiteDatabase.close(); mTools.showToast(getString(R.string.notes_dialog_reset_pin_code_reset), 1); finish(); } @Override public void onNeutral(MaterialDialog dialog) { finish(); } }).cancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { finish(); } }).contentColorRes(R.color.black).positiveColorRes(R.color.red) .neutralColorRes(R.color.dark_blue).show(); } }).showListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { mInputMethodManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } }).cancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { dialogInterface.dismiss(); finish(); } }).contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue) .negativeColorRes(R.color.black).neutralColorRes(R.color.dark_blue).autoDismiss(false).show(); } }
From source file:org.chromium.content_shell.Shell.java
private void setKeyboardVisibilityForUrl(boolean visible) { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT); } else {/*from w ww .j a v a 2s . com*/ imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0); } }
From source file:com.vaquerosisd.projectmanager.TaskList.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.task_menu, menu); MenuItem searchItem = menu.findItem(R.id.actionBar_SearchTaskItem); Button clearSearchTask = (Button) searchItem.getActionView().findViewById(R.id.actionBar_ClearSearch); final AutoCompleteTextView searchTask = (AutoCompleteTextView) searchItem.getActionView() .findViewById(R.id.actionBar_SearchItemEditText); //Get all tasks names and add them to an adapter for the AutoCompleteTextView List<Task> allTasks = db.getAllTasks(projectId); String[] tasksNames = new String[allTasks.size()]; for (int i = 0; i < allTasks.size(); i++) tasksNames[i] = allTasks.get(i).getTaskName(); ArrayAdapter<String> tasksAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, tasksNames);// w w w. j a v a 2 s . c om searchTask.setAdapter(tasksAdapter); searchTask.setThreshold(1); //Clear text of search AutoCompleteTextView clearSearchTask.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { searchTask.setText(""); } }); searchTask.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } else { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0); } } }); //Search task searchTask.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { //When the user press "DONE" key, select the task if (actionId == EditorInfo.IME_ACTION_DONE) { String project = searchTask.getText().toString(); searchTask(project); //Hide keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(searchTask.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); return true; } return false; } }); return true; }
From source file:com.eutectoid.dosomething.picker.PlacePickerFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (searchBox != null) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(searchBox, InputMethodManager.SHOW_IMPLICIT); }/*from w w w .j a v a 2 s .c o m*/ }
From source file:com.vinexs.tool.Utility.java
public static void showKeyBroad(Activity activity) { try {//from w w w .ja v a 2s . c o m InputMethodManager inputMethodManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.showSoftInput(activity.getCurrentFocus(), InputMethodManager.SHOW_IMPLICIT); } catch (Exception ignored) { } }
From source file:com.jaredrummler.android.colorpicker.ColorPickerDialog.java
View createPickerView() { View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null); colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view); ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old); newColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_new); ImageView arrowRight = (ImageView) contentView.findViewById(R.id.cpv_arrow_right); hexEditText = (EditText) contentView.findViewById(R.id.cpv_hex); try {//from w w w .j av a 2s . com final TypedValue value = new TypedValue(); TypedArray typedArray = getActivity().obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorPrimary }); int arrowColor = typedArray.getColor(0, Color.BLACK); typedArray.recycle(); arrowRight.setColorFilter(arrowColor); } catch (Exception ignored) { } colorPicker.setAlphaSliderVisible(showAlphaSlider); oldColorPanel.setColor(getArguments().getInt(ARG_COLOR)); colorPicker.setColor(color, true); newColorPanel.setColor(color); setHex(color); if (!showAlphaSlider) { hexEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(6) }); } newColorPanel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (newColorPanel.getColor() == color) { colorPickerDialogListener.onColorSelected(dialogId, color); dismiss(); } } }); contentView.setOnTouchListener(this); colorPicker.setOnColorChangedListener(this); hexEditText.addTextChangedListener(this); hexEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(hexEditText, InputMethodManager.SHOW_IMPLICIT); } } }); return contentView; }
From source file:com.jrummyapps.android.colorpicker.ColorPickerDialog.java
View createPickerView() { View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null); colorPicker = contentView.findViewById(R.id.cpv_color_picker_view); ColorPanelView oldColorPanel = contentView.findViewById(R.id.cpv_color_panel_old); newColorPanel = contentView.findViewById(R.id.cpv_color_panel_new); ImageView arrowRight = contentView.findViewById(R.id.cpv_arrow_right); hexEditText = contentView.findViewById(R.id.cpv_hex); try {//from w w w . j a v a 2 s . c o m final TypedValue value = new TypedValue(); TypedArray typedArray = getActivity().obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorPrimary }); int arrowColor = typedArray.getColor(0, Color.BLACK); typedArray.recycle(); arrowRight.setColorFilter(arrowColor); } catch (Exception ignored) { } colorPicker.setAlphaSliderVisible(showAlphaSlider); oldColorPanel.setColor(getArguments().getInt(ARG_COLOR)); colorPicker.setColor(color, true); newColorPanel.setColor(color); setHex(color); if (!showAlphaSlider) { hexEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(6) }); } newColorPanel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (newColorPanel.getColor() == color) { colorPickerDialogListener.onColorSelected(dialogId, color); dismiss(); } } }); contentView.setOnTouchListener(this); colorPicker.setOnColorChangedListener(this); hexEditText.addTextChangedListener(this); hexEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) imm.showSoftInput(hexEditText, InputMethodManager.SHOW_IMPLICIT); } } }); return contentView; }