Loading packages/SystemUI/src/com/android/systemui/statusbar/featurepods/av/ui/viewmodel/AvControlsChipViewModel.kt +11 −3 Original line number Diff line number Diff line Loading @@ -16,11 +16,16 @@ package com.android.systemui.statusbar.featurepods.av.ui.viewmodel import android.content.Context import androidx.compose.runtime.getValue import com.android.systemui.common.shared.model.Icon import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.lifecycle.Hydrator import com.android.systemui.res.R import com.android.systemui.statusbar.featurepods.popups.ui.model.ChipIcon import com.android.systemui.statusbar.featurepods.popups.ui.model.ColorsModel import com.android.systemui.statusbar.featurepods.popups.ui.model.HoverBehavior import com.android.systemui.statusbar.featurepods.popups.ui.model.PopupChipId import com.android.systemui.statusbar.featurepods.popups.ui.model.PopupChipModel import com.android.systemui.statusbar.featurepods.popups.ui.viewmodel.StatusBarPopupChipViewModel Loading @@ -34,8 +39,10 @@ import kotlinx.coroutines.flow.map /** ViewModel for the VC Privacy Chip */ class AvControlsChipViewModel @AssistedInject constructor(avControlsChipInteractor: AvControlsChipInteractor) : StatusBarPopupChipViewModel, ExclusiveActivatable() { constructor( @Application applicationContext: Context, avControlsChipInteractor: AvControlsChipInteractor, ) : StatusBarPopupChipViewModel, ExclusiveActivatable() { companion object { val CAMERA_DRAWABLE: Int = com.android.internal.R.drawable.perm_group_camera val MICROPHONE_DRAWABLE: Int = com.android.internal.R.drawable.perm_group_microphone Loading @@ -61,11 +68,12 @@ constructor(avControlsChipInteractor: AvControlsChipInteractor) : is SensorActivityModel.Inactive -> PopupChipModel.Hidden(chipId) is SensorActivityModel.Active -> PopupChipModel.Shown( // TODO: Pass in color when the api supports it chipId = chipId, icons = icons(sensorActivityModel = sensorActivityModel), // TODO(405903665): Remove text after api change chipText = "", colors = ColorsModel.AvControlsTheme, hoverBehavior = HoverBehavior.None, ) } } Loading packages/SystemUI/src/com/android/systemui/statusbar/featurepods/popups/ui/model/ColorsModel.kt +30 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import androidx.compose.material3.ColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.colorResource import com.android.systemui.res.R /** * Model representing how the popup chip in the status bar should be colored, accounting for whether Loading Loading @@ -72,4 +74,32 @@ sealed interface ColorsModel { override fun iconBackgroundOnHover(isPopupShown: Boolean, colorScheme: ColorScheme): Color = if (isPopupShown) colorScheme.onPrimary else colorScheme.onSurface } /** The colors for the AvControls (Privacy Indicator) Chip */ data object AvControlsTheme : ColorsModel { @Composable private fun privacyGreen() = colorResource(R.color.privacy_chip_background) @Composable override fun chipBackground(isPopupShown: Boolean, colorScheme: ColorScheme): Color = privacyGreen() @Composable override fun chipOutline(isPopupShown: Boolean, colorScheme: ColorScheme): Color = privacyGreen() @Composable override fun chipContent(isPopupShown: Boolean, colorScheme: ColorScheme): Color = colorScheme.onPrimary @Composable override fun icon( isPopupShown: Boolean, isHovered: Boolean, colorScheme: ColorScheme, ): Color = colorScheme.onPrimary @Composable override fun iconBackgroundOnHover(isPopupShown: Boolean, colorScheme: ColorScheme): Color = colorScheme.onPrimary } } packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/featurepods/vc/ui/viewmodel/AvControlsChipViewModelKosmos.kt +7 −1 Original line number Diff line number Diff line Loading @@ -16,12 +16,18 @@ package com.android.systemui.statusbar.featurepods.vc.ui.viewmodel import android.content.applicationContext import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.featurepods.av.ui.viewmodel.AvControlsChipViewModel import com.android.systemui.statusbar.featurepods.vc.domain.interactor.avControlsChipInteractor private val Kosmos.avControlsChipViewModel: AvControlsChipViewModel by Kosmos.Fixture { AvControlsChipViewModel(avControlsChipInteractor = avControlsChipInteractor) } Kosmos.Fixture { AvControlsChipViewModel( applicationContext = applicationContext, avControlsChipInteractor = avControlsChipInteractor, ) } val Kosmos.avControlsChipViewModelFactory by Kosmos.Fixture { Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/featurepods/av/ui/viewmodel/AvControlsChipViewModel.kt +11 −3 Original line number Diff line number Diff line Loading @@ -16,11 +16,16 @@ package com.android.systemui.statusbar.featurepods.av.ui.viewmodel import android.content.Context import androidx.compose.runtime.getValue import com.android.systemui.common.shared.model.Icon import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.lifecycle.ExclusiveActivatable import com.android.systemui.lifecycle.Hydrator import com.android.systemui.res.R import com.android.systemui.statusbar.featurepods.popups.ui.model.ChipIcon import com.android.systemui.statusbar.featurepods.popups.ui.model.ColorsModel import com.android.systemui.statusbar.featurepods.popups.ui.model.HoverBehavior import com.android.systemui.statusbar.featurepods.popups.ui.model.PopupChipId import com.android.systemui.statusbar.featurepods.popups.ui.model.PopupChipModel import com.android.systemui.statusbar.featurepods.popups.ui.viewmodel.StatusBarPopupChipViewModel Loading @@ -34,8 +39,10 @@ import kotlinx.coroutines.flow.map /** ViewModel for the VC Privacy Chip */ class AvControlsChipViewModel @AssistedInject constructor(avControlsChipInteractor: AvControlsChipInteractor) : StatusBarPopupChipViewModel, ExclusiveActivatable() { constructor( @Application applicationContext: Context, avControlsChipInteractor: AvControlsChipInteractor, ) : StatusBarPopupChipViewModel, ExclusiveActivatable() { companion object { val CAMERA_DRAWABLE: Int = com.android.internal.R.drawable.perm_group_camera val MICROPHONE_DRAWABLE: Int = com.android.internal.R.drawable.perm_group_microphone Loading @@ -61,11 +68,12 @@ constructor(avControlsChipInteractor: AvControlsChipInteractor) : is SensorActivityModel.Inactive -> PopupChipModel.Hidden(chipId) is SensorActivityModel.Active -> PopupChipModel.Shown( // TODO: Pass in color when the api supports it chipId = chipId, icons = icons(sensorActivityModel = sensorActivityModel), // TODO(405903665): Remove text after api change chipText = "", colors = ColorsModel.AvControlsTheme, hoverBehavior = HoverBehavior.None, ) } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/featurepods/popups/ui/model/ColorsModel.kt +30 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import androidx.compose.material3.ColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.colorResource import com.android.systemui.res.R /** * Model representing how the popup chip in the status bar should be colored, accounting for whether Loading Loading @@ -72,4 +74,32 @@ sealed interface ColorsModel { override fun iconBackgroundOnHover(isPopupShown: Boolean, colorScheme: ColorScheme): Color = if (isPopupShown) colorScheme.onPrimary else colorScheme.onSurface } /** The colors for the AvControls (Privacy Indicator) Chip */ data object AvControlsTheme : ColorsModel { @Composable private fun privacyGreen() = colorResource(R.color.privacy_chip_background) @Composable override fun chipBackground(isPopupShown: Boolean, colorScheme: ColorScheme): Color = privacyGreen() @Composable override fun chipOutline(isPopupShown: Boolean, colorScheme: ColorScheme): Color = privacyGreen() @Composable override fun chipContent(isPopupShown: Boolean, colorScheme: ColorScheme): Color = colorScheme.onPrimary @Composable override fun icon( isPopupShown: Boolean, isHovered: Boolean, colorScheme: ColorScheme, ): Color = colorScheme.onPrimary @Composable override fun iconBackgroundOnHover(isPopupShown: Boolean, colorScheme: ColorScheme): Color = colorScheme.onPrimary } }
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/featurepods/vc/ui/viewmodel/AvControlsChipViewModelKosmos.kt +7 −1 Original line number Diff line number Diff line Loading @@ -16,12 +16,18 @@ package com.android.systemui.statusbar.featurepods.vc.ui.viewmodel import android.content.applicationContext import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.featurepods.av.ui.viewmodel.AvControlsChipViewModel import com.android.systemui.statusbar.featurepods.vc.domain.interactor.avControlsChipInteractor private val Kosmos.avControlsChipViewModel: AvControlsChipViewModel by Kosmos.Fixture { AvControlsChipViewModel(avControlsChipInteractor = avControlsChipInteractor) } Kosmos.Fixture { AvControlsChipViewModel( applicationContext = applicationContext, avControlsChipInteractor = avControlsChipInteractor, ) } val Kosmos.avControlsChipViewModelFactory by Kosmos.Fixture { Loading