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

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

Merge "Clean up pre-revamped UI sections (2/3)" into udc-qpr-dev

parents e843d48a 77d598d0
Loading
Loading
Loading
Loading

res/layout/color_section_view.xml

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2022 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.customization.picker.color.ColorSectionView
    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:orientation="vertical">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingHorizontal="@dimen/separated_tabs_horizontal_padding">
        <include layout="@layout/separated_tabs" />
    </FrameLayout>

    <androidx.viewpager2.widget.ViewPager2
        android:id="@+id/color_section_view_pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/color_options_container_top_margin"
        android:clipChildren="false"
        android:clipToPadding="false"/>
</com.android.customization.picker.color.ColorSectionView>
+0 −538

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −57
Original line number Diff line number Diff line
@@ -8,10 +8,8 @@ import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;

import com.android.customization.model.color.ColorSectionController;
import com.android.customization.model.grid.GridOptionsManager;
import com.android.customization.model.grid.GridSectionController;
import com.android.customization.model.mode.DarkModeSectionController;
import com.android.customization.model.mode.DarkModeSnapshotRestorer;
import com.android.customization.model.themedicon.ThemedIconSectionController;
import com.android.customization.model.themedicon.ThemedIconSwitchProvider;
@@ -36,7 +34,6 @@ import com.android.wallpaper.model.CustomizationSectionController.CustomizationS
import com.android.wallpaper.model.PermissionRequester;
import com.android.wallpaper.model.WallpaperColorsViewModel;
import com.android.wallpaper.model.WallpaperPreviewNavigator;
import com.android.wallpaper.model.WallpaperSectionController;
import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
import com.android.wallpaper.module.CustomizationSections;
import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor;
@@ -92,7 +89,7 @@ public final class DefaultCustomizationSections implements CustomizationSections
    }

    @Override
    public List<CustomizationSectionController<?>> getRevampedUISectionControllersForScreen(
    public List<CustomizationSectionController<?>> getSectionControllersForScreen(
            Screen screen,
            FragmentActivity activity,
            LifecycleOwner lifecycleOwner,
@@ -210,57 +207,4 @@ public final class DefaultCustomizationSections implements CustomizationSections

        return sectionControllers;
    }

    @Override
    public List<CustomizationSectionController<?>> getAllSectionControllers(
            FragmentActivity activity,
            LifecycleOwner lifecycleOwner,
            WallpaperColorsViewModel wallpaperColorsViewModel,
            PermissionRequester permissionRequester,
            WallpaperPreviewNavigator wallpaperPreviewNavigator,
            CustomizationSectionNavigationController sectionNavigationController,
            @Nullable Bundle savedInstanceState,
            DisplayUtils displayUtils) {
        List<CustomizationSectionController<?>> sectionControllers = new ArrayList<>();

        // Wallpaper section.
        sectionControllers.add(
                new WallpaperSectionController(
                activity,
                lifecycleOwner,
                permissionRequester,
                wallpaperColorsViewModel,
                mThemedIconInteractor.isActivatedAsLiveData(),
                sectionNavigationController,
                wallpaperPreviewNavigator,
                savedInstanceState,
                displayUtils));

        // Theme color section.
        sectionControllers.add(new ColorSectionController(
                activity, wallpaperColorsViewModel, lifecycleOwner, savedInstanceState));

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

        // Themed app icon section.
        sectionControllers.add(new ThemedIconSectionController(
                ThemedIconSwitchProvider.getInstance(activity),
                mThemedIconInteractor,
                savedInstanceState,
                mThemedIconSnapshotRestorer));

        // App grid section.
        sectionControllers.add(
                new GridSectionController(
                        GridOptionsManager.getInstance(activity),
                        sectionNavigationController,
                        lifecycleOwner,
                        /* isRevampedUiEnabled= */ false));

        return sectionControllers;
    }
}
+0 −33
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.customization.picker.color;

import android.content.Context;
import android.util.AttributeSet;

import androidx.annotation.Nullable;

import com.android.wallpaper.picker.SectionView;

/**
 * The class inherits from {@link SectionView} as the view representing the color section of the
 * customization picker.
 */
public final class ColorSectionView extends SectionView {
    public ColorSectionView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }
}
+0 −64
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.customization.model.color;

import static com.google.common.truth.Truth.assertThat;

import androidx.appcompat.app.AppCompatActivity;

import com.android.wallpaper.model.WallpaperColorsViewModel;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

/**
 * Tests of {@link ColorSectionController}.
 */
@Ignore("b/290798811")
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public final class ColorSectionControllerTest {

    private AppCompatActivity mActivity;
    private ColorSectionController mColorSectionController;

    /**
     * Set up the test case.
     */
    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        mActivity = Robolectric.buildActivity(AppCompatActivity.class).create().get();
        mColorSectionController = new ColorSectionController(mActivity,
                new WallpaperColorsViewModel(), mActivity, null);
    }

    /**
     * isAvailable()'s test.
     */
    @Test
    @Config(manifest = Config.NONE)
    public void isAvailable_nullContext_shouldReturnFalse() {
        assertThat(mColorSectionController.isAvailable(/* context= */ null)).isFalse();
    }
}