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

Commit 2a2f1b6c authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Polish all apps taskbar unstash behavior for transient and persistent.

- During gestures from taskbar all apps, unstash immediately in
  transient.
- Overlay closes sooner if all apps is open (still done later for EDU).
- Taskbar stashes in overview when All Apps is opened.
- Transient app-window threshold is ignored if All Apps is opened.

Test: Manual
Fix: 262076812
Change-Id: I46b2dcdc75ee0cc15c1b47da2139ff8c20cf618a
parent 74229430
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -887,6 +887,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        return mControllers.taskbarStashController.isStashed();
    }

    /** Returns {@code true} if taskbar All Apps is open. */
    public boolean isTaskbarAllAppsOpen() {
        return mControllers.taskbarAllAppsController.isOpen();
    }

    /**
     * Called to start the taskbar translation spring to its settled translation (0).
     */
+10 −2
Original line number Diff line number Diff line
@@ -85,7 +85,8 @@ public class TaskbarUIController {
     * Manually closes the overlay window.
     */
    public void hideOverlayWindow() {
        if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext)) {
        if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext)
                || mControllers.taskbarAllAppsController.isOpen()) {
            mControllers.taskbarOverlayController.hideWindow();
        }
    }
@@ -102,12 +103,19 @@ public class TaskbarUIController {
    }

    /**
     * Returns true iff taskbar is stashed.
     * Returns {@code true} iff taskbar is stashed.
     */
    public boolean isTaskbarStashed() {
        return mControllers.taskbarStashController.isStashed();
    }

    /**
     * Returns {@code true} iff taskbar All Apps is open.
     */
    public boolean isTaskbarAllAppsOpen() {
        return mControllers.taskbarAllAppsController.isOpen();
    }

    /**
     * Called at the end of the swipe gesture on Transient taskbar.
     */
+11 −5
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import java.util.List;
public final class TaskbarAllAppsController {

    private TaskbarControllers mControllers;
    private @Nullable TaskbarAllAppsSlideInView mSlideInView;
    private @Nullable TaskbarAllAppsContainerView mAppsView;

    // Application data models.
@@ -107,6 +108,11 @@ public final class TaskbarAllAppsController {
        show(true);
    }

    /** Returns {@code true} if All Apps is open. */
    public boolean isOpen() {
        return mSlideInView != null && mSlideInView.isOpen();
    }

    private void show(boolean animate) {
        if (mAppsView != null) {
            return;
@@ -117,15 +123,15 @@ public final class TaskbarAllAppsController {

        TaskbarOverlayContext overlayContext =
                mControllers.taskbarOverlayController.requestWindow();
        TaskbarAllAppsSlideInView slideInView =
                (TaskbarAllAppsSlideInView) overlayContext.getLayoutInflater().inflate(
        mSlideInView = (TaskbarAllAppsSlideInView) overlayContext.getLayoutInflater().inflate(
                R.layout.taskbar_all_apps, overlayContext.getDragLayer(), false);
        slideInView.addOnCloseListener(() -> {
        mSlideInView.addOnCloseListener(() -> {
            mControllers.getSharedState().allAppsVisible = false;
            mSlideInView = null;
            mAppsView = null;
        });
        TaskbarAllAppsViewController viewController = new TaskbarAllAppsViewController(
                overlayContext, slideInView, mControllers);
                overlayContext, mSlideInView, mControllers);

        viewController.show(animate);
        mAppsView = overlayContext.getAppsView();
+7 −10
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
 */
package com.android.launcher3.taskbar.allapps;

import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_AUTO;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
@@ -90,20 +88,19 @@ final class TaskbarAllAppsViewController {
    }

    private void setUpTaskbarStashing() {
        mTaskbarStashController.updateStateForFlag(
                DisplayController.isTransientTaskbar(mContext)
                        ? FLAG_STASHED_IN_APP_AUTO
                        : FLAG_STASHED_IN_TASKBAR_ALL_APPS,
                true);
        mTaskbarStashController.applyState(
                ALL_APPS.getTransitionDuration(mContext, true /* isToState */));
        mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true);
        mTaskbarStashController.applyState(mOverlayController.getOpenDuration());

        mNavbarButtonsViewController.setSlideInViewVisible(true);
        mSlideInView.setOnCloseBeginListener(() -> {
            mNavbarButtonsViewController.setSlideInViewVisible(false);
            AbstractFloatingView.closeOpenContainer(
                    mContext, AbstractFloatingView.TYPE_ACTION_POPUP);
            if (!DisplayController.isTransientTaskbar(mContext)) {

            if (DisplayController.isTransientTaskbar(mContext)) {
                mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false);
                mTaskbarStashController.applyState(mOverlayController.getCloseDuration());
            } else {
                // Post in case view is closing due to gesture navigation. If a gesture is in
                // progress, wait to unstash until after the gesture is finished.
                MAIN_EXECUTOR.post(() -> mTaskbarStashController.resetFlagIfNoGestureInProgress(
+4 −2
Original line number Diff line number Diff line
@@ -318,7 +318,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    private final int mTaskbarAppWindowThreshold;
    private final int mTaskbarHomeOverviewThreshold;
    private final int mTaskbarCatchUpThreshold;
    private boolean mTaskbarAlreadyOpen;
    private final boolean mTaskbarAlreadyOpen;
    private final boolean mIsTaskbarAllAppsOpen;
    private final boolean mIsTransientTaskbar;
    // May be set to false when mIsTransientTaskbar is true.
    private boolean mCanSlowSwipeGoHome = true;
@@ -359,6 +360,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
                && DisplayController.isTransientTaskbar(mActivity);
        TaskbarUIController controller = mActivityInterface.getTaskbarController();
        mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed();
        mIsTaskbarAllAppsOpen = controller != null && controller.isTaskbarAllAppsOpen();
        mTaskbarAppWindowThreshold = res
                .getDimensionPixelSize(ENABLE_TASKBAR_REVISED_THRESHOLDS.get()
                        ? R.dimen.taskbar_app_window_threshold_v2
@@ -2264,7 +2266,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
            return displacement;
        }

        if (mTaskbarAlreadyOpen) {
        if (mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen) {
            return displacement;
        }

Loading