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

Commit d908e5f2 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Update device entry icon color" into main

parents b85dd6b0 93080fd6
Loading
Loading
Loading
Loading
+16 −5
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.onStart


@@ -49,12 +50,22 @@ constructor(
        transitionInteractor.startedKeyguardState.map { keyguardState ->
        transitionInteractor.startedKeyguardState.map { keyguardState ->
            keyguardState == KeyguardState.AOD
            keyguardState == KeyguardState.AOD
        }
        }

    private fun getColor(usingBackgroundProtection: Boolean): Int {
        return if (usingBackgroundProtection) {
            Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
        } else {
            Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColorAccent)
        }
    }

    private val color: Flow<Int> =
    private val color: Flow<Int> =
        deviceEntryIconViewModel.useBackgroundProtection.flatMapLatest { useBgProtection ->
            configurationRepository.onAnyConfigurationChange
            configurationRepository.onAnyConfigurationChange
            .map { Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary) }
                .map { getColor(useBgProtection) }
            .onStart {
                .onStart { emit(getColor(useBgProtection)) }
                emit(Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary))
        }
        }

    private val useAodIconVariant: Flow<Boolean> =
    private val useAodIconVariant: Flow<Boolean> =
        combine(isShowingAod, deviceEntryUdfpsInteractor.isUdfpsSupported) {
        combine(isShowingAod, deviceEntryUdfpsInteractor.isUdfpsSupported) {
                isTransitionToAod,
                isTransitionToAod,