/** * @param show * @param InputMethodManagerFlags 0 for regular (good for regular hide). or can use something like * InputMethodManager.SHOW_FORCED or InputMethodManager.SHOW_IMPLICIT */ public void hideShowKeyboard(boolean show, int InputMethodManagerFlags) { if (inputMethodManager == null) inputMethodManager = superTextActivity.getInputMethodManager(); if (show) inputMethodManager.showSoftInput(autoCompleteTextView, InputMethodManagerFlags); else inputMethodManager.hideSoftInputFromWindow( autoCompleteTextView.getWindowToken(), InputMethodManagerFlags); }
protected void runFindOnPage(boolean directionForward) { superTextActivity.searchingTerm = superTextActivity.searchActionbar.getText(); if (superTextActivity.searchingTerm.equals("")) { Toast.makeText( superTextActivity, getRString(R.string.enter_word_to_search), Toast.LENGTH_SHORT) .show(); return; } this.directionForward = directionForward; if (!isWorking) { FindOnPageBackground findOnPageBackground = new FindOnPageBackground(); findOnPageBackground.execute(superTextActivity.searchingTerm); } else { Log.d("FindOnPage", "isWorking"); } if (!superTextActivity.searchingTerm.equals(lastSearchingTerm)) { GoogleTracker.sendEvent(GoogleTracker.CATEGORY_FIND_ON_PAGE, superTextActivity.searchingTerm); } Settings.addSearchTerm(superTextActivity.searchingTerm); hideShowKeyboard(false, 0); setAutoCompleteAdapter(); }
public FindOnPage(final SuperTextActivity superTextActivity) { this.superTextActivity = superTextActivity; if (autoCompleteTextView == null) { autoCompleteTextView = (AutoCompleteTextView) superTextActivity.findViewById(R.id.auto_complete_text_view); setAutoCompleteAdapter(); autoCompleteTextView.setOnItemClickListener(autoCompleteItemClick); autoCompleteTextView.setOnFocusChangeListener(autoComFocus); autoCompleteTextView.setOnEditorActionListener(autoComEnterClick); autoCompleteTextView.requestFocus(); // open the keyboard focused in the edtSearch hideShowKeyboard(true, InputMethodManager.SHOW_IMPLICIT); } }