Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e21b1a4 authored by George Lin's avatar George Lin
Browse files

[TP] Fix carousel missing

When coming back from a secondary screen, e.g. clock settings,
shortcuts, the clock carousel is missing. This is to fix it.

Test: tested that the carousel is shown when back from a secondary
screen
Bug: 271106023

Change-Id: Ifd1adf86a473efaaa5c11091ff3f60e94734a08e
parent 3a99c18f
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ object ClockCarouselViewBinder {

    @JvmStatic
    fun bind(
        view: ClockCarouselView,
        carouselView: ClockCarouselView,
        singleClockView: ViewGroup,
        viewModel: ClockCarouselViewModel,
        clockViewFactory: (clockId: String) -> View,
@@ -50,11 +50,11 @@ object ClockCarouselViewBinder {
            singleClockView.requireViewById<FrameLayout>(R.id.single_clock_host_view)
        lifecycleOwner.lifecycleScope.launch {
            lifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
                launch { viewModel.isCarouselVisible.collect { view.isVisible = it } }
                launch { viewModel.isCarouselVisible.collect { carouselView.isVisible = it } }

                launch {
                    viewModel.allClockIds.collect { allClockIds ->
                        view.setUpClockCarouselView(
                        carouselView.setUpClockCarouselView(
                            clockIds = allClockIds,
                            onGetClockPreview = clockViewFactory,
                            onClockSelected = { clockId -> viewModel.setSelectedClock(clockId) },
@@ -64,11 +64,13 @@ object ClockCarouselViewBinder {

                launch {
                    viewModel.selectedIndex.collect { selectedIndex ->
                        view.setSelectedClockIndex(selectedIndex)
                        carouselView.setSelectedClockIndex(selectedIndex)
                    }
                }

                launch { viewModel.isSingleClockViewVisible.collect { view.isVisible = it } }
                launch {
                    viewModel.isSingleClockViewVisible.collect { singleClockView.isVisible = it }
                }

                launch {
                    viewModel.clockId.collect { clockId ->
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ class PreviewWithClockCarouselSectionController(
        lifecycleOwner.lifecycleScope.launch {
            clockCarouselBinding =
                ClockCarouselViewBinder.bind(
                    view = carouselView,
                    carouselView = carouselView,
                    singleClockView = singleClockView,
                    viewModel = clockCarouselViewModel,
                    clockViewFactory = { clockId -> clockViewFactory.getView(clockId) },