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

Commit 7f28fd55 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Increasing the overview size while in QuickScrub mode

Bug: 80139193
Change-Id: I19ea05d3cc083628364651e9d9f581fe1aaaeaaa
parent d5377ca4
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.launcher3.uioverrides;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.quickstep.QuickScrubController;
import com.android.quickstep.views.RecentsView;
@@ -45,6 +46,15 @@ public class FastOverviewState extends OverviewState {

    @Override
    public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) {
        return new float[] {1f, 0.5f};
        return new float[] {getOverviewScale(launcher.getDeviceProfile()), 0.5f};
    }

    public static float getOverviewScale(DeviceProfile dp) {
        if (dp.isMultiWindowMode || dp.isVerticalBarLayout()) {
            return 1f;
        }

        // TODO: Calculate it dynamically based on available space
        return 1.3f;
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.launcher3.uioverrides;

import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.FAST_OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
@@ -24,7 +25,6 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_START_INTERPOLATOR;
import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_TRANSLATION_Y_FACTOR;
import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_Y_FACTOR;
import static com.android.quickstep.views.RecentsView.ADJACENT_SCALE;
import static com.android.quickstep.views.RecentsViewContainer.CONTENT_ALPHA;

import android.animation.ValueAnimator;
@@ -59,7 +59,7 @@ public class RecentsViewStateController implements StateHandler {
    public void setState(LauncherState state) {
        mRecentsViewContainer.setContentAlpha(state.overviewUi ? 1 : 0);
        float[] scaleTranslationYFactor = state.getOverviewScaleAndTranslationYFactor(mLauncher);
        mRecentsView.setAdjacentScale(scaleTranslationYFactor[0]);
        SCALE_PROPERTY.set(mRecentsView, scaleTranslationYFactor[0]);
        mRecentsView.setTranslationYFactor(scaleTranslationYFactor[1]);
        if (state.overviewUi) {
            mRecentsView.updateEmptyMessage();
@@ -77,7 +77,7 @@ public class RecentsViewStateController implements StateHandler {
        PropertySetter setter = config.getPropertySetter(builder);
        float[] scaleTranslationYFactor = toState.getOverviewScaleAndTranslationYFactor(mLauncher);
        Interpolator scaleInterpolator = builder.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR);
        setter.setFloat(mRecentsView, ADJACENT_SCALE, scaleTranslationYFactor[0], scaleInterpolator);
        setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleTranslationYFactor[0], scaleInterpolator);
        Interpolator transYInterpolator = scaleInterpolator;
        if (mLauncher.getStateManager().getState() == OVERVIEW && toState == FAST_OVERVIEW) {
            transYInterpolator = Interpolators.clampToProgress(QUICK_SCRUB_START_INTERPOLATOR, 0,
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides;
import static android.view.View.VISIBLE;
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
@@ -207,7 +208,7 @@ public class UiFactory {
    public static void prepareToShowOverview(Launcher launcher) {
        RecentsView overview = launcher.getOverviewPanel();
        if (overview.getVisibility() != VISIBLE || overview.getContentAlpha() == 0) {
            overview.setAdjacentScale(1.33f);
            SCALE_PROPERTY.set(overview, 1.33f);
        }
    }

+31 −15
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import static com.android.launcher3.LauncherState.FAST_OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.TouchConsumer.INTERACTION_NORMAL;
import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB;
import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_BACK;
import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_ROTATION;

@@ -48,9 +50,12 @@ import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.uioverrides.FastOverviewState;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.TouchConsumer.InteractionType;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.TransformedRect;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.views.LauncherLayoutListener;
@@ -83,7 +88,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

    void onTransitionCancelled(T activity, boolean activityVisible);

    int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect);
    int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context,
            @InteractionType int interactionType, TransformedRect outRect);

    void onSwipeUpComplete(T activity);

@@ -157,14 +163,18 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
        }

        @Override
        public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) {
            LayoutUtils.calculateLauncherTaskSize(context, dp, outRect);
        public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context,
                @InteractionType int interactionType, TransformedRect outRect) {
            LayoutUtils.calculateLauncherTaskSize(context, dp, outRect.rect);
            if (interactionType == INTERACTION_QUICK_SCRUB) {
                outRect.scale = FastOverviewState.getOverviewScale(dp);
            }
            if (dp.isVerticalBarLayout()) {
                Rect targetInsets = dp.getInsets();
                int hotseatInset = dp.isSeascape() ? targetInsets.left : targetInsets.right;
                return dp.hotseatBarSizePx + dp.hotseatBarSidePaddingPx + hotseatInset;
            } else {
                return dp.heightPx - outRect.bottom;
                return dp.heightPx - outRect.rect.bottom;
            }
        }

@@ -204,9 +214,10 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

            return new AnimationFactory() {
                @Override
                public void createActivityController(long transitionLength) {
                public void createActivityController(long transitionLength,
                        @InteractionType int interactionType) {
                    createActivityControllerInternal(activity, activityVisible, startState,
                            transitionLength, callback);
                            transitionLength, interactionType, callback);
                }

                @Override
@@ -218,13 +229,16 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

        private void createActivityControllerInternal(Launcher activity, boolean wasVisible,
                LauncherState startState, long transitionLength,
                @InteractionType int interactionType,
                Consumer<AnimatorPlaybackController> callback) {
            LauncherState endState = interactionType == INTERACTION_QUICK_SCRUB
                    ? FAST_OVERVIEW : OVERVIEW;
            if (wasVisible) {
                DeviceProfile dp = activity.getDeviceProfile();
                long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
                activity.getStateManager().goToState(startState, false);
                callback.accept(activity.getStateManager()
                        .createAnimationToNewWorkspace(OVERVIEW, accuracy));
                        .createAnimationToNewWorkspace(endState, accuracy));
                return;
            }

@@ -238,7 +252,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
            float scrollRange = Math.max(controller.getShiftRange(), 1);
            float progressDelta = (transitionLength / scrollRange);

            float endProgress = OVERVIEW.getVerticalProgress(activity);
            float endProgress = endState.getVerticalProgress(activity);
            float startProgress = endProgress + progressDelta;
            ObjectAnimator shiftAnim = ObjectAnimator.ofFloat(
                    controller, ALL_APPS_PROGRESS, startProgress, endProgress);
@@ -381,14 +395,15 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
        }

        @Override
        public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) {
            LayoutUtils.calculateFallbackTaskSize(context, dp, outRect);
        public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context,
                @InteractionType int interactionType, TransformedRect outRect) {
            LayoutUtils.calculateFallbackTaskSize(context, dp, outRect.rect);
            if (dp.isVerticalBarLayout()) {
                Rect targetInsets = dp.getInsets();
                int hotseatInset = dp.isSeascape() ? targetInsets.left : targetInsets.right;
                return dp.hotseatBarSizePx + dp.hotseatBarSidePaddingPx + hotseatInset;
            } else {
                return dp.heightPx - outRect.bottom;
                return dp.heightPx - outRect.rect.bottom;
            }
        }

@@ -401,7 +416,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
        public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible,
                Consumer<AnimatorPlaybackController> callback) {
            if (activityVisible) {
                return (transitionLength) -> { };
                return (transitionLength, interactionType) -> { };
            }

            RecentsViewContainer rv = activity.getOverviewPanelContainer();
@@ -418,11 +433,12 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
                        rv.setContentAlpha(1);
                    }
                    createActivityController(getSwipeUpDestinationAndLength(
                            activity.getDeviceProfile(), activity, new Rect()));
                            activity.getDeviceProfile(), activity, INTERACTION_NORMAL,
                            new TransformedRect()), INTERACTION_NORMAL);
                }

                @Override
                public void createActivityController(long transitionLength) {
                public void createActivityController(long transitionLength, int interactionType) {
                    if (!isAnimatingHome) {
                        return;
                    }
@@ -543,7 +559,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {

        default void onRemoteAnimationReceived(RemoteAnimationTargetSet targets) { }

        void createActivityController(long transitionLength);
        void createActivityController(long transitionLength, @InteractionType int interactionType);

        default void onTransitionCancelled() { }
    }
+1 −1
Original line number Diff line number Diff line
@@ -326,10 +326,10 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
            mPassedInitialSlop = true;
        }

        notifyGestureStarted();
        if (mInteractionHandler != null) {
            mInteractionHandler.updateInteractionType(interactionType);
        }
        notifyGestureStarted();
    }

    @Override
Loading