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

Commit c00f6054 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: move keyguard views" into tm-dev

parents f6270e22 aabb9692
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -113,6 +113,22 @@ public class KeyguardStatusView extends GridLayout {
        }
    }

    /** Sets a translationY value on every child view except for the media view. */
    public void setChildrenTranslationYExcludingMediaView(float translationY) {
        setChildrenTranslationYExcluding(translationY, Set.of(mMediaHostContainer));
    }

    /** Sets a translationY value on every view except for the views in the provided set. */
    private void setChildrenTranslationYExcluding(float translationY, Set<View> excludedViews) {
        for (int i = 0; i < mStatusViewContainer.getChildCount(); i++) {
            final View child = mStatusViewContainer.getChildAt(i);

            if (!excludedViews.contains(child)) {
                child.setTranslationY(translationY);
            }
        }
    }

    public float getChildrenAlphaExcludingSmartSpace() {
        return mChildrenAlphaExcludingSmartSpace;
    }
+7 −0
Original line number Diff line number Diff line
@@ -136,6 +136,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        return mKeyguardClockSwitchController.hasCustomClock();
    }

    /**
     * Sets a translationY on the views on the keyguard, except on the media view.
     */
    public void setTranslationYExcludingMedia(float translationY) {
        mView.setChildrenTranslationYExcludingMediaView(translationY);
    }

    /**
     * Set keyguard status view alpha.
     */
+12 −0
Original line number Diff line number Diff line
@@ -291,6 +291,18 @@ class MediaHierarchyManager @Inject constructor(
        fullShadeTransitionProgress = progress
    }

    /**
     * Returns the amount of translationY of the media container, during the current guided
     * transformation, if running. If there is no guided transformation running, it will return 0.
     */
    fun getGuidedTransformationTranslationY(): Int {
        if (!isCurrentlyInGuidedTransformation()) {
            return -1
        }
        val startHost = getHost(previousLocation) ?: return 0
        return targetBounds.top - startHost.currentBounds.top
    }

    /**
     * Is the shade currently collapsing from the expanded qs? If we're on the lockscreen and in qs,
     * we wouldn't want to transition in that case.
+17 −5
Original line number Diff line number Diff line
@@ -406,6 +406,7 @@ class LockscreenShadeTransitionController @Inject constructor(

                    mediaHierarchyManager.setTransitionToFullShadeAmount(field)
                    transitionToShadeAmountCommon(field)
                    transitionToShadeAmountKeyguard(field)
                }
            }
        }
@@ -420,11 +421,6 @@ class LockscreenShadeTransitionController @Inject constructor(
        val scrimProgress = MathUtils.saturate(dragDownAmount / scrimTransitionDistance)
        scrimController.setTransitionToFullShadeProgress(scrimProgress)

        // Fade out all content only visible on the lockscreen
        val npvcProgress =
            MathUtils.saturate(dragDownAmount / npvcKeyguardContentAlphaTransitionDistance)
        notificationPanelController.setKeyguardOnlyContentAlpha(1.0f - npvcProgress)

        if (depthControllerTransitionDistance > 0) {
            val depthProgress =
                MathUtils.saturate(dragDownAmount / depthControllerTransitionDistance)
@@ -438,6 +434,22 @@ class LockscreenShadeTransitionController @Inject constructor(
        centralSurfaces.setTransitionToFullShadeProgress(statusBarProgress)
    }

    private fun transitionToShadeAmountKeyguard(dragDownAmount: Float) {
        // Fade out all content only visible on the lockscreen
        val keyguardAlphaProgress =
            MathUtils.saturate(dragDownAmount / npvcKeyguardContentAlphaTransitionDistance)
        val keyguardAlpha = 1f - keyguardAlphaProgress
        val keyguardTranslationY = if (useSplitShade) {
            // On split-shade, the translationY of the keyguard should stay in sync with the
            // translation of media.
            mediaHierarchyManager.getGuidedTransformationTranslationY()
        } else {
            0
        }
        notificationPanelController
            .setKeyguardTransitionProgress(keyguardAlpha, keyguardTranslationY)
    }

    private fun setDragDownAmountAnimated(
        target: Float,
        delay: Long = 0,
+11 −3
Original line number Diff line number Diff line
@@ -616,6 +616,11 @@ public class NotificationPanelViewController extends PanelViewController {
     */
    private float mKeyguardOnlyContentAlpha = 1.0f;

    /**
     * The translationY of the views which only show on the keyguard but in shade / shade locked.
     */
    private int mKeyguardOnlyTransitionTranslationY = 0;

    private float mUdfpsMaxYBurnInOffset;

    /**
@@ -1575,6 +1580,8 @@ public class NotificationPanelViewController extends PanelViewController {
    private void updateClock() {
        float alpha = mClockPositionResult.clockAlpha * mKeyguardOnlyContentAlpha;
        mKeyguardStatusViewController.setAlpha(alpha);
        mKeyguardStatusViewController
                .setTranslationYExcludingMedia(mKeyguardOnlyTransitionTranslationY);
        if (mKeyguardQsUserSwitchController != null) {
            mKeyguardQsUserSwitchController.setAlpha(alpha);
        }
@@ -2732,11 +2739,12 @@ public class NotificationPanelViewController extends PanelViewController {
    }

    /**
     * Set the alpha of the keyguard elements which only show on the lockscreen, but not in
     * shade locked / shade. This is used when dragging down to the full shade.
     * Set the alpha and translationY of the keyguard elements which only show on the lockscreen,
     * but not in shade locked / shade. This is used when dragging down to the full shade.
     */
    public void setKeyguardOnlyContentAlpha(float keyguardAlpha) {
    public void setKeyguardTransitionProgress(float keyguardAlpha, int keyguardTranslationY) {
        mKeyguardOnlyContentAlpha = Interpolators.ALPHA_IN.getInterpolation(keyguardAlpha);
        mKeyguardOnlyTransitionTranslationY = keyguardTranslationY;
        if (mBarState == KEYGUARD) {
            // If the animator is running, it's already fading out the content and this is a reset
            mBottomAreaShadeAlpha = mKeyguardOnlyContentAlpha;
Loading