Updating the search hint to contain the icon as a span object.

This makes the icon part of the hint text, and removes any need for
custom focus event handling.
Also the icon will now appear at the start of the text  based on the
direction of the text and not the direction of the layout

Change-Id: I06c5cf99492d75b1005c69ec7c521cde0fdab010
This commit is contained in:
Sunny Goyal
2016-07-21 10:42:30 -07:00
parent 58368b1515
commit ce3fffb5fb
4 changed files with 77 additions and 40 deletions

View File

@@ -39,8 +39,7 @@ import java.util.ArrayList;
* An interface to a search box that AllApps can command.
*/
public abstract class AllAppsSearchBarController
implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener,
View.OnFocusChangeListener {
implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener {
protected Launcher mLauncher;
protected AlphabeticalAppsList mApps;
@@ -50,8 +49,6 @@ public abstract class AllAppsSearchBarController
protected DefaultAppSearchAlgorithm mSearchAlgorithm;
protected InputMethodManager mInputMethodManager;
protected View mHintView;
public void setVisibility(int visibility) {
mInput.setVisibility(visibility);
}
@@ -69,7 +66,6 @@ public abstract class AllAppsSearchBarController
mInput.addTextChangedListener(this);
mInput.setOnEditorActionListener(this);
mInput.setOnBackKeyListener(this);
mInput.setOnFocusChangeListener(this);
mInputMethodManager = (InputMethodManager)
mInput.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
@@ -130,27 +126,6 @@ public abstract class AllAppsSearchBarController
return false;
}
@Override
public void onFocusChange(View view, boolean focused) {
if (mHintView != null) {
mHintView.setVisibility(focused ? View.INVISIBLE : View.VISIBLE);
}
}
/**
* Sets a view to serve as the search field's hint.
*/
public void setHintView(View hintView) {
mHintView = hintView;
}
/**
* Returns the search field's hint view.
*/
public View getHintView() {
return mHintView;
}
/**
* Resets the search bar state.
*/