diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java index c59f25d85a..f94a3c5521 100644 --- a/src/com/android/launcher3/ExtendedEditText.java +++ b/src/com/android/launcher3/ExtendedEditText.java @@ -159,4 +159,14 @@ public class ExtendedEditText extends EditText { listener.onFocusChange(this, focused); } } + + /** + * Save the input, suggestion, hint states when it's on focus, and set to unfocused states. + */ + public void saveFocusedStateAndUpdateToUnfocusedState() {} + + /** + * Restore to the previous saved focused state. + */ + public void restoreToFocusedState() {} } diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java index 92e29bbdf5..229d8f81e2 100644 --- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java @@ -41,12 +41,23 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView 0) { + input.saveFocusedStateAndUpdateToUnfocusedState(); + } + + // Scroll up and scroll to top + if (dy < 0 && scrolledOffset == 0) { + // Show keyboard + boolean isImeEnabledOnSwipeUp = Launcher.getLauncher(mActivityContext) + .getSearchConfig().isImeEnabledOnSwipeUp(); + if (isImeEnabledOnSwipeUp || !TextUtils.isEmpty(input.getText())) { + input.showKeyboard(); + } + + // Restore state in input box + input.restoreToFocusedState(); } } }