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

Commit d7a3eecc authored by Sherry Zhou's avatar Sherry Zhou Committed by Android (Google) Code Review
Browse files

Merge "Fix Transit clock color in lock screen being overriden in wallpaper preview" into main

parents e4b6ed78 6620022a
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardPreviewClockViewModel
import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.res.R
import com.android.systemui.shared.clocks.ClockRegistry
import com.android.systemui.util.Utils
import kotlin.reflect.KSuspendFunction1

@@ -77,12 +78,13 @@ object KeyguardPreviewClockViewBinder {
        context: Context,
        rootView: ConstraintLayout,
        viewModel: KeyguardPreviewClockViewModel,
        clockRegistry: ClockRegistry,
        updateClockAppearance: KSuspendFunction1<ClockController, Unit>,
    ) {
        rootView.repeatWhenAttached {
            repeatOnLifecycle(Lifecycle.State.STARTED) {
                launch("$TAG#viewModel.previewClock") {
                var lastClock: ClockController? = null
                launch("$TAG#viewModel.previewClock") {
                        viewModel.previewClock.collect { currentClock ->
                            lastClock?.let { clock ->
                                (clock.largeClock.layout.views + clock.smallClock.layout.views)
@@ -108,6 +110,10 @@ object KeyguardPreviewClockViewBinder {
                            applyPreviewConstraints(context, rootView, currentClock, viewModel)
                        }
                    }
                    .invokeOnCompletion {
                        // recover seed color especially for Transit clock
                        lastClock?.events?.onSeedColorChanged(clockRegistry.seedColor)
                    }
            }
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -416,7 +416,8 @@ constructor(
                    previewContext,
                    keyguardRootView,
                    clockViewModel,
                    ::updateClockAppearance
                    clockRegistry,
                    ::updateClockAppearance,
                )
            } else {
                KeyguardPreviewClockViewBinder.bind(