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

Commit 071862ed authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Show overview as grid in fallback recents" into sc-dev

parents f6194980 ecd12b32
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -76,8 +76,8 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
        SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher));
        SCRIM_MULTIPLIER.set(scrim, 1f);
        getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness());
        RECENTS_GRID_PROGRESS.set(mRecentsView, state.displayOverviewTasksAsGrid(mLauncher)
                ? 1f : 0f);
        RECENTS_GRID_PROGRESS.set(mRecentsView,
                state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f);
    }

    @Override
@@ -128,7 +128,7 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
                toState.getOverviewModalness(),
                config.getInterpolator(ANIM_OVERVIEW_MODAL, LINEAR));
        setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS,
                toState.displayOverviewTasksAsGrid(mLauncher) ? 1f : 0f, LINEAR);
                toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f, LINEAR);
    }

    abstract FloatProperty getTaskModalnessProperty();
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKG
import android.content.Context;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.quickstep.util.LayoutUtils;
@@ -76,7 +77,7 @@ public class BackgroundAppState extends OverviewState {
    }

    @Override
    public boolean displayOverviewTasksAsGrid(Launcher launcher) {
    public boolean displayOverviewTasksAsGrid(DeviceProfile deviceProfile) {
        return false;
    }

+3 −3
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public class OverviewState extends LauncherState {

    @Override
    public int getVisibleElements(Launcher launcher) {
        return displayOverviewTasksAsGrid(launcher) ? CLEAR_ALL_BUTTON
        return displayOverviewTasksAsGrid(launcher.getDeviceProfile()) ? CLEAR_ALL_BUTTON
                : CLEAR_ALL_BUTTON | OVERVIEW_ACTIONS;
    }

@@ -133,8 +133,8 @@ public class OverviewState extends LauncherState {
    }

    @Override
    public boolean displayOverviewTasksAsGrid(Launcher launcher) {
        return launcher.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get();
    public boolean displayOverviewTasksAsGrid(DeviceProfile deviceProfile) {
        return deviceProfile.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get();
    }

    @Override
+17 −9
Original line number Diff line number Diff line
@@ -80,9 +80,9 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
import com.android.launcher3.statemanager.BaseState;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.tracing.InputConsumerProto;
import com.android.launcher3.tracing.SwipeHandlerProto;
@@ -124,14 +124,15 @@ import java.util.function.Consumer;
 * Handles the navigation gestures when Launcher is the default home activity.
 */
@TargetApi(Build.VERSION_CODES.R)
public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends RecentsView>
public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
        Q extends RecentsView, S extends BaseState<S>>
        extends SwipeUpAnimationLogic implements OnApplyWindowInsetsListener,
        RecentsAnimationCallbacks.RecentsAnimationListener {
    private static final String TAG = "AbsSwipeUpHandler";

    private static final String[] STATE_NAMES = DEBUG_STATES ? new String[17] : null;

    protected final BaseActivityInterface<?, T> mActivityInterface;
    protected final BaseActivityInterface<S, T> mActivityInterface;
    protected final InputConsumerProxy mInputConsumerProxy;
    protected final ActivityInitListener mActivityInitListener;
    // Callbacks to be made once the recents animation starts
@@ -934,9 +935,15 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
                    duration = Math.min(MAX_SWIPE_DURATION, 2 * baseDuration);
            }
        }
        Interpolator interpolator =
                endTarget == RECENTS ? (mDp.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()
                        ? ACCEL_DEACCEL : OVERSHOOT_1_2) : DEACCEL;
        Interpolator interpolator;
        S state = mActivityInterface.stateFromGestureEndTarget(endTarget);
        if (state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile())) {
            interpolator = ACCEL_DEACCEL;
        } else if (endTarget == RECENTS) {
            interpolator = OVERSHOOT_1_2;
        } else {
            interpolator = DEACCEL;
        }

        if (endTarget.isLauncher) {
            mInputConsumerProxy.enable();
@@ -1126,8 +1133,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
                }
            });
            animatorSet.play(windowAnim);
            if (mRecentsView != null && mDp.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()
                    && mGestureState.getEndTarget() == RECENTS) {
            S state = mActivityInterface.stateFromGestureEndTarget(mGestureState.getEndTarget());
            if (mRecentsView != null && state.displayOverviewTasksAsGrid(
                    mActivity.getDeviceProfile())) {
                animatorSet.play(ObjectAnimator.ofFloat(mRecentsView, RECENTS_GRID_PROGRESS, 1));
                animatorSet.play(mTaskViewSimulator.gridProgress.animateToValue(0, 1));
            }
@@ -1756,7 +1764,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends

    public interface Factory {

        AbsSwipeUpHandler<StatefulActivity<?>, RecentsView> newHandler(
        AbsSwipeUpHandler newHandler(
                GestureState gestureState, long touchTimeMs, boolean continuingLastGesture);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -306,6 +306,11 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
    public void onSystemUiFlagsChanged(int systemUiStateFlags) {
    }

    /**
     * Returns the expected STATE_TYPE from the provided GestureEndTarget.
     */
    public abstract STATE_TYPE stateFromGestureEndTarget(GestureState.GestureEndTarget endTarget);

    public interface AnimationFactory {

        void createActivityInterface(long transitionLength);
Loading