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

Commit 07448083 authored by Catherine Liang's avatar Catherine Liang
Browse files

Adapt all screen previews to recent changes (2/2)

Adapt wallpaper picker screen preview binders and view models to changes
that would allow screen previews to reload when the preview is dirty.

Bug: 270193793
Test: Manually verified anywhere the preview is used
Test: Adjusted view model test to screen preview changes, test still
passes

Change-Id: Idff31e7742d9e94f6758b45de8b1df434c620261
parent 304143aa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -122,10 +122,10 @@ class GridFragment2 : AppbarFragment() {
                        }
                    },
                    wallpaperInteractor = wallpaperInteractor,
                    screen = CustomizationSections.Screen.HOME_SCREEN,
                ),
            lifecycleOwner = this,
            offsetToStart = false,
            screen = CustomizationSections.Screen.HOME_SCREEN,
            onPreviewDirty = { activity?.recreate() },
        )
    }
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject
            ?: KeyguardQuickAffordancePickerViewModel.Factory(
                    context,
                    getKeyguardQuickAffordancePickerInteractor(context),
                    getWallpaperInteractor(context),
                    getCurrentWallpaperInfoFactory(context),
                ) { intent ->
                    context.startActivity(intent)
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.customization.module.ThemePickerInjector
import com.android.customization.picker.clock.ui.binder.ClockSettingsBinder
import com.android.systemui.shared.clocks.shared.model.ClockPreviewConstants
import com.android.wallpaper.R
import com.android.wallpaper.module.CustomizationSections
import com.android.wallpaper.module.InjectorProvider
import com.android.wallpaper.picker.AppbarFragment
import com.android.wallpaper.picker.customization.ui.binder.ScreenPreviewBinder
@@ -106,9 +107,12 @@ class ClockSettingsFragment : AppbarFragment() {
                            )
                        }
                    },
                    wallpaperInteractor = injector.getWallpaperInteractor(requireContext()),
                    screen = CustomizationSections.Screen.LOCK_SCREEN,
                ),
            lifecycleOwner = this,
            offsetToStart = displayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(activity),
            onPreviewDirty = { activity.recreate() },
        )

        ClockSettingsBinder.bind(
+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.customization.model.mode.DarkModeSectionController
import com.android.customization.module.ThemePickerInjector
import com.android.customization.picker.color.ui.binder.ColorPickerBinder
import com.android.wallpaper.R
import com.android.wallpaper.module.CustomizationSections
import com.android.wallpaper.module.InjectorProvider
import com.android.wallpaper.picker.AppbarFragment
import com.android.wallpaper.picker.customization.ui.binder.ScreenPreviewBinder
@@ -103,10 +104,13 @@ class ColorPickerFragment : AppbarFragment() {
                    onWallpaperColorChanged = { colors ->
                        wcViewModel.setLockWallpaperColors(colors)
                    },
                    wallpaperInteractor = injector.getWallpaperInteractor(requireContext()),
                    screen = CustomizationSections.Screen.LOCK_SCREEN,
                ),
            lifecycleOwner = this,
            offsetToStart =
                displayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(requireActivity()),
            onPreviewDirty = { activity?.recreate() },
        )
        ScreenPreviewBinder.bind(
            activity = requireActivity(),
@@ -135,10 +139,13 @@ class ColorPickerFragment : AppbarFragment() {
                    onWallpaperColorChanged = { colors ->
                        wcViewModel.setLockWallpaperColors(colors)
                    },
                    wallpaperInteractor = injector.getWallpaperInteractor(requireContext()),
                    screen = CustomizationSections.Screen.HOME_SCREEN,
                ),
            lifecycleOwner = this,
            offsetToStart =
                displayUtils.isSingleDisplayOrUnfoldedHorizontalHinge(requireActivity()),
            onPreviewDirty = { activity?.recreate() },
        )
        val darkModeToggleContainerView: FrameLayout =
            view.requireViewById(R.id.dark_mode_toggle_container)
+2 −3
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ object KeyguardQuickAffordancePreviewBinder {
                lifecycleOwner = lifecycleOwner,
                offsetToStart = offsetToStart,
                dimWallpaper = true,
                onPreviewDirty = { activity.recreate() },
            )

        previewView.contentDescription =
@@ -62,9 +63,7 @@ object KeyguardQuickAffordancePreviewBinder {
                .collect { slotId ->
                    binding.sendMessage(
                        KeyguardPreviewConstants.MESSAGE_ID_SLOT_SELECTED,
                        Bundle().apply {
                            putString(KeyguardPreviewConstants.KEY_SLOT_ID, slotId)
                        },
                        Bundle().apply { putString(KeyguardPreviewConstants.KEY_SLOT_ID, slotId) },
                    )
                }
        }
Loading