diff options
author | George Lin <giolin@google.com> | 2023-11-06 19:50:26 +0000 |
---|---|---|
committer | George Lin <giolin@google.com> | 2023-11-06 19:52:58 +0000 |
commit | ecfc005f93462d1cd9999e4dca7b38b2ff437ecd (patch) | |
tree | ba0b33d6034293e0eefcc69156943a0257a48e59 /src/com | |
parent | 63ca378cf0588393b2a1c661a5c24237bcb0c640 (diff) | |
download | ThemePicker-ecfc005f93462d1cd9999e4dca7b38b2ff437ecd.tar.gz |
Fix crash at clock carousel
Make sure to assign the accessiblity delegate after the adapter is
initialized. This is to avoid unexpceted crash caused transitionToNext
which might access to the adapter that is not yet initiailzed.
Test: Manully tested clock carousel still works
Bug: 309161842
Flag: None
Change-Id: I0d6de24c4bd86892808d1610cc8a300d20c9c2e7
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt | 10 |
1 files changed, 5 insertions, 5 deletions
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 6bd717b7..e2616c76 100644 --- a/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt +++ b/src/com/android/customization/picker/clock/ui/binder/ClockCarouselViewBinder.kt @@ -58,11 +58,6 @@ object ClockCarouselViewBinder { carouselView.transitionToPrevious() } ) - screenPreviewClickView.accessibilityDelegate = carouselAccessibilityDelegate - screenPreviewClickView.setOnSideClickedListener { isStart -> - if (isStart) carouselView.scrollToPrevious() else carouselView.scrollToNext() - } - lifecycleOwner.lifecycleScope.launch { lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { launch { @@ -76,6 +71,11 @@ object ClockCarouselViewBinder { }, isTwoPaneAndSmallWidth = isTwoPaneAndSmallWidth, ) + screenPreviewClickView.accessibilityDelegate = carouselAccessibilityDelegate + screenPreviewClickView.setOnSideClickedListener { isStart -> + if (isStart) carouselView.scrollToPrevious() + else carouselView.scrollToNext() + } } } |