public void onClick(View v) { if (v == mBackImageView) { closeSearch(); } else if (v == mVoiceImageView) { onVoiceClicked(); } else if (v == mEmptyImageView) { mSearchEditText.setText(null); } else if (v == mSearchEditText) { showSuggestions(); } else if (v == mTintView) { closeSearch(); } }
@Override public void onBackPressed() { if (mSearchView.isSearchOpen()) { mSearchView.closeSearch(); } else { super.onBackPressed(); } }
private void onSubmitQuery() { CharSequence query = mSearchEditText.getText(); if (query != null && TextUtils.getTrimmedLength(query) > 0) { if (mOnQueryChangeListener == null || !mOnQueryChangeListener.onQueryTextSubmit(query.toString())) { closeSearch(); mSearchEditText.setText(null); } } }