Removes "reset" button from shortcuts screen.
As per UX, full-screen pickers for individual parts of customization
should not contain their own "reset" button. Instead, the "reset" button
should only be available on the main screen.
This CL removes that button from the keyguard quick affordance (lock
screen shortcuts) screen.
Bug: 266116562
Test: manually verified that the "reset" button is gone from the
shortcuts screen but it still showing as expected on the main screen.
Change-Id: Iebdc6da5cb8c71af8404045332b0a6d05caa2767
diff --git a/src/com/android/customization/module/ThemePickerInjector.kt b/src/com/android/customization/module/ThemePickerInjector.kt
index b448283..81712a9 100644
--- a/src/com/android/customization/module/ThemePickerInjector.kt
+++ b/src/com/android/customization/module/ThemePickerInjector.kt
@@ -182,7 +182,6 @@
?: KeyguardQuickAffordancePickerViewModel.Factory(
context,
getKeyguardQuickAffordancePickerInteractor(context),
- getUndoInteractor(context),
getCurrentWallpaperInfoFactory(context),
) { intent ->
context.startActivity(intent)
diff --git a/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt b/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
index 51b98ef..8d8a517 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/fragment/KeyguardQuickAffordancePickerFragment.kt
@@ -30,7 +30,6 @@
import com.android.wallpaper.R
import com.android.wallpaper.module.InjectorProvider
import com.android.wallpaper.picker.AppbarFragment
-import com.android.wallpaper.picker.undo.ui.binder.RevertToolbarButtonBinder
import kotlinx.coroutines.ExperimentalCoroutinesApi
@OptIn(ExperimentalCoroutinesApi::class)
@@ -62,12 +61,6 @@
injector.getKeyguardQuickAffordancePickerViewModelFactory(requireContext()),
)
.get()
- setUpToolbarMenu(R.menu.undoable_customization_menu)
- RevertToolbarButtonBinder.bind(
- view = view.requireViewById(toolbarId),
- viewModel = viewModel.undo,
- lifecycleOwner = this,
- )
KeyguardQuickAffordancePreviewBinder.bind(
activity = requireActivity(),
diff --git a/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt b/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
index b5954e5..92917ed 100644
--- a/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
+++ b/src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt
@@ -38,8 +38,6 @@
import com.android.wallpaper.picker.common.icon.ui.viewmodel.Icon
import com.android.wallpaper.picker.common.text.ui.viewmodel.Text
import com.android.wallpaper.picker.customization.ui.viewmodel.ScreenPreviewViewModel
-import com.android.wallpaper.picker.undo.domain.interactor.UndoInteractor
-import com.android.wallpaper.picker.undo.ui.viewmodel.UndoViewModel
import com.android.wallpaper.util.PreviewUtils
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
@@ -57,7 +55,6 @@
private constructor(
context: Context,
private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor,
- undoInteractor: UndoInteractor,
private val wallpaperInfoFactory: CurrentWallpaperInfoFactory,
activityStarter: (Intent) -> Unit,
) : ViewModel() {
@@ -94,11 +91,6 @@
},
)
- val undo: UndoViewModel =
- UndoViewModel(
- interactor = undoInteractor,
- )
-
private val _selectedSlotId = MutableStateFlow<String?>(null)
val selectedSlotId: StateFlow<String?> = _selectedSlotId.asStateFlow()
@@ -390,7 +382,6 @@
class Factory(
private val context: Context,
private val quickAffordanceInteractor: KeyguardQuickAffordancePickerInteractor,
- private val undoInteractor: UndoInteractor,
private val wallpaperInfoFactory: CurrentWallpaperInfoFactory,
private val activityStarter: (Intent) -> Unit,
) : ViewModelProvider.Factory {
@@ -399,7 +390,6 @@
return KeyguardQuickAffordancePickerViewModel(
context = context,
quickAffordanceInteractor = quickAffordanceInteractor,
- undoInteractor = undoInteractor,
wallpaperInfoFactory = wallpaperInfoFactory,
activityStarter = activityStarter,
)
diff --git a/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt b/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
index 85d5e3b..fd03285 100644
--- a/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
+++ b/tests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
@@ -34,9 +34,6 @@
import com.android.wallpaper.module.InjectorProvider
import com.android.wallpaper.picker.common.icon.ui.viewmodel.Icon
import com.android.wallpaper.picker.common.text.ui.viewmodel.Text
-import com.android.wallpaper.picker.undo.data.repository.UndoRepository
-import com.android.wallpaper.picker.undo.domain.interactor.UndoInteractor
-import com.android.wallpaper.testing.FAKE_RESTORERS
import com.android.wallpaper.testing.FakeSnapshotStore
import com.android.wallpaper.testing.TestCurrentWallpaperInfoFactory
import com.android.wallpaper.testing.TestInjector
@@ -96,17 +93,10 @@
.apply { runBlocking { setUpSnapshotRestorer(FakeSnapshotStore()) } }
},
)
- val undoInteractor =
- UndoInteractor(
- scope = testScope.backgroundScope,
- repository = UndoRepository(),
- restorerByOwnerId = FAKE_RESTORERS,
- )
underTest =
KeyguardQuickAffordancePickerViewModel.Factory(
context = context,
quickAffordanceInteractor = quickAffordanceInteractor,
- undoInteractor = undoInteractor,
wallpaperInfoFactory = TestCurrentWallpaperInfoFactory(context),
activityStarter = { intent -> latestStartedActivityIntent = intent },
)