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); } } }
private void onTextChanged(CharSequence newText) { CharSequence text = mSearchEditText.getText(); mUserQuery = text; boolean hasText = !TextUtils.isEmpty(text); if (hasText) { mEmptyImageView.setVisibility(VISIBLE); showVoice(false); } else { mEmptyImageView.setVisibility(GONE); showVoice(true); } if (mOnQueryChangeListener != null && !TextUtils.equals(newText, mOldQueryText)) { mOnQueryChangeListener.onQueryTextChange(newText.toString()); } mOldQueryText = newText.toString(); }