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

Commit a81df0d3 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

Connected sections for wallpaper and colors (2/3).

This is a side-by-side layout for the color and wallpaper quick switcher sections on the main/landing screen of wallpaper picker.

Bug: 265837104
Test: manually verified layout on large screens in landscape and
portrait mode, hand-helds in portrait mode - both with left-to-right
(English) and right-to-left (Hebrew) setups

Change-Id: I5e03344ba8a365803e4df3a031ce0ec1f2f1b862
parent d8306ea8
Loading
Loading
Loading
Loading
+22 −28
Original line number Diff line number Diff line
@@ -16,18 +16,13 @@
-->
<com.android.customization.picker.color.ColorSectionView2
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/section_bottom_padding"
    android:paddingHorizontal="@dimen/section_horizontal_padding"
    android:orientation="vertical">

    <LinearLayout
    android:id="@+id/color_section_option_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/section_bottom_padding"
    android:layout_marginHorizontal="@dimen/section_horizontal_padding"
    android:orientation="horizontal"
        android:background="@drawable/color_section_background"
    android:background="@drawable/top_connected_section_background"
    android:paddingVertical="24dp"
    android:paddingHorizontal="24dp"
    android:weightSum="@integer/color_section_num_columns">
@@ -47,5 +42,4 @@
        layout="@layout/color_option_section_overflow"
        android:visibility="invisible"
        android:layout_weight="1"/>
    </LinearLayout>
</com.android.customization.picker.color.ColorSectionView2>
+15 −10
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.wallpaper.model.WallpaperSectionController;
import com.android.wallpaper.model.WorkspaceViewModel;
import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
import com.android.wallpaper.module.CustomizationSections;
import com.android.wallpaper.picker.customization.ui.section.ConnectedSectionController;
import com.android.wallpaper.picker.customization.ui.section.ScreenPreviewSectionController;
import com.android.wallpaper.picker.customization.ui.section.WallpaperQuickSwitchSectionController;
import com.android.wallpaper.picker.customization.ui.viewmodel.WallpaperQuickSwitchViewModel;
@@ -82,17 +83,21 @@ public final class DefaultCustomizationSections implements CustomizationSections
                        wallpaperColorsViewModel,
                        displayUtils));

        sectionControllers.add(
                new ConnectedSectionController(
                        // Theme color section.
        sectionControllers.add(new ColorSectionController2(
                activity, wallpaperColorsViewModel, lifecycleOwner, sectionNavigationController));

                        new ColorSectionController2(
                                activity,
                                wallpaperColorsViewModel,
                                lifecycleOwner,
                                sectionNavigationController),
                        // Wallpaper quick switch section.
        sectionControllers.add(
                        new WallpaperQuickSwitchSectionController(
                                screen,
                                wallpaperQuickSwitchViewModel,
                                lifecycleOwner,
                        sectionNavigationController));
                                sectionNavigationController),
                        /* reverseOrderWhenHorizontal= */ true));

        switch (screen) {
            case LOCK_SCREEN:
+2 −2
Original line number Diff line number Diff line
@@ -39,9 +39,9 @@ class ClockSectionController(
    private val lifecycleOwner: LifecycleOwner,
    private val flag: BaseFlags,
    private val clockRegistryProvider: ClockRegistryProvider,
) : CustomizationSectionController<ClockSectionView?> {
) : CustomizationSectionController<ClockSectionView> {

    override fun isAvailable(context: Context?): Boolean {
    override fun isAvailable(context: Context): Boolean {
        return flag.isCustomClocksEnabled(context!!)
    }

+2 −2
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@ class NotificationSectionController(
    private val lifecycleOwner: LifecycleOwner,
) : CustomizationSectionController<NotificationSectionView> {

    override fun isAvailable(context: Context?): Boolean {
    override fun isAvailable(context: Context): Boolean {
        return true
    }

    @SuppressLint("InflateParams") // We don't care that the parent is null.
    override fun createView(context: Context?): NotificationSectionView {
    override fun createView(context: Context): NotificationSectionView {
        val view =
            LayoutInflater.from(context)
                .inflate(
Loading