summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
diff options
context:
space:
mode:
authorPeter Schiller <peterschiller@google.com>2016-07-19 16:01:32 -0700
committerPeter Schiller <peterschiller@google.com>2016-07-19 17:30:44 -0700
commit637e40ad6f7f8bbc5e6925f89eac7ae183366b16 (patch)
treee9f9363bda8f68c11deb044ecbecfe6f8bb59df7 /src/com/android/launcher3/allapps/AllAppsSearchBarController.java
parentbbff2926f8dd61b99f62d56390815ca84cece51e (diff)
downloadandroid_packages_apps_Trebuchet-637e40ad6f7f8bbc5e6925f89eac7ae183366b16.tar.gz
android_packages_apps_Trebuchet-637e40ad6f7f8bbc5e6925f89eac7ae183366b16.tar.bz2
android_packages_apps_Trebuchet-637e40ad6f7f8bbc5e6925f89eac7ae183366b16.zip
Centered typing in search field
Change-Id: Iae46722195d0d06ff88da52df4fa48ca7b157512
Diffstat (limited to 'src/com/android/launcher3/allapps/AllAppsSearchBarController.java')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsSearchBarController.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
index ac3593238..b4a71caf8 100644
--- a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
@@ -39,7 +39,8 @@ import java.util.ArrayList;
* An interface to a search box that AllApps can command.
*/
public abstract class AllAppsSearchBarController
- implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener {
+ implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener,
+ View.OnFocusChangeListener {
protected Launcher mLauncher;
protected AlphabeticalAppsList mApps;
@@ -49,6 +50,8 @@ public abstract class AllAppsSearchBarController
protected DefaultAppSearchAlgorithm mSearchAlgorithm;
protected InputMethodManager mInputMethodManager;
+ protected View mHintView;
+
public void setVisibility(int visibility) {
mInput.setVisibility(visibility);
}
@@ -66,6 +69,7 @@ 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);
@@ -126,6 +130,27 @@ 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.
*/