diff options
author | Hawkwood Glazier <jglazier@google.com> | 2023-06-16 14:00:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-06-16 14:00:49 +0000 |
commit | 366774538c88bd3e1e09085683114ebf4e9e3d6b (patch) | |
tree | 647cd783d44eee1eaa36d3f906760d4a868bdd91 | |
parent | 64ba797c29330b9d8c721b40e0276527a375c727 (diff) | |
parent | a59ac711dbf9018c7733c7fca445fbd0b7ac222e (diff) | |
download | ThemePicker-366774538c88bd3e1e09085683114ebf4e9e3d6b.tar.gz |
Merge "Use Locale default temperature unit in wallpaper picker" into udc-dev
-rw-r--r-- | src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt b/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt index e733866f..3f6f423f 100644 --- a/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt +++ b/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt @@ -24,6 +24,7 @@ import android.graphics.Rect 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.systemui.plugins.ClockController import com.android.systemui.plugins.WeatherData @@ -179,13 +180,18 @@ class ClockViewFactory( ) controller.smallClock.events.onTargetRegionChanged(getSmallClockRegion()) - // Use placeholder for weather clock preview in picker + // 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 = TEMPERATURE_PLACEHOLDER, - useCelsius = USE_CELSIUS_PLACEHODLER, + temperature = + if (useCelsius) TEMPERATURE_CELSIUS_PLACEHOLDER + else TEMPERATURE_FAHRENHEIT_PLACEHOLDER, + useCelsius = useCelsius, ) ) return controller @@ -217,7 +223,8 @@ class ClockViewFactory( companion object { const val DESCRIPTION_PLACEHODLER = "" - const val TEMPERATURE_PLACEHOLDER = 58 + const val TEMPERATURE_FAHRENHEIT_PLACEHOLDER = 58 + const val TEMPERATURE_CELSIUS_PLACEHOLDER = 21 val WEATHERICON_PLACEHOLDER = WeatherData.WeatherStateIcon.MOSTLY_SUNNY const val USE_CELSIUS_PLACEHODLER = false |