Hide clock accessibility action when there is 1 or no clock
When there are no clocks to choose from, hide accessibility action on
carousel view to avoid confusion.
Flag: EXEMPT bug fix
Bug: 378604758
Test: manually verified with 0 and 1 clock
Change-Id: I7c8818478477497ffdda60ed5993d4f801f02d9f
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 7fcfd9c..4f96f69 100644
--- a/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt
+++ b/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt
@@ -56,7 +56,7 @@
scrollBackwardCallback = {
// Callback code for scrolling backward
carouselView.transitionToPrevious()
- }
+ },
)
lifecycleOwner.lifecycleScope.launch {
lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
@@ -71,7 +71,13 @@
},
isTwoPaneAndSmallWidth = isTwoPaneAndSmallWidth,
)
- carouselView.accessibilityDelegate = carouselAccessibilityDelegate
+ // Only show accessibility action when there is >1 clock to choose from
+ carouselView.accessibilityDelegate =
+ if (allClocks.size > 1) {
+ carouselAccessibilityDelegate
+ } else {
+ null
+ }
screenPreviewClickView.setOnSideClickedListener { isStart ->
if (isStart) carouselView.scrollToPrevious()
else carouselView.scrollToNext()