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

Commit 1f3cc12a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Recreate All Apps when Taskbar is recreated." into tm-dev

parents 7db48439 464209c5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public class TaskbarControllers {
        taskbarEduController.init(this);
        taskbarPopupController.init(this);
        taskbarForceVisibleImmersiveController.init(this);
        taskbarAllAppsController.init(this);
        taskbarAllAppsController.init(this, sharedState);

        mControllersToLog = new LoggableTaskbarController[] {
                taskbarDragController, navButtonController, navbarButtonsViewController,
@@ -152,6 +152,7 @@ public class TaskbarControllers {
        taskbarAutohideSuspendController.onDestroy();
        taskbarPopupController.onDestroy();
        taskbarForceVisibleImmersiveController.onDestroy();
        taskbarAllAppsController.onDestroy();

        mControllersToLog = null;
    }
+2 −0
Original line number Diff line number Diff line
@@ -24,4 +24,6 @@ public class TaskbarSharedState {

    public boolean setupUIVisible = false;

    public boolean allAppsVisible = false;

}
+0 −1
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ class TaskbarAllAppsContext extends BaseTaskbarContext {
            super.onAttachedToWindow();
            ViewTreeObserverWrapper.addOnComputeInsetsListener(
                    getViewTreeObserver(), this);
            mActivity.mAllAppsViewController.show();
        }

        @Override
+27 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.taskbar.TaskbarControllers;
import com.android.launcher3.taskbar.TaskbarSharedState;

import java.util.List;
import java.util.Optional;
@@ -62,6 +63,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
    private final LayoutParams mLayoutParams;

    private TaskbarControllers mControllers;
    private TaskbarSharedState mSharedState;
    /** Window context for all apps if it is open. */
    private @Nullable TaskbarAllAppsContext mAllAppsContext;

@@ -77,9 +79,19 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
    }

    /** Initialize the controller. */
    public void init(TaskbarControllers controllers) {
        if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
    public void init(TaskbarControllers controllers, TaskbarSharedState sharedState) {
        if (!FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()) {
            return;
        }
        mControllers = controllers;
        mSharedState = sharedState;

        /*
         * Recreate All Apps if it was open in the previous Taskbar instance (e.g. the configuration
         * changed).
         */
        if (mSharedState.allAppsVisible) {
            show(false);
        }
    }

@@ -112,10 +124,15 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList

    /** Opens the {@link TaskbarAllAppsContainerView} in a new window. */
    public void show() {
        show(true);
    }

    private void show(boolean animate) {
        if (mProxyView.isOpen()) {
            return;
        }
        mProxyView.show();
        mSharedState.allAppsVisible = true;

        mAllAppsContext = new TaskbarAllAppsContext(mTaskbarContext,
                this,
@@ -129,6 +146,7 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
        mAllAppsContext.getAppsView().getFloatingHeaderView()
                .findFixedRowByType(PredictionRowView.class)
                .setPredictedApps(mPredictedApps);
        mAllAppsContext.getAllAppsViewController().show(animate);
    }

    /** Closes the {@link TaskbarAllAppsContainerView}. */
@@ -148,6 +166,12 @@ public final class TaskbarAllAppsController implements OnDeviceProfileChangeList
            return;
        }
        mProxyView.close(false);
        mSharedState.allAppsVisible = false;
        onDestroy();
    }

    /** Destroys the controller and any All Apps window if present. */
    public void onDestroy() {
        mTaskbarContext.removeOnDeviceProfileChangeListener(this);
        Optional.ofNullable(mAllAppsContext)
                .map(c -> c.getSystemService(WindowManager.class))
+9 −5
Original line number Diff line number Diff line
@@ -50,17 +50,21 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllApp
    }

    /** Opens the all apps view. */
    void show() {
    void show(boolean animate) {
        if (mIsOpen || mOpenCloseAnimator.isRunning()) {
            return;
        }
        mIsOpen = true;
        attachToContainer();

        if (animate) {
            mOpenCloseAnimator.setValues(
                    PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
            mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
            mOpenCloseAnimator.setDuration(DEFAULT_OPEN_DURATION).start();
        } else {
            mTranslationShift = TRANSLATION_SHIFT_OPENED;
        }
    }

    /** The apps container inside this view. */
Loading