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

Commit 02263779 authored by Catherine Liang's avatar Catherine Liang Committed by Android (Google) Code Review
Browse files

Merge "Color Picker Fragment Dark Mode Toggle (1/2)" into tm-qpr-dev

parents d109d5e4 0cd4076e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -60,8 +60,7 @@
        android:layout_marginHorizontal="24dp"
        android:layout_marginBottom="28dp"
        android:background="@drawable/picker_fragment_background"
        android:paddingTop="22dp"
        android:paddingBottom="62dp">
        android:paddingTop="22dp">

        <FrameLayout
            android:layout_width="match_parent"
@@ -124,6 +123,11 @@

        </FrameLayout>

        <FrameLayout
            android:id="@+id/dark_mode_toggle_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </LinearLayout>

</LinearLayout>
+0 −6
Original line number Diff line number Diff line
@@ -174,12 +174,6 @@ public final class DefaultCustomizationSections implements CustomizationSections
                break;

            case HOME_SCREEN:
                // Dark/Light theme section.
                sectionControllers.add(new DarkModeSectionController(
                        activity,
                        lifecycleOwner.getLifecycle(),
                        mDarkModeSnapshotRestorer));

                // Themed app icon section.
                sectionControllers.add(
                        new ThemedIconSectionController(
+1 −1
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ open class ThemePickerInjector : WallpaperPicker2Injector(), CustomizationInject
                .also { colorPickerViewModelFactory = it }
    }

    protected fun getDarkModeSnapshotRestorer(
    fun getDarkModeSnapshotRestorer(
        context: Context,
    ): DarkModeSnapshotRestorer {
        return darkModeSnapshotRestorer
+13 −0
Original line number Diff line number Diff line
@@ -19,9 +19,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.cardview.widget.CardView
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.get
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
@@ -137,6 +139,17 @@ class ColorPickerFragment : AppbarFragment() {
            lifecycleOwner = this,
            offsetToStart = displayUtils.isOnWallpaperDisplay(requireActivity()),
        )
        val darkModeToggleContainerView: FrameLayout =
            view.requireViewById(R.id.dark_mode_toggle_container)
        val darkModeSectionView =
            DarkModeSectionController(
                    context,
                    lifecycle,
                    injector.getDarkModeSnapshotRestorer(requireContext())
                )
                .createView(requireContext())
        darkModeSectionView.background = null
        darkModeToggleContainerView.addView(darkModeSectionView)
        return view
    }