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:br.liveo.searchliveo.SearchLiveo.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void showAnimation() { try {// w w w. j a va 2 s . c o m if (getStatusBarShowColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarShowColor()); } else { mContext.getWindow() .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark)); } final Animator animator = ViewAnimationUtils.createCircularReveal(mViewSearch, mViewSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext), 0, (float) Math.hypot(mViewSearch.getWidth(), mViewSearch.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.setDuration(300); animator.start(); } catch (Exception e) { e.getStackTrace(); mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } mViewSearch.setVisibility(View.VISIBLE); }
From source file:br.liveo.searchliveo.SearchCardLiveo.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void showAnimation() { try {/* w w w . j a v a 2 s . c o m*/ if (getStatusBarShowColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarShowColor()); } else { mContext.getWindow() .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark)); } final Animator animator = ViewAnimationUtils.createCircularReveal(mCardSearch, mCardSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext), 0, (float) Math.hypot(mCardSearch.getWidth(), mCardSearch.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.setDuration(300); animator.start(); } catch (Exception e) { e.getStackTrace(); mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } mCardSearch.setVisibility(View.VISIBLE); }
From source file:com.moonpi.tapunlock.MainActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { // Get pressed item information final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); // If Rename Tag pressed if (item.getTitle().equals(getResources().getString(R.string.rename_context_menu))) { // Create new EdiText and configure final EditText tagTitle = new EditText(this); tagTitle.setSingleLine(true);//from www. j a v a 2 s .co m tagTitle.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); // Set tagTitle maxLength int maxLength = 50; InputFilter[] array = new InputFilter[1]; array[0] = new InputFilter.LengthFilter(maxLength); tagTitle.setFilters(array); // Get tagName text into EditText try { assert info != null; tagTitle.setText(tags.getJSONObject(info.position).getString("tagName")); } catch (JSONException e) { e.printStackTrace(); } final LinearLayout l = new LinearLayout(this); l.setOrientation(LinearLayout.VERTICAL); l.addView(tagTitle); // Show rename dialog new AlertDialog.Builder(this).setTitle(R.string.rename_tag_dialog_title).setView(l) .setPositiveButton(R.string.rename_tag_dialog_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // 'Rename' pressed, change tagName and store try { JSONObject newTagName = tags.getJSONObject(info.position); newTagName.put("tagName", tagTitle.getText()); tags.put(info.position, newTagName); adapter.notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); } writeToJSON(); Toast toast = Toast.makeText(getApplicationContext(), R.string.toast_tag_renamed, Toast.LENGTH_SHORT); toast.show(); imm.hideSoftInputFromWindow(tagTitle.getWindowToken(), 0); } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { imm.hideSoftInputFromWindow(tagTitle.getWindowToken(), 0); } }).show(); tagTitle.requestFocus(); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); return true; } // If Delete Tag pressed else if (item.getTitle().equals(getResources().getString(R.string.delete_context_menu))) { // Construct dialog message String dialogMessage = ""; assert info != null; try { dialogMessage = getResources().getString(R.string.delete_context_menu_dialog1) + " '" + tags.getJSONObject(info.position).getString("tagName") + "'?"; } catch (JSONException e) { e.printStackTrace(); dialogMessage = getResources().getString(R.string.delete_context_menu_dialog2); } // Show delete dialog new AlertDialog.Builder(this).setMessage(dialogMessage) .setPositiveButton(R.string.yes_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { JSONArray newArray = new JSONArray(); // Copy contents to new array, without the deleted item for (int i = 0; i < tags.length(); i++) { if (i != info.position) { try { newArray.put(tags.get(i)); } catch (JSONException e) { e.printStackTrace(); } } } // Equal original array to new array tags = newArray; // Write to file try { settings.put("tags", tags); root.put("settings", settings); } catch (JSONException e) { e.printStackTrace(); } writeToJSON(); adapter.adapterData = tags; adapter.notifyDataSetChanged(); updateListViewHeight(listView); // If no tags, show 'Press + to add Tags' textView if (tags.length() == 0) noTags.setVisibility(View.VISIBLE); else noTags.setVisibility(View.INVISIBLE); Toast toast = Toast.makeText(getApplicationContext(), R.string.toast_tag_deleted, Toast.LENGTH_SHORT); toast.show(); } }).setNegativeButton(R.string.no_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Do nothing, close dialog } }).show(); return true; } return super.onContextItemSelected(item); }
From source file:com.ycdyng.onemulti.OneActivity.java
public void showSoftInput(EditText view) { view.requestFocus();/*from w w w . j a v a 2 s .com*/ if (mInputMethodManager == null) { mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); } try { mInputMethodManager.showSoftInput(view, InputMethodManager.SHOW_FORCED); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.songcode.materialnotes.ui.NotesListActivity.java
private void showSoftInput() { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }//w w w.j ava 2s .c o m }
From source file:com.duy.pascal.ui.view.console.ConsoleView.java
private void doShowSoftKeyboard() { InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(this, InputMethodManager.SHOW_FORCED); }
From source file:org.navitproject.navit.Navit.java
/** * @brief Shows the native keyboard or other input method. * /*from w ww. ja v a2 s. c o m*/ * @return {@code true} if an input method is going to be displayed, {@code false} if not */ public int showNativeKeyboard() { /* * Apologies for the huge mess that this function is, but Android's soft input API is a big * nightmare. Its devs have mercifully given us an option to show or hide the keyboard, but * there is no reliable way to figure out if it is actually showing, let alone how much of the * screen it occupies, so our best bet is guesswork. */ Configuration config = getResources().getConfiguration(); if ((config.keyboard == Configuration.KEYBOARD_QWERTY) && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO)) /* physical keyboard present, exit */ return 0; /* Use SHOW_FORCED here, else keyboard won't show in landscape mode */ mgr.showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED); show_soft_keyboard_now_showing = true; /* * Crude way to estimate the height occupied by the keyboard: for AOSP on KitKat and Lollipop it * is about 62-63% of available screen width (in portrait mode) but no more than slightly above * 46% of height (in landscape mode). */ Display display_ = getWindowManager().getDefaultDisplay(); int width_ = display_.getWidth(); int height_ = display_.getHeight(); int maxHeight = height_ * 47 / 100; int inputHeight = width_ * 63 / 100; if (inputHeight > (maxHeight)) inputHeight = maxHeight; /* the receiver isn't going to fire before the UI thread becomes idle, well after this method returns */ Log.d(TAG, "showNativeKeyboard:return (assuming true)"); return inputHeight; }
From source file:com.atwal.wakeup.battery.util.Utilities.java
public static void showSoftInput(InputMethodManager inputManager, View v) { inputManager.showSoftInput(v, InputMethodManager.SHOW_FORCED); }
From source file:org.woltage.irssiconnectbot.ConsoleActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); View view = findCurrentView(R.id.console_flip); final TerminalView terminalView = (TerminalView) findCurrentView(R.id.console_flip); final boolean activeTerminal = (view instanceof TerminalView); boolean sessionOpen = false; boolean disconnected = false; boolean canForwardPorts = false; if (activeTerminal) { TerminalBridge bridge = ((TerminalView) view).bridge; sessionOpen = bridge.isSessionOpen(); disconnected = bridge.isDisconnected(); canForwardPorts = bridge.canFowardPorts(); }/* w ww .j a v a 2 s . com*/ menu.setQwertyMode(true); disconnect = menu.add(R.string.list_host_disconnect); if (hardKeyboard) disconnect.setAlphabeticShortcut('w'); if (!sessionOpen && disconnected) disconnect.setTitle(R.string.console_menu_close); disconnect.setEnabled(activeTerminal); disconnect.setIcon(android.R.drawable.ic_menu_close_clear_cancel); disconnect.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // disconnect or close the currently visible session TerminalView terminalView = (TerminalView) findCurrentView(R.id.console_flip); TerminalBridge bridge = terminalView.bridge; bridge.dispatchDisconnect(true); if (bound != null && prefs.getBoolean("unloadKeysOnDisconnect", true)) { bound.lockUnusedKeys(); } return true; } }); copy = menu.add(R.string.console_menu_copy); if (hardKeyboard) copy.setAlphabeticShortcut('c'); copy.setIcon(android.R.drawable.ic_menu_set_as); copy.setEnabled(activeTerminal); copy.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // mark as copying and reset any previous bounds TerminalView terminalView = (TerminalView) findCurrentView(R.id.console_flip); copySource = terminalView.bridge; SelectionArea area = copySource.getSelectionArea(); area.reset(); area.setBounds(copySource.buffer.getColumns(), copySource.buffer.getRows()); area.setRow(copySource.buffer.getCursorRow()); area.setColumn(copySource.buffer.getCursorColumn()); copySource.setSelectingForCopy(true); // Make sure we show the initial selection copySource.redraw(); Toast.makeText(ConsoleActivity.this, getString(R.string.console_copy_start), Toast.LENGTH_LONG) .show(); return true; } }); paste = menu.add(R.string.console_menu_paste); if (hardKeyboard) paste.setAlphabeticShortcut('v'); paste.setIcon(android.R.drawable.ic_menu_edit); paste.setEnabled(clipboard.hasText() && sessionOpen); paste.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { // force insert of clipboard text into current console TerminalView terminalView = (TerminalView) findCurrentView(R.id.console_flip); TerminalBridge bridge = terminalView.bridge; // pull string from clipboard and generate all events to force // down String clip = clipboard.getText().toString(); bridge.injectString(clip); return true; } }); portForward = menu.add(R.string.console_menu_portforwards); if (hardKeyboard) portForward.setAlphabeticShortcut('f'); portForward.setIcon(android.R.drawable.ic_menu_manage); portForward.setEnabled(sessionOpen && canForwardPorts); portForward.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { TerminalView terminalView = (TerminalView) findCurrentView(R.id.console_flip); TerminalBridge bridge = terminalView.bridge; Intent intent = new Intent(ConsoleActivity.this, PortForwardListActivity.class); intent.putExtra(Intent.EXTRA_TITLE, bridge.host.getId()); ConsoleActivity.this.startActivityForResult(intent, REQUEST_EDIT); return true; } }); urlscan = menu.add(R.string.console_menu_urlscan); if (hardKeyboard) urlscan.setAlphabeticShortcut('u'); urlscan.setIcon(android.R.drawable.ic_menu_search); urlscan.setEnabled(activeTerminal); urlscan.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { final TerminalView terminal = (TerminalView) findCurrentView(R.id.console_flip); TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.urlScan(terminal); return true; } }); resize = menu.add(R.string.console_menu_resize); if (hardKeyboard) resize.setAlphabeticShortcut('s'); resize.setIcon(android.R.drawable.ic_menu_crop); resize.setEnabled(sessionOpen); resize.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { final TerminalView terminalView = (TerminalView) findCurrentView(R.id.console_flip); final View resizeView = inflater.inflate(R.layout.dia_resize, null, false); ((EditText) resizeView.findViewById(R.id.width)) .setText(prefs.getString("default_fsize_width", "80")); ((EditText) resizeView.findViewById(R.id.height)) .setText(prefs.getString("default_fsize_height", "25")); new AlertDialog.Builder(ConsoleActivity.this).setView(resizeView) .setPositiveButton(R.string.button_resize, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { int width, height; try { width = Integer.parseInt( ((EditText) resizeView.findViewById(R.id.width)).getText().toString()); height = Integer.parseInt( ((EditText) resizeView.findViewById(R.id.height)).getText().toString()); } catch (NumberFormatException nfe) { // TODO change this to a real dialog where we can // make the input boxes turn red to indicate an error. return; } if (width > 0 && height > 0) { terminalView.forceSize(width, height); terminalView.bridge.parentChanged(terminalView); } else { new AlertDialog.Builder(ConsoleActivity.this) .setMessage("Width and height must be higher than zero.") .setTitle("Error").show(); } } }).setNegativeButton(android.R.string.cancel, null).create().show(); return true; } }); MenuItem ctrlKey = menu.add("Ctrl"); ctrlKey.setEnabled(activeTerminal); ctrlKey.setIcon(R.drawable.button_ctrl); MenuItemCompat.setShowAsAction(ctrlKey, MenuItem.SHOW_AS_ACTION_IF_ROOM); ctrlKey.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return false; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.metaPress(TerminalKeyListener.META_CTRL_ON); terminal.bridge.tryKeyVibrate(); return true; } }); MenuItem escKey = menu.add("Esc"); escKey.setEnabled(activeTerminal); escKey.setIcon(R.drawable.button_esc); MenuItemCompat.setShowAsAction(escKey, MenuItem.SHOW_AS_ACTION_IF_ROOM); escKey.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return false; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.sendEscape(); terminal.bridge.tryKeyVibrate(); return true; } }); MenuItem symKey = menu.add("SYM"); symKey.setEnabled(activeTerminal); symKey.setIcon(R.drawable.button_sym); MenuItemCompat.setShowAsAction(symKey, MenuItem.SHOW_AS_ACTION_IF_ROOM); symKey.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return false; TerminalView terminal = (TerminalView) flip; TerminalKeyListener handler = terminal.bridge.getKeyHandler(); handler.showCharPickerDialog(terminal); return true; } }); MenuItem inputButton = menu.add("Input"); inputButton.setEnabled(activeTerminal); inputButton.setIcon(R.drawable.button_input); MenuItemCompat.setShowAsAction(inputButton, MenuItem.SHOW_AS_ACTION_IF_ROOM); inputButton.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return false; final TerminalView terminal = (TerminalView) flip; Thread promptThread = new Thread(new Runnable() { public void run() { String inj = getCurrentPromptHelper().requestStringPrompt(null, ""); terminal.bridge.injectString(inj); } }); promptThread.setName("Prompt"); promptThread.setDaemon(true); promptThread.start(); return true; } }); MenuItem keyboard = menu.add("Show Keyboard"); keyboard.setEnabled(activeTerminal); keyboard.setIcon(R.drawable.button_keyboard); MenuItemCompat.setShowAsAction(keyboard, MenuItem.SHOW_AS_ACTION_IF_ROOM); keyboard.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { View flip = findCurrentView(R.id.console_flip); if (flip == null) return false; inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED); return true; } }); MenuItem keys = menu.add(R.string.console_menu_pubkeys); keys.setIcon(android.R.drawable.ic_lock_lock); keys.setIntent(new Intent(this, PubkeyListActivity.class)); keys.setEnabled(activeTerminal); keys.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { Intent intent = new Intent(ConsoleActivity.this, PubkeyListActivity.class); intent.putExtra(PubkeyListActivity.PICK_MODE, true); ConsoleActivity.this.startActivityForResult(intent, REQUEST_SELECT); return true; } }); return true; }
From source file:com.github.dfa.diaspora_android.activity.MainActivity.java
/** * Handle clicks on the optionsmenu// w ww .j a v a2 s .com * * @param item item * @return boolean */ @Override public boolean onOptionsItemSelected(MenuItem item) { AppLog.i(this, "onOptionsItemSelected()"); switch (item.getItemId()) { case R.id.action_notifications: { if (appSettings.isExtendedNotificationsActivated()) { return true; } //Otherwise we execute the action of action_notifications_all } case R.id.action_notifications_all: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getNotificationsUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_notifications_also_commented: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getSuburlNotificationsAlsoCommentedUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_notifications_comment_on_post: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getSuburlNotificationsCommentOnPostUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_notifications_liked: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getSuburlNotificationsLikedUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_notifications_mentioned: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getSuburlNotificationsMentionedUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_notifications_reshared: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getSuburlNotificationsResharedUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_notifications_started_sharing: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getSuburlNotificationsStartedSharingUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_conversations: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getConversationsUrl()); return true; } else { snackbarNoInternet.show(); return false; } } case R.id.action_exit: { moveTaskToBack(true); finish(); return true; } case R.id.action_compose: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getNewPostUrl()); } else { snackbarNoInternet.show(); } return true; } case R.id.action_search: { if (WebHelper.isOnline(MainActivity.this)) { final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); @SuppressLint("InflateParams") View layout = getLayoutInflater().inflate(R.layout.ui__dialog_search__people_tags, null, false); final EditText input = (EditText) layout.findViewById(R.id.dialog_search__input); ThemeHelper.updateEditTextColor(input); final DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int which) { String query = input.getText().toString().trim() .replaceAll((which == DialogInterface.BUTTON_NEGATIVE ? "\\*" : "\\#"), ""); if (query.equals("")) { Snackbar.make(fragmentContainer, R.string.search_alert_bypeople_validate_needsomedata, Snackbar.LENGTH_LONG).show(); } else { openDiasporaUrl( which == DialogInterface.BUTTON_NEGATIVE ? urls.getSearchPeopleUrl(query) : urls.getSearchTagsUrl(query)); } getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); imm.hideSoftInputFromWindow(input.getWindowToken(), 0); } }; final AlertDialog dialog = new ThemedAlertDialogBuilder(this, appSettings).setView(layout) .setTitle(R.string.search_alert_title).setCancelable(true) .setPositiveButton(R.string.search_alert_tag, clickListener) .setNegativeButton(R.string.search_alert_people, clickListener).create(); input.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { dialog.hide(); clickListener.onClick(null, 0); return true; } return false; } }); // Popup keyboard dialog.show(); input.requestFocus(); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } else { snackbarNoInternet.show(); } return true; } } return super.onOptionsItemSelected(item); }