Loading src/com/android/launcher3/ExtendedEditText.java +10 −0 Original line number Diff line number Diff line Loading @@ -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() {} } src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +17 −6 Original line number Diff line number Diff line Loading @@ -41,13 +41,24 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<L public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { int scrolledOffset = recyclerView.computeVerticalScrollOffset(); ExtendedEditText input = mSearchUiManager.getEditText(); if (input != null) { // Save the input box state on scroll down if (dy > 0) { input.saveFocusedStateAndUpdateToUnfocusedState(); } // Scroll up and scroll to top if (dy < 0 && scrolledOffset == 0 && input != null) { 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(); } } } }; Loading Loading
src/com/android/launcher3/ExtendedEditText.java +10 −0 Original line number Diff line number Diff line Loading @@ -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() {} }
src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java +17 −6 Original line number Diff line number Diff line Loading @@ -41,13 +41,24 @@ public class LauncherAllAppsContainerView extends ActivityAllAppsContainerView<L public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { int scrolledOffset = recyclerView.computeVerticalScrollOffset(); ExtendedEditText input = mSearchUiManager.getEditText(); if (input != null) { // Save the input box state on scroll down if (dy > 0) { input.saveFocusedStateAndUpdateToUnfocusedState(); } // Scroll up and scroll to top if (dy < 0 && scrolledOffset == 0 && input != null) { 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(); } } } }; Loading