Loading src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt +15 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.widget.ImageView import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat import androidx.core.view.get import androidx.core.view.isEmpty import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner Loading Loading @@ -428,6 +430,19 @@ object ClockFloatingSheetBinder { } } launch { viewModel.previewingClockStyleOptionIndex.collect { indexToFocus -> val offset = if (!clockStyleList.isEmpty()) { clockStyleList.get(0).width } else { 0 } (clockStyleList.layoutManager as LinearLayoutManager) .scrollToPositionWithOffset(indexToFocus, offset) } } launch { var binding: SwitchColorBinder.Binding? = null viewModel.previewingClockSize.collect { size -> Loading src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt +8 −2 Original line number Diff line number Diff line Loading @@ -153,6 +153,9 @@ constructor( val _previewingClockColorOptionIndex = MutableStateFlow<Int>(0) val previewingClockColorOptionIndex = _previewingClockColorOptionIndex.asStateFlow() val _previewingClockStyleOptionIndex = MutableStateFlow<Int>(0) val previewingClockStyleOptionIndex = _previewingClockStyleOptionIndex.asStateFlow() // Represents show and hide of the clock view provided by the picker side. private val _showPickerClockControllerView: MutableStateFlow<Boolean> = MutableStateFlow(false) val showPickerClockControllerView: Flow<Boolean> = _showPickerClockControllerView.asStateFlow() Loading Loading @@ -195,8 +198,9 @@ constructor( delay(CLOCKS_EVENT_UPDATE_DELAY_MILLIS) val allClockMap = allClocks.groupBy { it.axisPresetConfig != null } buildList { allClockMap[true]?.map { add(it.toOption(resources, true)) } allClockMap[false]?.map { add(it.toOption(resources, false)) } var index = 0 allClockMap[true]?.forEach { add(it.toOption(resources, true, index++)) } allClockMap[false]?.forEach { add(it.toOption(resources, false, index++)) } } } // makes sure that the operations above this statement are executed on I/O dispatcher Loading Loading @@ -292,6 +296,7 @@ constructor( private suspend fun ClockMetadataModel.toOption( resources: Resources, hasPresets: Boolean, index: Int, ): OptionItemViewModel2<ClockStyleModel> { val isSelectedFlow = previewingClock.map { it.clockId == clockId }.stateIn(viewModelScope) val contentDescription = Loading @@ -308,6 +313,7 @@ constructor( null } else { fun() { _previewingClockStyleOptionIndex.value = index overridingClock.value = this } } Loading Loading
src/com/android/wallpaper/customization/ui/binder/ClockFloatingSheetBinder.kt +15 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.widget.ImageView import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat import androidx.core.view.get import androidx.core.view.isEmpty import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner Loading Loading @@ -428,6 +430,19 @@ object ClockFloatingSheetBinder { } } launch { viewModel.previewingClockStyleOptionIndex.collect { indexToFocus -> val offset = if (!clockStyleList.isEmpty()) { clockStyleList.get(0).width } else { 0 } (clockStyleList.layoutManager as LinearLayoutManager) .scrollToPositionWithOffset(indexToFocus, offset) } } launch { var binding: SwitchColorBinder.Binding? = null viewModel.previewingClockSize.collect { size -> Loading
src/com/android/wallpaper/customization/ui/viewmodel/ClockPickerViewModel.kt +8 −2 Original line number Diff line number Diff line Loading @@ -153,6 +153,9 @@ constructor( val _previewingClockColorOptionIndex = MutableStateFlow<Int>(0) val previewingClockColorOptionIndex = _previewingClockColorOptionIndex.asStateFlow() val _previewingClockStyleOptionIndex = MutableStateFlow<Int>(0) val previewingClockStyleOptionIndex = _previewingClockStyleOptionIndex.asStateFlow() // Represents show and hide of the clock view provided by the picker side. private val _showPickerClockControllerView: MutableStateFlow<Boolean> = MutableStateFlow(false) val showPickerClockControllerView: Flow<Boolean> = _showPickerClockControllerView.asStateFlow() Loading Loading @@ -195,8 +198,9 @@ constructor( delay(CLOCKS_EVENT_UPDATE_DELAY_MILLIS) val allClockMap = allClocks.groupBy { it.axisPresetConfig != null } buildList { allClockMap[true]?.map { add(it.toOption(resources, true)) } allClockMap[false]?.map { add(it.toOption(resources, false)) } var index = 0 allClockMap[true]?.forEach { add(it.toOption(resources, true, index++)) } allClockMap[false]?.forEach { add(it.toOption(resources, false, index++)) } } } // makes sure that the operations above this statement are executed on I/O dispatcher Loading Loading @@ -292,6 +296,7 @@ constructor( private suspend fun ClockMetadataModel.toOption( resources: Resources, hasPresets: Boolean, index: Int, ): OptionItemViewModel2<ClockStyleModel> { val isSelectedFlow = previewingClock.map { it.clockId == clockId }.stateIn(viewModelScope) val contentDescription = Loading @@ -308,6 +313,7 @@ constructor( null } else { fun() { _previewingClockStyleOptionIndex.value = index overridingClock.value = this } } Loading