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

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

Merge "Fix wrong color of clock in preview in picker" into main

parents 083df3b8 eb02d687
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -106,10 +106,8 @@ class DefaultClockController(
        largeClock.animations = LargeClockAnimations(largeClock.view, dozeFraction, foldFraction)
        smallClock.animations = DefaultClockAnimations(smallClock.view, dozeFraction, foldFraction)

        val theme = ThemeConfig(isDarkTheme, settings?.seedColor)
        largeClock.events.onThemeChanged(theme)
        smallClock.events.onThemeChanged(theme)

        largeClock.events.onThemeChanged(largeClock.theme.copy(isDarkTheme = isDarkTheme))
        smallClock.events.onThemeChanged(smallClock.theme.copy(isDarkTheme = isDarkTheme))
        events.onTimeZoneChanged(TimeZone.getDefault())

        smallClock.events.onTimeTick()
+2 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import com.android.systemui.plugins.clocks.ClockController
import com.android.systemui.plugins.clocks.ClockEvents
import com.android.systemui.plugins.clocks.ClockFontAxis
import com.android.systemui.plugins.clocks.ClockFontAxisSetting
import com.android.systemui.plugins.clocks.ThemeConfig
import com.android.systemui.plugins.clocks.WeatherData
import com.android.systemui.plugins.clocks.ZenData
import com.android.systemui.shared.clocks.view.FlexClockView
@@ -107,18 +106,16 @@ class FlexClockController(
        }

    override fun initialize(isDarkTheme: Boolean, dozeFraction: Float, foldFraction: Float) {
        val theme = ThemeConfig(isDarkTheme, clockCtx.settings.seedColor)
        events.onFontAxesChanged(clockCtx.settings.axes)

        smallClock.run {
            events.onThemeChanged(theme)
            events.onThemeChanged(theme.copy(isDarkTheme = isDarkTheme))
            animations.doze(dozeFraction)
            animations.fold(foldFraction)
            events.onTimeTick()
        }

        largeClock.run {
            events.onThemeChanged(theme)
            events.onThemeChanged(theme.copy(isDarkTheme = isDarkTheme))
            animations.doze(dozeFraction)
            animations.fold(foldFraction)
            events.onTimeTick()
+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ class FlexClockFaceController(
        }

        override fun onThemeChanged(theme: ThemeConfig) {
            this@FlexClockFaceController.theme = theme
            layerController.faceEvents.onThemeChanged(theme)
        }

+12 −0
Original line number Diff line number Diff line
@@ -170,6 +170,18 @@ object KeyguardClockViewBinder {
                }
            }

        disposables +=
            keyguardRootView.repeatWhenAttached {
                repeatOnLifecycle(Lifecycle.State.STARTED) {
                    viewModel.currentClock.collect { currentClock ->
                        currentClock?.apply {
                            smallClock.run { events.onThemeChanged(theme) }
                            largeClock.run { events.onThemeChanged(theme) }
                        }
                    }
                }
            }

        return disposables
    }

+1 −0
Original line number Diff line number Diff line
@@ -680,6 +680,7 @@ constructor(
        }
        // In clock preview, we should have a seed color for clock
        // before setting clock to clockEventController to avoid updateColor with seedColor == null
        // So in update colors, it should already have the correct theme in clockFaceController
        if (MigrateClocksToBlueprint.isEnabled) {
            clockController.clock = clock
        }