Merge "Cache and resend weather data when the clock changes" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c99c303055
@@ -108,6 +108,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
updateFontSizes()
|
updateFontSizes()
|
||||||
updateTimeListeners()
|
updateTimeListeners()
|
||||||
|
cachedWeatherData?.let { value.events.onWeatherDataChanged(it) }
|
||||||
value.smallClock.view.addOnAttachStateChangeListener(
|
value.smallClock.view.addOnAttachStateChangeListener(
|
||||||
object : OnAttachStateChangeListener {
|
object : OnAttachStateChangeListener {
|
||||||
override fun onViewAttachedToWindow(p0: View?) {
|
override fun onViewAttachedToWindow(p0: View?) {
|
||||||
@@ -239,6 +240,7 @@ constructor(
|
|||||||
var largeTimeListener: TimeListener? = null
|
var largeTimeListener: TimeListener? = null
|
||||||
val shouldTimeListenerRun: Boolean
|
val shouldTimeListenerRun: Boolean
|
||||||
get() = isKeyguardVisible && dozeAmount < DOZE_TICKRATE_THRESHOLD
|
get() = isKeyguardVisible && dozeAmount < DOZE_TICKRATE_THRESHOLD
|
||||||
|
private var cachedWeatherData: WeatherData? = null
|
||||||
|
|
||||||
private var smallClockIsDark = true
|
private var smallClockIsDark = true
|
||||||
private var largeClockIsDark = true
|
private var largeClockIsDark = true
|
||||||
@@ -305,6 +307,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onWeatherDataChanged(data: WeatherData) {
|
override fun onWeatherDataChanged(data: WeatherData) {
|
||||||
|
cachedWeatherData = data
|
||||||
clock?.run { events.onWeatherDataChanged(data) }
|
clock?.run { events.onWeatherDataChanged(data) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user