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

Commit c93d27ce authored by Michael Mikhail's avatar Michael Mikhail Committed by Android (Google) Code Review
Browse files

Merge "Show QS footer background when QS starts to show." into main

parents 5eba0763 fd2e2c28
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -88,9 +88,9 @@ class FooterActionsViewModel(
    /** Called when the expansion of the Quick Settings changed. */
    fun onQuickSettingsExpansionChanged(expansion: Float, isInSplitShade: Boolean) {
        if (isInSplitShade) {
            // In split shade, we want to fade in the background only at the very end (see
            // b/240563302).
            val delay = 0.99f
            // In split shade, we want to fade in the background when the QS background starts to
            // show.
            val delay = 0.15f
            _alpha.value = expansion
            _backgroundAlpha.value = max(0f, expansion - delay) / (1f - delay)
        } else {
+5 −5
Original line number Diff line number Diff line
@@ -393,23 +393,23 @@ class FooterActionsViewModelTest : SysuiTestCase() {
    }

    @Test
    fun backgroundAlpha_inSplitShade_followsExpansion_with_0_99_delay() {
    fun backgroundAlpha_inSplitShade_followsExpansion_with_0_15_delay() {
        val underTest = utils.footerActionsViewModel()
        val floatTolerance = 0.01f

        underTest.onQuickSettingsExpansionChanged(0f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isEqualTo(0f)

        underTest.onQuickSettingsExpansionChanged(0.5f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.1f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isEqualTo(0f)

        underTest.onQuickSettingsExpansionChanged(0.9f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.14f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isEqualTo(0f)

        underTest.onQuickSettingsExpansionChanged(0.991f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.235f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.1f)

        underTest.onQuickSettingsExpansionChanged(0.995f, isInSplitShade = true)
        underTest.onQuickSettingsExpansionChanged(0.575f, isInSplitShade = true)
        assertThat(underTest.backgroundAlpha.value).isWithin(floatTolerance).of(0.5f)

        underTest.onQuickSettingsExpansionChanged(1f, isInSplitShade = true)