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

Commit aac40cb9 authored by Hawkwood Glazier's avatar Hawkwood Glazier
Browse files

Cache and resend weather data when the clock changes

Bug: 282231387
Test: Changed clock a few times. Observed weather data.
Change-Id: I46c0f0ad2779f64ef023ebbe2b501c1486264520
parent 7e39238a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ constructor(
                }
                updateFontSizes()
                updateTimeListeners()
                cachedWeatherData?.let { value.events.onWeatherDataChanged(it) }
                value.smallClock.view.addOnAttachStateChangeListener(
                    object : OnAttachStateChangeListener {
                        override fun onViewAttachedToWindow(p0: View?) {
@@ -239,6 +240,7 @@ constructor(
    var largeTimeListener: TimeListener? = null
    val shouldTimeListenerRun: Boolean
        get() = isKeyguardVisible && dozeAmount < DOZE_TICKRATE_THRESHOLD
    private var cachedWeatherData: WeatherData? = null

    private var smallClockIsDark = true
    private var largeClockIsDark = true
@@ -305,6 +307,7 @@ constructor(
            }

            override fun onWeatherDataChanged(data: WeatherData) {
                cachedWeatherData = data
                clock?.run { events.onWeatherDataChanged(data) }
            }
        }