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

Commit 3d2c0625 authored by Alex Chau's avatar Alex Chau
Browse files

Change wallpaper depth in widget picker

- Also changed widget picker open/close duration, refactored the values into DeviceProfile
- Generalized MultiAdditivePropertyFactory to accept aggregator as parameter

Bug: 240580498
Test: manual
Change-Id: I6886ca514593e404b8d7b0e8ed44f20ec2b77c73
parent a7be3549
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -43,4 +43,9 @@
    <!-- Accessibility actions -->
    <item type="id" name="action_move_to_top_or_left" />
    <item type="id" name="action_move_to_bottom_or_right" />

    <!-- The max scale for the wallpaper when it's zoomed in -->
    <item name="config_wallpaperMaxScale" format="float" type="dimen">
        @*android:dimen/config_wallpaperMaxScale
    </item>
</resources>
+6 −5
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAU
import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
import static com.android.launcher3.statehandlers.DepthController.STATE_DEPTH;
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.launcher3.views.FloatingIconView.getFloatingIconView;
@@ -384,7 +384,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                @Override
                public void onAnimationStart(Animator animation) {
                    mLauncher.addOnResumeCallback(() ->
                            ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
                            ObjectAnimator.ofFloat(mLauncher.getDepthController(), STATE_DEPTH,
                                    mLauncher.getStateManager().getState().getDepth(
                                            mLauncher)).start());
                }
@@ -408,7 +408,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
            @Override
            public void onAnimationStart(Animator animation) {
                mLauncher.addOnResumeCallback(() ->
                        ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
                        ObjectAnimator.ofFloat(mLauncher.getDepthController(), STATE_DEPTH,
                                mLauncher.getStateManager().getState().getDepth(
                                        mLauncher)).start());
            }
@@ -1051,7 +1051,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                && BlurUtils.supportsBlursOnWindows();

        MyDepthController depthController = new MyDepthController(mLauncher);
        ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController, DEPTH,
        ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController, STATE_DEPTH,
                        BACKGROUND_APP.getDepth(mLauncher))
                .setDuration(APP_LAUNCH_DURATION);

@@ -1594,7 +1594,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                            true /* animateOverviewScrim */, launcherView).getAnimators());

                    if (!areAllTargetsTranslucent(appTargets)) {
                        anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController(), DEPTH,
                        anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController(),
                                STATE_DEPTH,
                                BACKGROUND_APP.getDepth(mLauncher), NORMAL.getDepth(mLauncher)));
                    }

+3 −2
Original line number Diff line number Diff line
@@ -165,7 +165,8 @@ public class DepthController extends BaseDepthController implements StateHandler

        float toDepth = toState.getDepth(mLauncher);
        if (Float.compare(mDepth, toDepth) != 0) {
            animation.setFloat(this, DEPTH, toDepth, config.getInterpolator(ANIM_DEPTH, LINEAR));
            animation.setFloat(this, STATE_DEPTH, toDepth,
                    config.getInterpolator(ANIM_DEPTH, LINEAR));
        }
    }

@@ -179,7 +180,7 @@ public class DepthController extends BaseDepthController implements StateHandler
    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
        mIgnoreStateChangesDuringMultiWindowAnimation = true;

        ObjectAnimator mwAnimation = ObjectAnimator.ofFloat(this, DEPTH,
        ObjectAnimator mwAnimation = ObjectAnimator.ofFloat(this, STATE_DEPTH,
                mLauncher.getStateManager().getState().getDepth(mLauncher, isInMultiWindowMode))
                .setDuration(300);
        mwAnimation.addListener(new AnimatorListenerAdapter() {
+9 −0
Original line number Diff line number Diff line
@@ -27,9 +27,11 @@ import static com.android.launcher3.LauncherState.NO_OFFSET;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
import static com.android.launcher3.anim.Interpolators.EMPHASIZED;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_WIDGET_PICKER_DEPTH;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
@@ -44,6 +46,7 @@ import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.util.BaseDepthController.WIDGET_DEPTH;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;

import android.animation.AnimatorSet;
@@ -75,6 +78,7 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.QuickstepAccessibilityDelegate;
import com.android.launcher3.QuickstepTransitionManager;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.anim.AnimatorPlaybackController;
@@ -591,6 +595,11 @@ public class QuickstepLauncher extends Launcher {
    public void onWidgetsTransition(float progress) {
        super.onWidgetsTransition(progress);
        onTaskbarInAppDisplayProgressUpdate(progress, WIDGETS_PAGE_PROGRESS_INDEX);
        if (ENABLE_WIDGET_PICKER_DEPTH.get() && !Utilities.IS_RUNNING_IN_TEST_HARNESS) {
            WIDGET_DEPTH.set(getDepthController(),
                    Utilities.mapToRange(progress, 0f, 1f, 0f, getDeviceProfile().bottomSheetDepth,
                            EMPHASIZED));
        }
    }

    private void onTaskbarInAppDisplayProgressUpdate(float progress, int flag) {
+4 −14
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.launcher3.uioverrides.states;

import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;

import android.content.Context;
@@ -26,7 +25,6 @@ import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.Themes;

/**
@@ -44,9 +42,9 @@ public class AllAppsState extends LauncherState {
    @Override
    public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
    int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
        return context.getDeviceProfile().isTablet
                ? 500
                :  isToState ? 600 : 300;
        return isToState
                ? context.getDeviceProfile().allAppsOpenDuration
                : context.getDeviceProfile().allAppsCloseDuration;
    }

    @Override
@@ -83,15 +81,7 @@ public class AllAppsState extends LauncherState {
    protected <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfile.DeviceProfileListenable>
            float getDepthUnchecked(DEVICE_PROFILE_CONTEXT context) {
        if (context.getDeviceProfile().isTablet) {
            // The goal is to set wallpaper to zoom at workspaceContentScale when in AllApps.
            // When depth is 0, wallpaper zoom is set to maxWallpaperScale.
            // When depth is 1, wallpaper zoom is set to 1.
            // For depth to achieve zoom set to maxWallpaperScale * workspaceContentScale:
            float maxWallpaperScale = context.getResources().getFloat(
                    com.android.internal.R.dimen.config_wallpaperMaxScale);
            return Utilities.mapToRange(
                    maxWallpaperScale * context.getDeviceProfile().workspaceContentScale,
                    maxWallpaperScale, 1f, 0f, 1f, LINEAR);
            return context.getDeviceProfile().bottomSheetDepth;
        } else {
            // The scrim fades in at approximately 50% of the swipe gesture.
            // This means that the depth should be greater than 1, in order to fully zoom out.
Loading