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

Commit 1c5645f3 authored by Christian Göllner's avatar Christian Göllner Committed by Android (Google) Code Review
Browse files

Merge "[Motion] Split-shade expansion on LS: adjust timing for notifications scrim" into tm-dev

parents 0ad4e724 ef77925a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -54,6 +54,14 @@
         the shade (in alpha) -->
    <dimen name="lockscreen_shade_scrim_transition_distance">80dp</dimen>

    <!-- The notifications scrim transition should start when the other scrims' transition is at
         95%. -->
    <dimen name="lockscreen_shade_notifications_scrim_transition_delay">76dp</dimen>

    <!-- The notifications scrim transition duration is 66.6% of the duration of the other scrims'
         transition. -->
    <dimen name="lockscreen_shade_notifications_scrim_transition_distance">53.28dp</dimen>

    <!-- Distance that the full shade transition takes in order for the keyguard content on
         NotificationPanelViewController to fully fade (e.g. Clock & Smartspace) -->
    <dimen name="lockscreen_shade_npvc_keyguard_content_alpha_transition_distance">80dp</dimen>
+6 −0
Original line number Diff line number Diff line
@@ -1141,6 +1141,12 @@
         the shade (in alpha) -->
    <dimen name="lockscreen_shade_scrim_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>

    <!-- Distance that it takes in order for the notifications scrim fade in to start. -->
    <dimen name="lockscreen_shade_notifications_scrim_transition_delay">0dp</dimen>

    <!-- Distance that it takes for the notifications scrim to fully fade if after it started. -->
    <dimen name="lockscreen_shade_notifications_scrim_transition_distance">@dimen/lockscreen_shade_scrim_transition_distance</dimen>

    <!-- Distance that the full shade transition takes in order for the keyguard content on
         NotificationPanelViewController to fully fade (e.g. Clock & Smartspace) -->
    <dimen name="lockscreen_shade_npvc_keyguard_content_alpha_transition_distance">@dimen/lockscreen_shade_full_transition_distance</dimen>
+22 −2
Original line number Diff line number Diff line
@@ -115,6 +115,16 @@ class LockscreenShadeTransitionController @Inject constructor(
     */
    private var scrimTransitionDistance = 0

    /**
     * Distance that it takes in order for the notifications scrim fade in to start.
     */
    private var notificationsScrimTransitionDelay = 0

    /**
     * Distance that it takes for the notifications scrim to fully fade if after it started.
     */
    private var notificationsScrimTransitionDistance = 0

    /**
     * Distance that the full shade transition takes in order for the notification shelf to fully
     * expand.
@@ -225,6 +235,10 @@ class LockscreenShadeTransitionController @Inject constructor(
            R.dimen.lockscreen_shade_transition_by_tap_distance)
        scrimTransitionDistance = context.resources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_scrim_transition_distance)
        notificationsScrimTransitionDelay = context.resources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_notifications_scrim_transition_delay)
        notificationsScrimTransitionDistance = context.resources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_notifications_scrim_transition_distance)
        notificationShelfTransitionDistance = context.resources.getDimensionPixelSize(
                R.dimen.lockscreen_shade_notif_shelf_transition_distance)
        qsTransitionDistance = context.resources.getDimensionPixelSize(
@@ -405,6 +419,7 @@ class LockscreenShadeTransitionController @Inject constructor(
                            false /* animate */, 0 /* delay */)

                    mediaHierarchyManager.setTransitionToFullShadeAmount(field)
                    transitionToShadeAmountScrim(field)
                    transitionToShadeAmountCommon(field)
                    transitionToShadeAmountKeyguard(field)
                }
@@ -417,10 +432,15 @@ class LockscreenShadeTransitionController @Inject constructor(
    var qSDragProgress = 0f
        private set

    private fun transitionToShadeAmountCommon(dragDownAmount: Float) {
    private fun transitionToShadeAmountScrim(dragDownAmount: Float) {
        val scrimProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
        scrimController.setTransitionToFullShadeProgress(scrimProgress)
        val notificationsScrimDragAmount = dragDownAmount - notificationsScrimTransitionDelay
        val notificationsScrimProgress = MathUtils.saturate(
                notificationsScrimDragAmount / notificationsScrimTransitionDistance)
        scrimController.setTransitionToFullShadeProgress(scrimProgress, notificationsScrimProgress)
    }

    private fun transitionToShadeAmountCommon(dragDownAmount: Float) {
        if (depthControllerTransitionDistance > 0) {
            val depthProgress =
                MathUtils.saturate(dragDownAmount / depthControllerTransitionDistance)
+21 −5
Original line number Diff line number Diff line
@@ -115,6 +115,15 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
     */
    private float mTransitionToFullShadeProgress;

    /**
     * Same as {@link #mTransitionToFullShadeProgress}, but specifically for the notifications scrim
     * on the lock screen.
     *
     * On split shade lock screen we want the different scrims to fade in at different times and
     * rates.
     */
    private float mTransitionToLockScreenFullShadeNotificationsProgress;

    /**
     * If we're currently transitioning to the full shade.
     */
@@ -574,11 +583,17 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
     * Set the amount of progress we are currently in if we're transitioning to the full shade.
     * 0.0f means we're not transitioning yet, while 1 means we're all the way in the full
     * shade.
     *
     * @param progress the progress for all scrims.
     * @param lockScreenNotificationsProgress the progress specifically for the notifications scrim.
     */
    public void setTransitionToFullShadeProgress(float progress) {
        if (progress != mTransitionToFullShadeProgress) {
    public void setTransitionToFullShadeProgress(float progress,
            float lockScreenNotificationsProgress) {
        if (progress != mTransitionToFullShadeProgress || lockScreenNotificationsProgress
                != mTransitionToLockScreenFullShadeNotificationsProgress) {
            mTransitionToFullShadeProgress = progress;
            setTransitionToFullShade(progress > 0.0f);
            mTransitionToLockScreenFullShadeNotificationsProgress = lockScreenNotificationsProgress;
            setTransitionToFullShade(progress > 0.0f || lockScreenNotificationsProgress > 0.0f);
            applyAndDispatchState();
        }
    }
@@ -754,12 +769,13 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
                } else {
                    mNotificationsAlpha = Math.max(1.0f - getInterpolatedFraction(), mQsExpansion);
                }
                if (mState == ScrimState.KEYGUARD && mTransitionToFullShadeProgress > 0.0f) {
                if (mState == ScrimState.KEYGUARD
                        && mTransitionToLockScreenFullShadeNotificationsProgress > 0.0f) {
                    // Interpolate the notification alpha when transitioning!
                    mNotificationsAlpha = MathUtils.lerp(
                            mNotificationsAlpha,
                            getInterpolatedFraction(),
                            mTransitionToFullShadeProgress);
                            mTransitionToLockScreenFullShadeNotificationsProgress);
                }
                mNotificationsTint = mState.getNotifTint();
                mBehindTint = behindTint;
+5 −0
Original line number Diff line number Diff line
@@ -208,6 +208,11 @@ public abstract class SysuiTestCase {
        }
    }

    /** Delegates to {@link android.testing.TestableResources#addOverride(int, Object)}. */
    protected void overrideResource(int resourceId, Object value) {
        mContext.getOrCreateTestableResources().addOverride(resourceId, value);
    }

    public static final class EmptyRunnable implements Runnable {
        public void run() {
        }
Loading