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

Commit 9ce8bca5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix arrow layout in landscape and hide if scroll is disabled" into main

parents 192e33a3 56e35576
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@
        android:layout_marginEnd="@dimen/qs_media_padding"
        app:layout_constraintEnd_toStartOf="@id/action_button_guideline"
        app:layout_constrainedWidth="true"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintStart_toEndOf="@id/page_left"
        app:layout_constraintBottom_toTopOf="@id/header_artist"
        app:layout_constraintHorizontal_bias="0" />

+2 −2
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ constructor(
    /** Is the player currently visible (at the end of the transformation */
    private var playersVisible: Boolean = false

    /** Are we currently disabling scolling, only allowing the first media session to show */
    /** Are we currently disabling scrolling, only allowing the first media session to show */
    private var currentlyDisableScrolling: Boolean = false

    /**
@@ -957,7 +957,7 @@ constructor(

        val nPlayers = MediaPlayerData.players().size
        MediaPlayerData.players().forEachIndexed { index, mediaPlayer ->
            if (nPlayers == 1) {
            if (nPlayers == 1 || currentlyDisableScrolling) {
                mediaPlayer.setPageArrowsVisible(false)
            } else {
                mediaPlayer.setPageArrowsVisible(true)
+42 −0
Original line number Diff line number Diff line
@@ -1025,6 +1025,48 @@ class MediaCarouselControllerTest : SysuiTestCase() {
        }
    }

    @EnableFlags(Flags.FLAG_MEDIA_CAROUSEL_ARROWS)
    @DisableSceneContainer
    @Test
    fun multipleMediaPlayers_disableScrolling_noPageArrows() {
        verify(mediaDataManager).addListener(capture(listener))

        // Set carousel host to disable scrolling
        whenever(mediaHostStatesManager.mediaHostStates)
            .thenReturn(mutableMapOf(LOCATION_QS to mediaHostState))
        whenever(mediaHostState.disableScrolling).thenReturn(true)
        mediaCarouselController.currentEndLocation = LOCATION_QS
        mediaCarouselController.setCurrentState(LOCATION_QS, LOCATION_QS, 1.0f, true)

        listener.value.onMediaDataLoaded(
            PLAYING_LOCAL,
            null,
            DATA.copy(
                active = true,
                isPlaying = true,
                playbackLocation = MediaData.PLAYBACK_LOCAL,
                resumption = false,
            ),
        )
        listener.value.onMediaDataLoaded(
            PAUSED_LOCAL,
            null,
            DATA.copy(
                active = true,
                isPlaying = false,
                playbackLocation = MediaData.PLAYBACK_LOCAL,
                resumption = false,
            ),
        )
        runAllReady()

        assertEquals(2, MediaPlayerData.players().size)
        MediaPlayerData.players().forEachIndexed { index, mediaPlayer ->
            verify(mediaPlayer, atLeast(1)).setPageArrowsVisible(eq(false))
            verify(mediaPlayer, never()).setPageArrowsVisible(eq(true))
        }
    }

    /**
     * Helper method when a configuration change occurs.
     *