Example #1
0
  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();
  }