Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -261,7 +261,7 @@ private fun RowScope.ForegroundServicesButton( /** A button with an icon. */ /** A button with an icon. */ @Composable @Composable private fun IconButton(model: FooterActionsButtonViewModel, modifier: Modifier = Modifier) { fun IconButton(model: FooterActionsButtonViewModel, modifier: Modifier = Modifier) { Expandable( Expandable( color = colorAttr(model.backgroundColor), color = colorAttr(model.backgroundColor), shape = CircleShape, shape = CircleShape, Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +19 −13 Original line number Original line Diff line number Diff line Loading @@ -26,8 +26,10 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment Loading @@ -50,6 +52,8 @@ import com.android.systemui.qs.flags.QsDetailedView import com.android.systemui.qs.panels.ui.compose.EditMode import com.android.systemui.qs.panels.ui.compose.EditMode import com.android.systemui.qs.panels.ui.compose.TileDetails import com.android.systemui.qs.panels.ui.compose.TileDetails import com.android.systemui.qs.panels.ui.compose.TileGrid import com.android.systemui.qs.panels.ui.compose.TileGrid import com.android.systemui.qs.panels.ui.compose.toolbar.Toolbar import com.android.systemui.qs.ui.composable.QuickSettingsShade.Dimensions.GridMaxHeight import com.android.systemui.qs.ui.viewmodel.QuickSettingsContainerViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsContainerViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayActionsViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayActionsViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayContentViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayContentViewModel Loading Loading @@ -122,7 +126,9 @@ constructor( // A sealed interface to represent the possible states of the `ShadeBody` // A sealed interface to represent the possible states of the `ShadeBody` sealed interface ShadeBodyState { sealed interface ShadeBodyState { data object Editing : ShadeBodyState data object Editing : ShadeBodyState data object TileDetails : ShadeBodyState data object TileDetails : ShadeBodyState data object Default : ShadeBodyState data object Default : ShadeBodyState } } Loading @@ -149,9 +155,8 @@ fun SceneScope.ShadeBody(viewModel: QuickSettingsContainerViewModel) { ShadeBodyState.Editing -> { ShadeBodyState.Editing -> { EditMode( EditMode( viewModel = viewModel.editModeViewModel, viewModel = viewModel.editModeViewModel, modifier = Modifier modifier = .fillMaxWidth() Modifier.fillMaxWidth().padding(QuickSettingsShade.Dimensions.Padding), .padding(QuickSettingsShade.Dimensions.Padding), ) ) } } ShadeBodyState.TileDetails -> { ShadeBodyState.TileDetails -> { Loading Loading @@ -182,22 +187,23 @@ fun SceneScope.QuickSettingsLayout( .padding( .padding( start = QuickSettingsShade.Dimensions.Padding, start = QuickSettingsShade.Dimensions.Padding, end = QuickSettingsShade.Dimensions.Padding, end = QuickSettingsShade.Dimensions.Padding, top = QuickSettingsShade.Dimensions.Padding, bottom = QuickSettingsShade.Dimensions.Padding / 2, ), ), ) { ) { Toolbar(viewModel.toolbarViewModelFactory) BrightnessSliderContainer( BrightnessSliderContainer( viewModel = viewModel.brightnessSliderViewModel, viewModel = viewModel.brightnessSliderViewModel, modifier = modifier = Modifier.fillMaxWidth().height(QuickSettingsShade.Dimensions.BrightnessSliderHeight), Modifier.fillMaxWidth().height(QuickSettingsShade.Dimensions.BrightnessSliderHeight), ) ) Box { Box( GridAnchor() TileGrid( viewModel = viewModel.tileGridViewModel, modifier = modifier = Modifier.fillMaxWidth() Modifier.requiredHeightIn(max = GridMaxHeight) .heightIn(max = QuickSettingsShade.Dimensions.GridMaxHeight), .verticalNestedScrollToScene() ) .verticalScroll(rememberScrollState()) ) { GridAnchor() TileGrid(viewModel = viewModel.tileGridViewModel, modifier = Modifier.fillMaxWidth()) } } } } } } Loading @@ -207,6 +213,6 @@ object QuickSettingsShade { object Dimensions { object Dimensions { val Padding = 16.dp val Padding = 16.dp val BrightnessSliderHeight = 64.dp val BrightnessSliderHeight = 64.dp val GridMaxHeight = 800.dp val GridMaxHeight = 420.dp } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/GridLayoutTypeRepositoryTest.kt 0 → 100644 +53 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs.panels.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.qs.panels.shared.model.InfiniteGridLayoutType import com.android.systemui.qs.panels.shared.model.PaginatedGridLayoutType import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) class GridLayoutTypeRepositoryTest : SysuiTestCase() { val kosmos = testKosmos() val underTest = kosmos.gridLayoutTypeRepository @Test fun defaultType_paginated() = kosmos.runTest { val type by collectLastValue(underTest.defaultLayoutType) assertThat(type).isEqualTo(PaginatedGridLayoutType) } @Test fun dualShadeType_infinite() = kosmos.runTest { val type by collectLastValue(underTest.dualShadeLayoutType) assertThat(type).isEqualTo(InfiniteGridLayoutType) } } packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/GridLayoutTypeInteractorTest.kt 0 → 100644 +68 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs.panels.domain.interactor import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.qs.panels.shared.model.InfiniteGridLayoutType import com.android.systemui.qs.panels.shared.model.PaginatedGridLayoutType import com.android.systemui.shade.data.repository.fakeShadeRepository import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) class GridLayoutTypeInteractorTest : SysuiTestCase() { val kosmos = testKosmos() val Kosmos.underTest by Kosmos.Fixture { kosmos.gridLayoutTypeInteractor } @DisableFlags(DualShade.FLAG_NAME) @Test fun noDualShade_gridAlwaysPaginated() = kosmos.runTest { val type by collectLastValue(underTest.layout) fakeShadeRepository.setShadeLayoutWide(false) assertThat(type).isEqualTo(PaginatedGridLayoutType) fakeShadeRepository.setShadeLayoutWide(true) assertThat(type).isEqualTo(PaginatedGridLayoutType) } @EnableFlags(DualShade.FLAG_NAME) @Test fun dualShade_gridAlwaysInfinite() = kosmos.runTest { val type by collectLastValue(underTest.layout) fakeShadeRepository.setShadeLayoutWide(false) assertThat(type).isEqualTo(InfiniteGridLayoutType) fakeShadeRepository.setShadeLayoutWide(true) assertThat(type).isEqualTo(InfiniteGridLayoutType) } } packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/compose/InfiniteGridLayoutTest.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.testScope import com.android.systemui.qs.panels.data.repository.DefaultLargeTilesRepository import com.android.systemui.qs.panels.data.repository.DefaultLargeTilesRepository import com.android.systemui.qs.panels.data.repository.defaultLargeTilesRepository import com.android.systemui.qs.panels.data.repository.defaultLargeTilesRepository import com.android.systemui.qs.panels.domain.interactor.infiniteGridLayout import com.android.systemui.qs.panels.ui.compose.infinitegrid.infiniteGridLayout import com.android.systemui.qs.panels.ui.viewmodel.MockTileViewModel import com.android.systemui.qs.panels.ui.viewmodel.MockTileViewModel import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.android.systemui.testKosmos Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -261,7 +261,7 @@ private fun RowScope.ForegroundServicesButton( /** A button with an icon. */ /** A button with an icon. */ @Composable @Composable private fun IconButton(model: FooterActionsButtonViewModel, modifier: Modifier = Modifier) { fun IconButton(model: FooterActionsButtonViewModel, modifier: Modifier = Modifier) { Expandable( Expandable( color = colorAttr(model.backgroundColor), color = colorAttr(model.backgroundColor), shape = CircleShape, shape = CircleShape, Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +19 −13 Original line number Original line Diff line number Diff line Loading @@ -26,8 +26,10 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeightIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment Loading @@ -50,6 +52,8 @@ import com.android.systemui.qs.flags.QsDetailedView import com.android.systemui.qs.panels.ui.compose.EditMode import com.android.systemui.qs.panels.ui.compose.EditMode import com.android.systemui.qs.panels.ui.compose.TileDetails import com.android.systemui.qs.panels.ui.compose.TileDetails import com.android.systemui.qs.panels.ui.compose.TileGrid import com.android.systemui.qs.panels.ui.compose.TileGrid import com.android.systemui.qs.panels.ui.compose.toolbar.Toolbar import com.android.systemui.qs.ui.composable.QuickSettingsShade.Dimensions.GridMaxHeight import com.android.systemui.qs.ui.viewmodel.QuickSettingsContainerViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsContainerViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayActionsViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayActionsViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayContentViewModel import com.android.systemui.qs.ui.viewmodel.QuickSettingsShadeOverlayContentViewModel Loading Loading @@ -122,7 +126,9 @@ constructor( // A sealed interface to represent the possible states of the `ShadeBody` // A sealed interface to represent the possible states of the `ShadeBody` sealed interface ShadeBodyState { sealed interface ShadeBodyState { data object Editing : ShadeBodyState data object Editing : ShadeBodyState data object TileDetails : ShadeBodyState data object TileDetails : ShadeBodyState data object Default : ShadeBodyState data object Default : ShadeBodyState } } Loading @@ -149,9 +155,8 @@ fun SceneScope.ShadeBody(viewModel: QuickSettingsContainerViewModel) { ShadeBodyState.Editing -> { ShadeBodyState.Editing -> { EditMode( EditMode( viewModel = viewModel.editModeViewModel, viewModel = viewModel.editModeViewModel, modifier = Modifier modifier = .fillMaxWidth() Modifier.fillMaxWidth().padding(QuickSettingsShade.Dimensions.Padding), .padding(QuickSettingsShade.Dimensions.Padding), ) ) } } ShadeBodyState.TileDetails -> { ShadeBodyState.TileDetails -> { Loading Loading @@ -182,22 +187,23 @@ fun SceneScope.QuickSettingsLayout( .padding( .padding( start = QuickSettingsShade.Dimensions.Padding, start = QuickSettingsShade.Dimensions.Padding, end = QuickSettingsShade.Dimensions.Padding, end = QuickSettingsShade.Dimensions.Padding, top = QuickSettingsShade.Dimensions.Padding, bottom = QuickSettingsShade.Dimensions.Padding / 2, ), ), ) { ) { Toolbar(viewModel.toolbarViewModelFactory) BrightnessSliderContainer( BrightnessSliderContainer( viewModel = viewModel.brightnessSliderViewModel, viewModel = viewModel.brightnessSliderViewModel, modifier = modifier = Modifier.fillMaxWidth().height(QuickSettingsShade.Dimensions.BrightnessSliderHeight), Modifier.fillMaxWidth().height(QuickSettingsShade.Dimensions.BrightnessSliderHeight), ) ) Box { Box( GridAnchor() TileGrid( viewModel = viewModel.tileGridViewModel, modifier = modifier = Modifier.fillMaxWidth() Modifier.requiredHeightIn(max = GridMaxHeight) .heightIn(max = QuickSettingsShade.Dimensions.GridMaxHeight), .verticalNestedScrollToScene() ) .verticalScroll(rememberScrollState()) ) { GridAnchor() TileGrid(viewModel = viewModel.tileGridViewModel, modifier = Modifier.fillMaxWidth()) } } } } } } Loading @@ -207,6 +213,6 @@ object QuickSettingsShade { object Dimensions { object Dimensions { val Padding = 16.dp val Padding = 16.dp val BrightnessSliderHeight = 64.dp val BrightnessSliderHeight = 64.dp val GridMaxHeight = 800.dp val GridMaxHeight = 420.dp } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/data/repository/GridLayoutTypeRepositoryTest.kt 0 → 100644 +53 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs.panels.data.repository import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.qs.panels.shared.model.InfiniteGridLayoutType import com.android.systemui.qs.panels.shared.model.PaginatedGridLayoutType import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) class GridLayoutTypeRepositoryTest : SysuiTestCase() { val kosmos = testKosmos() val underTest = kosmos.gridLayoutTypeRepository @Test fun defaultType_paginated() = kosmos.runTest { val type by collectLastValue(underTest.defaultLayoutType) assertThat(type).isEqualTo(PaginatedGridLayoutType) } @Test fun dualShadeType_infinite() = kosmos.runTest { val type by collectLastValue(underTest.dualShadeLayoutType) assertThat(type).isEqualTo(InfiniteGridLayoutType) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/domain/interactor/GridLayoutTypeInteractorTest.kt 0 → 100644 +68 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.qs.panels.domain.interactor import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.qs.panels.shared.model.InfiniteGridLayoutType import com.android.systemui.qs.panels.shared.model.PaginatedGridLayoutType import com.android.systemui.shade.data.repository.fakeShadeRepository import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlin.test.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) class GridLayoutTypeInteractorTest : SysuiTestCase() { val kosmos = testKosmos() val Kosmos.underTest by Kosmos.Fixture { kosmos.gridLayoutTypeInteractor } @DisableFlags(DualShade.FLAG_NAME) @Test fun noDualShade_gridAlwaysPaginated() = kosmos.runTest { val type by collectLastValue(underTest.layout) fakeShadeRepository.setShadeLayoutWide(false) assertThat(type).isEqualTo(PaginatedGridLayoutType) fakeShadeRepository.setShadeLayoutWide(true) assertThat(type).isEqualTo(PaginatedGridLayoutType) } @EnableFlags(DualShade.FLAG_NAME) @Test fun dualShade_gridAlwaysInfinite() = kosmos.runTest { val type by collectLastValue(underTest.layout) fakeShadeRepository.setShadeLayoutWide(false) assertThat(type).isEqualTo(InfiniteGridLayoutType) fakeShadeRepository.setShadeLayoutWide(true) assertThat(type).isEqualTo(InfiniteGridLayoutType) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/panels/ui/compose/InfiniteGridLayoutTest.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.testScope import com.android.systemui.qs.panels.data.repository.DefaultLargeTilesRepository import com.android.systemui.qs.panels.data.repository.DefaultLargeTilesRepository import com.android.systemui.qs.panels.data.repository.defaultLargeTilesRepository import com.android.systemui.qs.panels.data.repository.defaultLargeTilesRepository import com.android.systemui.qs.panels.domain.interactor.infiniteGridLayout import com.android.systemui.qs.panels.ui.compose.infinitegrid.infiniteGridLayout import com.android.systemui.qs.panels.ui.viewmodel.MockTileViewModel import com.android.systemui.qs.panels.ui.viewmodel.MockTileViewModel import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.testKosmos import com.android.systemui.testKosmos Loading