Move Sample WeatherData to be available in more places
Bug: 285877857
Flag: NONE small bugfix
Test: Maually checked the preview case
Change-Id: Ie5398d0ddc7225d754354e7f011b3ad7068ccaa1
diff --git a/src/com/android/customization/picker/clock/ui/view/ClockViewFactoryImpl.kt b/src/com/android/customization/picker/clock/ui/view/ClockViewFactoryImpl.kt
index a3f7c51..669c273 100644
--- a/src/com/android/customization/picker/clock/ui/view/ClockViewFactoryImpl.kt
+++ b/src/com/android/customization/picker/clock/ui/view/ClockViewFactoryImpl.kt
@@ -23,7 +23,6 @@
import android.view.View
import android.widget.FrameLayout
import androidx.annotation.ColorInt
-import androidx.core.text.util.LocalePreferences
import androidx.lifecycle.LifecycleOwner
import com.android.internal.policy.SystemBarUtils
import com.android.systemui.plugins.clocks.ClockController
@@ -201,21 +200,7 @@
.toFloat()
)
controller.smallClock.events.onTargetRegionChanged(getSmallClockRegion())
-
- // Use placeholder for weather clock preview in picker.
- // Use locale default temp unit since assistant default is not available in this context.
- val useCelsius =
- LocalePreferences.getTemperatureUnit() == LocalePreferences.TemperatureUnit.CELSIUS
- controller.events.onWeatherDataChanged(
- WeatherData(
- description = DESCRIPTION_PLACEHODLER,
- state = WEATHERICON_PLACEHOLDER,
- temperature =
- if (useCelsius) TEMPERATURE_CELSIUS_PLACEHOLDER
- else TEMPERATURE_FAHRENHEIT_PLACEHOLDER,
- useCelsius = useCelsius,
- )
- )
+ controller.events.onWeatherDataChanged(WeatherData.getPlaceholderWeatherData())
return controller
}
@@ -252,13 +237,7 @@
}
companion object {
- const val DESCRIPTION_PLACEHODLER = ""
- const val TEMPERATURE_FAHRENHEIT_PLACEHOLDER = 58
- const val TEMPERATURE_CELSIUS_PLACEHOLDER = 21
- val WEATHERICON_PLACEHOLDER = WeatherData.WeatherStateIcon.MOSTLY_SUNNY
-
private fun getStatusBarHeight(context: Context): Int {
-
val display = context.displayNoVerify
if (display != null) {
return SystemBarUtils.getStatusBarHeight(context.resources, display.cutout)