private void showHideSearchView() { if (mSearchView.getVisibility() == View.VISIBLE) { mSearchView.setFocusable(false); mSearchView.setVisibility(View.GONE); hideSoftKeyboard(this); } else { mSearchView.setVisibility(View.VISIBLE); mSearchView.setQuery("", false); mSearchView.setFocusable(true); mSearchView.requestFocus(); showSoftKeyboard(this); } }
@Override public boolean onQueryTextSubmit(String query) { mSearchView.clearFocus(); hideSearchView(); UtilMethods.hideSoftKeyboard(this); fragmentManager = getSupportFragmentManager(); fragmentManager .beginTransaction() .replace(R.id.container, ResultListFragment.newInstance("", query)) .commit(); navigationDepth = 4; searchQueryTitle = query; return false; }
@Override public boolean onQueryTextChange(String newText) { if (newText.length() == 0) { hideSuggestionList(); UtilMethods.hideSoftKeyboard(this); mSearchView.clearFocus(); mCurrentSearchText = null; return false; } if (!TextUtils.isEmpty(newText)) { getSearchSuggestions(newText); mCurrentSearchText = newText; return true; } return false; }