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

Commit ee804cb3 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "Calculate the correct HUN position, while dragging down the shade" into main

parents e4b14783 03e76731
Loading
Loading
Loading
Loading
+5 −10
Original line number Original line Diff line number Diff line
@@ -826,16 +826,11 @@ public class StackScrollAlgorithm {
                }
                }
            }
            }
            if (row.isPinned()) {
            if (row.isPinned()) {
                if (NotificationsImprovedHunAnimation.isEnabled()) {
                // Make sure row yTranslation is at at least the HUN yTranslation,
                    // Make sure row yTranslation is at the HUN yTranslation,
                    // which accounts for AmbientState.stackTopMargin in split-shade.
                    childState.setYTranslation(headsUpTranslation);
                } else {
                    // Make sure row yTranslation is at maximum the HUN yTranslation,
                // which accounts for AmbientState.stackTopMargin in split-shade.
                // which accounts for AmbientState.stackTopMargin in split-shade.
                // Once we start opening the shade, we keep the previously calculated translation.
                childState.setYTranslation(
                childState.setYTranslation(
                        Math.max(childState.getYTranslation(), headsUpTranslation));
                        Math.max(childState.getYTranslation(), headsUpTranslation));
                }
                childState.height = Math.max(row.getIntrinsicHeight(), childState.height);
                childState.height = Math.max(row.getIntrinsicHeight(), childState.height);
                childState.hidden = false;
                childState.hidden = false;
                ExpandableViewState topState =
                ExpandableViewState topState =
+13 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() {


    private val bigGap = px(R.dimen.notification_section_divider_height)
    private val bigGap = px(R.dimen.notification_section_divider_height)
    private val smallGap = px(R.dimen.notification_section_divider_height_lockscreen)
    private val smallGap = px(R.dimen.notification_section_divider_height_lockscreen)
    private val scrimPadding = px(R.dimen.notification_side_paddings)


    @Before
    @Before
    fun setUp() {
    fun setUp() {
@@ -118,6 +119,18 @@ class StackScrollAlgorithmTest : SysuiTestCase() {
        resetViewStates_stackMargin_changesHunYTranslation()
        resetViewStates_stackMargin_changesHunYTranslation()
    }
    }


    @Test
    fun resetViewStates_defaultHunWhenShadeIsOpening_yTranslationIsInset() {
        whenever(notificationRow.isPinned).thenReturn(true)
        whenever(notificationRow.isHeadsUp).thenReturn(true)

        // scroll the panel over the HUN inset
        ambientState.stackY = stackScrollAlgorithm.mHeadsUpInset + bigGap

        // the HUN translation should be the panel scroll position + the scrim padding
        resetViewStates_hunYTranslationIs(ambientState.stackY + scrimPadding)
    }

    @Test
    @Test
    @DisableFlags(NotificationsImprovedHunAnimation.FLAG_NAME)
    @DisableFlags(NotificationsImprovedHunAnimation.FLAG_NAME)
    fun resetViewStates_hunAnimatingAway_yTranslationIsInset() {
    fun resetViewStates_hunAnimatingAway_yTranslationIsInset() {