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

Commit df9b8c12 authored by Jan Lanik's avatar Jan Lanik
Browse files

Making the PrivacyIndicator chip green

Setting the color to green - the same shade as the privacy dot.

Bug: 394074664
Test: Manual verification
Flag: com.android.systemui.expanded_privacy_indicators_on_large_screen
Change-Id: I74f8ccb944bc105034aa216a3fc9b0b3c84dcd65
parent e5b6f2aa
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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
@@ -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
@@ -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,
                )
        }
    }
+30 −0
Original line number Diff line number Diff line
@@ -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
@@ -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
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -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 {