Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c0303b6 authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Focus Taskbar search EditText and show IME on meta key toggle.

Test: adb shell input keyevent 117
Fix: 300116542
Flag: ENABLE_ALL_APPS_SEARCH_IN_TASKBAR
Change-Id: Iaf15240f49e978078cd586169be1665e1a86eda5
parent 50fac00e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -347,6 +347,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mControllers.taskbarAllAppsController.toggle();
    }

    /** Toggles Taskbar All Apps overlay with keyboard ready for search. */
    public void toggleAllAppsSearch() {
        mControllers.taskbarAllAppsController.toggleSearch();
    }

    @Override
    public DeviceProfile getDeviceProfile() {
        return mDeviceProfile;
+1 −1
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ public class TaskbarManager {
            return;
        }

        mTaskbarActivityContext.toggleAllApps();
        mTaskbarActivityContext.toggleAllAppsSearch();
    }

    /**
+19 −2
Original line number Diff line number Diff line
@@ -128,10 +128,19 @@ public final class TaskbarAllAppsController {

    /** Toggles visibility of {@link TaskbarAllAppsContainerView} in the overlay window. */
    public void toggle() {
        toggle(false);
    }

    /** Toggles visibility of {@link TaskbarAllAppsContainerView} with the keyboard for search. */
    public void toggleSearch() {
        toggle(true);
    }

    private void toggle(boolean showKeyboard) {
        if (isOpen()) {
            mSlideInView.close(true);
        } else {
            show(true);
            show(true, showKeyboard);
        }
    }

@@ -141,6 +150,10 @@ public final class TaskbarAllAppsController {
    }

    private void show(boolean animate) {
        show(animate, false);
    }

    private void show(boolean animate, boolean showKeyboard) {
        if (mAppsView != null) {
            return;
        }
@@ -166,7 +179,11 @@ public final class TaskbarAllAppsController {
            cleanUpOverlay();
        });
        TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController(
                mOverlayContext, mSlideInView, mControllers, mSearchSessionController);
                mOverlayContext,
                mSlideInView,
                mControllers,
                mSearchSessionController,
                showKeyboard);

        viewController.show(animate);
        mAppsView = mOverlayContext.getAppsView();
+10 −2
Original line number Diff line number Diff line
@@ -41,12 +41,14 @@ final class TaskbarAllAppsViewController {
    private final TaskbarStashController mTaskbarStashController;
    private final NavbarButtonsViewController mNavbarButtonsViewController;
    private final TaskbarOverlayController mOverlayController;
    private final boolean mShowKeyboard;

    TaskbarAllAppsViewController(
            TaskbarOverlayContext context,
            TaskbarAllAppsSlideInView slideInView,
            TaskbarControllers taskbarControllers,
            TaskbarSearchSessionController searchSessionController) {
            TaskbarSearchSessionController searchSessionController,
            boolean showKeyboard) {

        mContext = context;
        mSlideInView = slideInView;
@@ -54,6 +56,7 @@ final class TaskbarAllAppsViewController {
        mTaskbarStashController = taskbarControllers.taskbarStashController;
        mNavbarButtonsViewController = taskbarControllers.navbarButtonsViewController;
        mOverlayController = taskbarControllers.taskbarOverlayController;
        mShowKeyboard = showKeyboard;

        mSlideInView.init(new TaskbarAllAppsCallbacks(searchSessionController));
        setUpAppDivider();
@@ -120,6 +123,11 @@ final class TaskbarAllAppsViewController {
        @Override
        public void onAllAppsTransitionEnd(boolean toAllApps) {
            mSearchSessionController.onAllAppsTransitionEnd(toAllApps);
            if (toAllApps
                    && mShowKeyboard
                    && mAppsView.getSearchUiManager().getEditText() != null) {
                mAppsView.getSearchUiManager().getEditText().requestFocus();
            }
        }

        /** Invoked on back press, returning {@code true} if the search session handled it. */
@@ -128,7 +136,7 @@ final class TaskbarAllAppsViewController {
        }

        void onAllAppsAnimationPending(PendingAnimation animation, boolean toAllApps) {
            mSearchSessionController.onAllAppsAnimationPending(animation, toAllApps);
            mSearchSessionController.onAllAppsAnimationPending(animation, toAllApps, mShowKeyboard);
        }
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -51,7 +51,11 @@ open class TaskbarSearchSessionController : ResourceBasedOverride, AllAppsTransi

    open fun handleBackInvoked(): Boolean = false

    open fun onAllAppsAnimationPending(animation: PendingAnimation, toAllApps: Boolean) = Unit
    open fun onAllAppsAnimationPending(
        animation: PendingAnimation,
        toAllApps: Boolean,
        showKeyboard: Boolean,
    ) = Unit

    companion object {
        @JvmStatic