Loading src/com/android/wallpaper/customization/ui/viewmodel/KeyguardQuickAffordancePickerViewModel2.kt +11 −5 Original line number Diff line number Diff line Loading @@ -62,9 +62,11 @@ constructor( private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor, private val logger: ThemesUserEventLogger, @Assisted private val viewModelScope: CoroutineScope, @Assisted initialDeepLinkShortcutSlotId: String?, ) { /** A locally-selected slot, if the user ever switched from the original one. */ private val _selectedSlotId = MutableStateFlow<String?>(null) private val _selectedSlotId: MutableStateFlow<String?> = MutableStateFlow(initialDeepLinkShortcutSlotId) /** The ID of the selected slot. */ val selectedSlotId: StateFlow<String> = combine(quickAffordanceInteractor.slots, _selectedSlotId) { slots, selectedSlotIdOrNull -> Loading @@ -81,14 +83,15 @@ constructor( started = SharingStarted.WhileSubscribed(), initialValue = "", ) private val overridingQuickAffordances = MutableStateFlow<Map<String, String>>(emptyMap()) private val overridingQuickAffordances: MutableStateFlow<Map<String, String>> = MutableStateFlow(emptyMap()) private val selectedQuickAffordancesGroupBySlotId = quickAffordanceInteractor.selections .map { it.groupBy { selectionModel -> selectionModel.slotId } } .shareIn(viewModelScope, SharingStarted.WhileSubscribed(), 1) val _selectedQuickAffordanceIndex = MutableStateFlow<Int>(0) val selectedQuickAffordanceIndex = _selectedQuickAffordanceIndex.asStateFlow() private val _selectedQuickAffordanceIndex: MutableStateFlow<Int> = MutableStateFlow(0) val selectedQuickAffordanceIndex: StateFlow<Int> = _selectedQuickAffordanceIndex.asStateFlow() val previewingQuickAffordances = combine( Loading Loading @@ -473,6 +476,9 @@ constructor( @ViewModelScoped @AssistedFactory interface Factory { fun create(viewModelScope: CoroutineScope): KeyguardQuickAffordancePickerViewModel2 fun create( viewModelScope: CoroutineScope, initialDeepLinkShortcutSlotId: String?, ): KeyguardQuickAffordancePickerViewModel2 } } src/com/android/wallpaper/customization/ui/viewmodel/ThemePickerCustomizationOptionsViewModel.kt +9 −3 Original line number Diff line number Diff line Loading @@ -65,13 +65,15 @@ constructor( val themedIconViewModel: ThemedIconViewModel, val packThemeViewModel: PackThemeViewModel, @Assisted private val viewModelScope: CoroutineScope, @Assisted initialDeepLinkDestination: String?, @Assisted("destination") initialDeepLinkDestination: String?, @Assisted("shortcutSlotId") initialDeepLinkShortcutSlotId: String?, ) : CustomizationOptionsViewModel { private val defaultCustomizationOptionsViewModel = defaultCustomizationOptionsViewModelFactory.create( viewModelScope, initialDeepLinkDestination, initialDeepLinkShortcutSlotId, ) override val wallpaperCarouselViewModel = Loading @@ -79,7 +81,10 @@ constructor( val clockPickerViewModel = clockPickerViewModelFactory.create(viewModelScope = viewModelScope) val keyguardQuickAffordancePickerViewModel2 = keyguardQuickAffordancePickerViewModel2Factory.create(viewModelScope = viewModelScope) keyguardQuickAffordancePickerViewModel2Factory.create( viewModelScope = viewModelScope, initialDeepLinkShortcutSlotId = initialDeepLinkShortcutSlotId, ) val colorPickerViewModel2 = colorPickerViewModel2Factory.create(viewModelScope = viewModelScope) val gridPickerViewModel = gridPickerViewModelFactory.create(viewModelScope = viewModelScope) val appIconPickerViewModel = Loading Loading @@ -265,7 +270,8 @@ constructor( interface Factory : CustomizationOptionsViewModelFactory { override fun create( viewModelScope: CoroutineScope, initialDeepLinkDestination: String?, @Assisted("destination") initialDeepLinkDestination: String?, @Assisted("shortcutSlotId") initialDeepLinkShortcutSlotId: String?, ): ThemePickerCustomizationOptionsViewModel } } tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/KeyguardQuickAffordancePickerViewModel2Test.kt +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class KeyguardQuickAffordancePickerViewModel2Test { quickAffordanceInteractor = quickAffordanceInteractor, logger = logger, viewModelScope = testScope.backgroundScope, initialDeepLinkShortcutSlotId = null, ) } Loading Loading
src/com/android/wallpaper/customization/ui/viewmodel/KeyguardQuickAffordancePickerViewModel2.kt +11 −5 Original line number Diff line number Diff line Loading @@ -62,9 +62,11 @@ constructor( private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor, private val logger: ThemesUserEventLogger, @Assisted private val viewModelScope: CoroutineScope, @Assisted initialDeepLinkShortcutSlotId: String?, ) { /** A locally-selected slot, if the user ever switched from the original one. */ private val _selectedSlotId = MutableStateFlow<String?>(null) private val _selectedSlotId: MutableStateFlow<String?> = MutableStateFlow(initialDeepLinkShortcutSlotId) /** The ID of the selected slot. */ val selectedSlotId: StateFlow<String> = combine(quickAffordanceInteractor.slots, _selectedSlotId) { slots, selectedSlotIdOrNull -> Loading @@ -81,14 +83,15 @@ constructor( started = SharingStarted.WhileSubscribed(), initialValue = "", ) private val overridingQuickAffordances = MutableStateFlow<Map<String, String>>(emptyMap()) private val overridingQuickAffordances: MutableStateFlow<Map<String, String>> = MutableStateFlow(emptyMap()) private val selectedQuickAffordancesGroupBySlotId = quickAffordanceInteractor.selections .map { it.groupBy { selectionModel -> selectionModel.slotId } } .shareIn(viewModelScope, SharingStarted.WhileSubscribed(), 1) val _selectedQuickAffordanceIndex = MutableStateFlow<Int>(0) val selectedQuickAffordanceIndex = _selectedQuickAffordanceIndex.asStateFlow() private val _selectedQuickAffordanceIndex: MutableStateFlow<Int> = MutableStateFlow(0) val selectedQuickAffordanceIndex: StateFlow<Int> = _selectedQuickAffordanceIndex.asStateFlow() val previewingQuickAffordances = combine( Loading Loading @@ -473,6 +476,9 @@ constructor( @ViewModelScoped @AssistedFactory interface Factory { fun create(viewModelScope: CoroutineScope): KeyguardQuickAffordancePickerViewModel2 fun create( viewModelScope: CoroutineScope, initialDeepLinkShortcutSlotId: String?, ): KeyguardQuickAffordancePickerViewModel2 } }
src/com/android/wallpaper/customization/ui/viewmodel/ThemePickerCustomizationOptionsViewModel.kt +9 −3 Original line number Diff line number Diff line Loading @@ -65,13 +65,15 @@ constructor( val themedIconViewModel: ThemedIconViewModel, val packThemeViewModel: PackThemeViewModel, @Assisted private val viewModelScope: CoroutineScope, @Assisted initialDeepLinkDestination: String?, @Assisted("destination") initialDeepLinkDestination: String?, @Assisted("shortcutSlotId") initialDeepLinkShortcutSlotId: String?, ) : CustomizationOptionsViewModel { private val defaultCustomizationOptionsViewModel = defaultCustomizationOptionsViewModelFactory.create( viewModelScope, initialDeepLinkDestination, initialDeepLinkShortcutSlotId, ) override val wallpaperCarouselViewModel = Loading @@ -79,7 +81,10 @@ constructor( val clockPickerViewModel = clockPickerViewModelFactory.create(viewModelScope = viewModelScope) val keyguardQuickAffordancePickerViewModel2 = keyguardQuickAffordancePickerViewModel2Factory.create(viewModelScope = viewModelScope) keyguardQuickAffordancePickerViewModel2Factory.create( viewModelScope = viewModelScope, initialDeepLinkShortcutSlotId = initialDeepLinkShortcutSlotId, ) val colorPickerViewModel2 = colorPickerViewModel2Factory.create(viewModelScope = viewModelScope) val gridPickerViewModel = gridPickerViewModelFactory.create(viewModelScope = viewModelScope) val appIconPickerViewModel = Loading Loading @@ -265,7 +270,8 @@ constructor( interface Factory : CustomizationOptionsViewModelFactory { override fun create( viewModelScope: CoroutineScope, initialDeepLinkDestination: String?, @Assisted("destination") initialDeepLinkDestination: String?, @Assisted("shortcutSlotId") initialDeepLinkShortcutSlotId: String?, ): ThemePickerCustomizationOptionsViewModel } }
tests/robotests/src/com/android/wallpaper/customization/ui/viewmodel/KeyguardQuickAffordancePickerViewModel2Test.kt +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class KeyguardQuickAffordancePickerViewModel2Test { quickAffordanceInteractor = quickAffordanceInteractor, logger = logger, viewModelScope = testScope.backgroundScope, initialDeepLinkShortcutSlotId = null, ) } Loading