commit | 53aeae186f2ecf697674a248903b09b76e9e6cf4 | [log] [tgz] |
---|---|---|
author | Sherry Zhou <yuandizhou@google.com> | Tue Apr 11 16:04:40 2023 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Tue Apr 11 16:04:40 2023 +0000 |
tree | 5c3be043cbad17d94650e03bd62b557ffd1a6427 | |
parent | 4c10ff8b04633931ad79545fd01c1df7375506d6 [diff] | |
parent | 6d59b10d9525d86af68c6981bb5db1bd8813e493 [diff] |
Merge "Fix clock showing 12 hour format when 24 hour format is chosen" into udc-dev
diff --git a/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt b/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt index 30eac55..8d5924e 100644 --- a/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt +++ b/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt
@@ -59,6 +59,12 @@ } launch { + viewModel.allClockIds.collect { + it.forEach { clockId -> clockViewFactory.updateTimeFormat(clockId) } + } + } + + launch { viewModel.selectedIndex.collect { selectedIndex -> carouselView.setSelectedClockIndex(selectedIndex) }
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 1a58d7a..cf154d5 100644 --- a/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt +++ b/src/com/android/customization/picker/clock/ui/view/ClockViewFactory.kt
@@ -60,6 +60,12 @@ .onSeedColorChanged(seedColor) } + fun updateTimeFormat(clockId: String) { + getController(clockId) + .events + .onTimeFormatChanged(android.text.format.DateFormat.is24HourFormat(activity)) + } + fun registerTimeTicker(owner: LifecycleOwner) { registerTimeTicker(owner, null) }