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

Commit caa556be authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Sort Volume Panel buttons" into main

parents 8d028ae8 af610d4e
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() {
        DefaultComponentsLayoutManager(
            BOTTOM_BAR,
            headerComponents = listOf(COMPONENT_1),
            footerComponents = listOf(COMPONENT_2),
            footerComponents = listOf(COMPONENT_5, COMPONENT_2),
        )

    @Test
@@ -48,10 +48,18 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() {
        val component2 = ComponentState(COMPONENT_2, kosmos.mockVolumePanelUiComponent, false)
        val component3 = ComponentState(COMPONENT_3, kosmos.mockVolumePanelUiComponent, false)
        val component4 = ComponentState(COMPONENT_4, kosmos.mockVolumePanelUiComponent, false)
        val component5 = ComponentState(COMPONENT_5, kosmos.mockVolumePanelUiComponent, false)
        val layout =
            underTest.layout(
                VolumePanelState(0, false, false),
                setOf(bottomBarComponentState, component1, component2, component3, component4)
                setOf(
                    bottomBarComponentState,
                    component1,
                    component2,
                    component3,
                    component4,
                    component5,
                )
            )

        Truth.assertThat(layout.bottomBarComponent).isEqualTo(bottomBarComponentState)
@@ -59,7 +67,7 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() {
            .containsExactlyElementsIn(listOf(component1))
            .inOrder()
        Truth.assertThat(layout.footerComponents)
            .containsExactlyElementsIn(listOf(component2))
            .containsExactlyElementsIn(listOf(component5, component2))
            .inOrder()
        Truth.assertThat(layout.contentComponents)
            .containsExactlyElementsIn(listOf(component3, component4))
@@ -85,5 +93,6 @@ class DefaultComponentsLayoutManagerTest : SysuiTestCase() {
        const val COMPONENT_2: VolumePanelComponentKey = "test_component:2"
        const val COMPONENT_3: VolumePanelComponentKey = "test_component:3"
        const val COMPONENT_4: VolumePanelComponentKey = "test_component:4"
        const val COMPONENT_5: VolumePanelComponentKey = "test_component:5"
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -46,12 +46,18 @@ constructor(
                    !footerComponents.contains(it.key) &&
                    it.key != bottomBar
            }
        val headerComponents = components.filter { headerComponents.contains(it.key) }
        val footerComponents = components.filter { footerComponents.contains(it.key) }
        val headerComponents =
            components
                .filter { it.key in headerComponents }
                .sortedBy { headerComponents.indexOf(it.key) }
        val footerComponents =
            components
                .filter { it.key in footerComponents }
                .sortedBy { footerComponents.indexOf(it.key) }
        return ComponentsLayout(
            headerComponents = headerComponents.sortedBy { it.key },
            headerComponents = headerComponents,
            contentComponents = contentComponents.sortedBy { it.key },
            footerComponents = footerComponents.sortedBy { it.key },
            footerComponents = footerComponents,
            bottomBarComponent = components.find { it.key == bottomBar }
                    ?: error(
                        "VolumePanelComponents.BOTTOM_BAR must be present in the default " +