summaryrefslogtreecommitdiff
path: root/src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 00:18:39 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 00:18:39 +0000
commit3448c3edb1876809aa9ff3e8d441c110aa3c07fb (patch)
treeaba9bb80910323ff849285ab3f1f610e64dc977f /src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt
parent3cc68260bf5367ff502c46322e5673e4b3ad84be (diff)
parentf93898e32e7ae418e8ec7ad25000e2c0a9c8c613 (diff)
downloadThemePicker-3448c3edb1876809aa9ff3e8d441c110aa3c07fb.tar.gz
Snap for 11211409 from f93898e32e7ae418e8ec7ad25000e2c0a9c8c613 to sdk-release
Change-Id: I67b5a8652c40bebba4a83549e0d77d9cd680457c
Diffstat (limited to 'src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt')
-rw-r--r--src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt b/src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt
index 435878dc..83f986da 100644
--- a/src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt
+++ b/src/com/android/customization/picker/preview/ui/viewmodel/PreviewWithThemeViewModel.kt
@@ -20,12 +20,14 @@ package com.android.customization.picker.preview.ui.viewmodel
import android.app.WallpaperColors
import android.os.Bundle
import com.android.customization.model.themedicon.domain.interactor.ThemedIconInteractor
+import com.android.customization.picker.color.domain.interactor.ColorPickerInteractor
import com.android.wallpaper.model.WallpaperInfo
import com.android.wallpaper.module.CustomizationSections
import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor
import com.android.wallpaper.picker.customization.ui.viewmodel.ScreenPreviewViewModel
import com.android.wallpaper.util.PreviewUtils
import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.combine
/** A ThemePicker version of the [ScreenPreviewViewModel] */
class PreviewWithThemeViewModel(
@@ -35,6 +37,7 @@ class PreviewWithThemeViewModel(
onWallpaperColorChanged: (WallpaperColors?) -> Unit = {},
wallpaperInteractor: WallpaperInteractor,
private val themedIconInteractor: ThemedIconInteractor? = null,
+ colorPickerInteractor: ColorPickerInteractor? = null,
screen: CustomizationSections.Screen,
) :
ScreenPreviewViewModel(
@@ -46,4 +49,16 @@ class PreviewWithThemeViewModel(
screen,
) {
override fun workspaceUpdateEvents(): Flow<Boolean>? = themedIconInteractor?.isActivated
+
+ private val wallpaperIsLoading = super.isLoading
+
+ override val isLoading: Flow<Boolean> =
+ colorPickerInteractor?.let {
+ combine(wallpaperIsLoading, colorPickerInteractor.isApplyingSystemColor) {
+ wallpaperIsLoading,
+ colorIsLoading ->
+ wallpaperIsLoading || colorIsLoading
+ }
+ }
+ ?: wallpaperIsLoading
}