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

Commit c395e58f authored by Chihhang Chuang's avatar Chihhang Chuang
Browse files

[2/n] Move new picker logic to AOSP

- Wallpaper section

Bug: 190354625
Test: Build and run the app
Change-Id: I2ac6e82abdd2b114d3da5688ff8ecf561032d05f
parent c21a3ffb
Loading
Loading
Loading
Loading

res/drawable/ic_nav_wallpaper.xml

deleted100644 → 0
+0 −25
Original line number Diff line number Diff line
<!--
     Copyright (C) 2019 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.
-->
<!-- Represents the wallpaper icon (a "landscape" shape in a box) -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M9,12.71l2.14,2.58l3,-3.87L18,16.57H6L9,12.71zM5,5h6V3H5C3.9,3 3,3.9 3,5v6h2V5zM19,19h-6v2h6c1.1,0 2,-0.9 2,-2v-6h-2V19zM5,19v-6H3v6c0,1.1 0.9,2 2,2h6v-2H5zM19,5v6h2V5c0,-1.1 -0.9,-2 -2,-2h-6v2H19zM16,9c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1c-0.55,0 -1,0.45 -1,1S15.45,9 16,9z"/>
</vector>
+0 −8
Original line number Diff line number Diff line
@@ -120,12 +120,4 @@
    <dimen name="theme_info_app_preview_icon_margin">2dp</dimen>
    <dimen name="theme_info_app_preview_icon_elevation">2dp</dimen>
    <dimen name="theme_info_text_size">28sp</dimen>

    <!-- Common dimensions for option sections -->
    <dimen name="section_container_vertical_margin">24dp</dimen>
    <dimen name="section_horizontal_padding">24dp</dimen>
    <dimen name="section_vertical_padding">24dp</dimen>
    <dimen name="section_top_padding">16dp</dimen>
    <dimen name="section_bottom_padding">16dp</dimen>

</resources>
+0 −60
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 android.os.Bundle;

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

import com.android.customization.picker.SectionView;

/**
 * The interface for the behavior of section in the Customization hub.
 *
 * @param <T> the {@link SectionView} to create for the section
 */
public interface HubSectionController<T extends SectionView> {

    /** Interface for Customization hub section navigation. */
    interface HubSectionNavigationController {
        /** Navigates to the given {@code fragment}. */
        void navigateTo(Fragment fragment);
    }

    /** Interface for Customization hub section's dark mode responding to battery saver. */
    interface HubSectionBatterySaverListener {
        /** Callback when battery saver's state changed with given {@code isEnabled}. */
        void onBatterySaverStateChanged(boolean isEnabled);
    }

    /** Returns {@code true} if the Customization hub section is available. */
    boolean isAvailable(@Nullable Context context);

    /**
     * Returns a newly created {@link SectionView} for the section.
     *
     * @param context the {@link Context} to inflate view
     */
    T createView(Context context);

    /** Saves the view state for configuration changes. */
    default void onSaveInstanceState(Bundle savedInstanceState) {}

    /** Releases the controller. */
    default void release() {}
}
+1 −1
Original line number Diff line number Diff line
@@ -24,10 +24,10 @@ import android.widget.TextView;
import androidx.annotation.Nullable;

import com.android.customization.model.CustomizationManager.OptionsFetchedListener;
import com.android.customization.model.HubSectionController;
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 java.util.List;

+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.content.Intent;
import android.os.PowerManager;
import android.text.TextUtils;

import com.android.customization.model.HubSectionController.HubSectionBatterySaverListener;
import com.android.wallpaper.model.HubSectionController.HubSectionBatterySaverListener;

/**
 * Broadcast receiver for getting battery saver state and callback to
Loading