summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndroid Build Merger (Role) <noreply-android-build-merger@google.com>2018-06-05 23:23:19 +0000
committerAndroid Build Merger (Role) <noreply-android-build-merger@google.com>2018-06-05 23:23:19 +0000
commitb47aa5d0d1d16762c4a0cd50e3a414efc309cfd2 (patch)
tree5428add56db4be2dcbe9f1356746cad63a728058 /src
parentbf3ac479a4c17472944c94c2f8f0719b932aa5d8 (diff)
parent25b4dfee29b81abfd232073dfded1e7b00ea3221 (diff)
downloadandroid_packages_apps_Trebuchet-b47aa5d0d1d16762c4a0cd50e3a414efc309cfd2.tar.gz
android_packages_apps_Trebuchet-b47aa5d0d1d16762c4a0cd50e3a414efc309cfd2.tar.bz2
android_packages_apps_Trebuchet-b47aa5d0d1d16762c4a0cd50e3a414efc309cfd2.zip
[automerger] Hides the keyboard when qsb loses focus in All apps am: 25b4dfee29
Change-Id: I27a5d03b26345596918aca62a89e78255bef4c9c
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/ExtendedEditText.java8
-rw-r--r--src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java13
2 files changed, 18 insertions, 3 deletions
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java
index 403c8b8ba..4e0f2e744 100644
--- a/src/com/android/launcher3/ExtendedEditText.java
+++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -99,6 +99,10 @@ public class ExtendedEditText extends EditText {
mShowImeAfterFirstLayout = !showSoftInput();
}
+ public void hideKeyboard() {
+ UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
+ }
+
private boolean showSoftInput() {
return requestFocus() &&
((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
@@ -106,7 +110,7 @@ public class ExtendedEditText extends EditText {
}
public void dispatchBackKey() {
- UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
+ hideKeyboard();
if (mBackKeyListener != null) {
mBackKeyListener.onBackKey();
}
@@ -135,6 +139,6 @@ public class ExtendedEditText extends EditText {
nextFocus.requestFocus();
}
}
- UiThreadHelper.hideKeyboardAsync(getContext(), getWindowToken());
+ hideKeyboard();
}
}
diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
index e83904fe8..dcc45545a 100644
--- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
@@ -21,6 +21,8 @@ import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnFocusChangeListener;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@@ -37,7 +39,8 @@ import java.util.ArrayList;
* An interface to a search box that AllApps can command.
*/
public class AllAppsSearchBarController
- implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener {
+ implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener,
+ OnFocusChangeListener {
protected Launcher mLauncher;
protected Callbacks mCb;
@@ -62,6 +65,7 @@ public class AllAppsSearchBarController
mInput.addTextChangedListener(this);
mInput.setOnEditorActionListener(this);
mInput.setOnBackKeyListener(this);
+ mInput.setOnFocusChangeListener(this);
mSearchAlgorithm = searchAlgorithm;
}
@@ -123,6 +127,13 @@ public class AllAppsSearchBarController
return false;
}
+ @Override
+ public void onFocusChange(View view, boolean hasFocus) {
+ if (!hasFocus) {
+ mInput.hideKeyboard();
+ }
+ }
+
/**
* Resets the search bar state.
*/