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

Commit ea93e845 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7464903 from 4b187a5f to sc-release

Change-Id: I69927fd50c03c6391e802508c4a9043f030ab8b0
parents f2e281d6 4b187a5f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.customization.picker.mode.ModeSectionView
<com.android.customization.picker.mode.DarkModeSectionView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
@@ -41,4 +41,4 @@
        android:focusable="false"
        style="@style/Switch.SettingsLib" />

</com.android.customization.picker.mode.ModeSectionView>
</com.android.customization.picker.mode.DarkModeSectionView>
+0 −14
Original line number Diff line number Diff line
@@ -27,20 +27,6 @@ import java.util.List;
 */
public interface CustomizationManager<T extends CustomizationOption> {

    /**
     * Create a new {@link CustomizationSection} corresponding to this Manager
     */
    default CustomizationSection<T> createSection() {
        return null;
    }

    /**
     * @return the id in the navigation menu for the section this Manager manages.
     */
    default int getNavId() {
        return 0;
    };

    /**
     * Callback for applying a customization option.
     */
+0 −52
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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;

import android.content.Context;

import androidx.annotation.IdRes;
import androidx.fragment.app.Fragment;

/**
 * Represents a section of the Picker (eg "ThemeBundle", "Clock", etc).
 * There should be a concrete subclass per available section, providing the corresponding
 * Fragment to be displayed when switching to each section.
 * @param <T> CustomizationOption that this section represents.
 */
public abstract class CustomizationSection<T extends CustomizationOption> {

    /**
     * IdRes used to identify this section in the BottomNavigationView menu.
     */
    @IdRes
    public final int id;
    protected final CustomizationManager<T> mCustomizationManager;

    public CustomizationSection(@IdRes int id, CustomizationManager<T> manager) {
        this.id = id;
        mCustomizationManager = manager;
    }

    /**
     * @return the Fragment corresponding to this section.
     */
    public abstract Fragment getFragment(Context c);

    public CustomizationManager<T> getCustomizationManager() {
        return mCustomizationManager;
    }

}
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public class GridOptionsManager implements CustomizationManager<GridOption> {
    private final ThemesUserEventLogger mEventLogger;

    /** Returns the {@link GridOptionsManager} instance. */
    public static GridOptionsManager get(Context context) {
    public static GridOptionsManager getInstance(Context context) {
        if (sGridOptionsManager == null) {
            Context appContext = context.getApplicationContext();
            CustomizationInjector injector = (CustomizationInjector) InjectorProvider.getInjector();
+7 −7
Original line number Diff line number Diff line
@@ -27,22 +27,22 @@ import com.android.customization.model.CustomizationManager.OptionsFetchedListen
import com.android.customization.picker.grid.GridFragment;
import com.android.customization.picker.grid.GridSectionView;
import com.android.wallpaper.R;
import com.android.wallpaper.model.HubSectionController;
import com.android.wallpaper.model.CustomizationSectionController;

import java.util.List;

/** A {@link HubSectionController} for app grid. */
public class GridSectionController implements HubSectionController<GridSectionView> {
/** A {@link CustomizationSectionController} for app grid. */
public class GridSectionController implements CustomizationSectionController<GridSectionView> {

    private static final String TAG = "GridSectionController";

    private final GridOptionsManager mGridOptionsManager;
    private final HubSectionNavigationController mHubSectionNavigationController;
    private final CustomizationSectionNavigationController mSectionNavigationController;

    public GridSectionController(GridOptionsManager gridOptionsManager,
            HubSectionNavigationController hubSectionNavigationController) {
            CustomizationSectionNavigationController sectionNavigationController) {
        mGridOptionsManager = gridOptionsManager;
        mHubSectionNavigationController = hubSectionNavigationController;
        mSectionNavigationController = sectionNavigationController;
    }

    @Override
@@ -74,7 +74,7 @@ public class GridSectionController implements HubSectionController<GridSectionVi
            }
        }, /* reload= */ true);

        gridSectionView.setOnClickListener(v -> mHubSectionNavigationController.navigateTo(
        gridSectionView.setOnClickListener(v -> mSectionNavigationController.navigateTo(
                GridFragment.newInstance(context.getString(R.string.grid_title))));

        return gridSectionView;
Loading