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

Commit 0037dfe9 authored by Matías Hernández's avatar Matías Hernández Committed by Android (Google) Code Review
Browse files

Merge changes from topics "add-mode-dialog", "nicer-icon-header" into main

* changes:
  Icon picker: Styling improvements
  Add mode: Support for app-provided modes
parents c2c6c5d0 45f1e819
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2024 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:tint="?android:attr/colorControlNormal"
    android:viewportHeight="960"
    android:viewportWidth="960">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M620,440Q645,440 662.5,422.5Q680,405 680,380Q680,355 662.5,337.5Q645,320 620,320Q595,320 577.5,337.5Q560,355 560,380Q560,405 577.5,422.5Q595,440 620,440ZM340,440Q365,440 382.5,422.5Q400,405 400,380Q400,355 382.5,337.5Q365,320 340,320Q315,320 297.5,337.5Q280,355 280,380Q280,405 297.5,422.5Q315,440 340,440ZM480,700Q548,700 603.5,661.5Q659,623 684,560L618,560Q596,597 559.5,618.5Q523,640 480,640Q437,640 400.5,618.5Q364,597 342,560L276,560Q301,623 356.5,661.5Q412,700 480,700ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480ZM480,800Q614,800 707,707Q800,614 800,480Q800,346 707,253Q614,160 480,160Q346,160 253,253Q160,346 160,480Q160,614 253,707Q346,800 480,800Z" />
</vector>
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@

    <ImageView
        android:id="@+id/icon_image_view"
        android:layout_width="@dimen/zen_mode_icon_list_circle_diameter"
        android:layout_height="@dimen/zen_mode_icon_list_circle_diameter"
        android:layout_width="@dimen/zen_mode_icon_list_item_circle_diameter"
        android:layout_height="@dimen/zen_mode_icon_list_item_circle_diameter"
        android:importantForAccessibility="no"
        android:layout_gravity="center" />
</FrameLayout>
+4 −2
Original line number Diff line number Diff line
@@ -502,7 +502,9 @@
    <dimen name="audio_streams_qrcode_preview_radius">30dp</dimen>

    <!-- Zen Modes -->
    <dimen name="zen_mode_icon_list_header_circle_diameter">90dp</dimen>
    <dimen name="zen_mode_icon_list_header_icon_size">48dp</dimen>
    <dimen name="zen_mode_icon_list_item_size">96dp</dimen>
    <dimen name="zen_mode_icon_list_circle_diameter">56dp</dimen>
    <dimen name="zen_mode_icon_list_icon_size">32dp</dimen>
    <dimen name="zen_mode_icon_list_item_circle_diameter">56dp</dimen>
    <dimen name="zen_mode_icon_list_item_icon_size">32dp</dimen>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -8023,6 +8023,12 @@
    <!-- Priority Modes: Indicates that a mode is disabled by the user. [CHAR_LIMIT=40] -->
    <string name="zen_mode_disabled_by_user">Disabled</string>
    <!-- Priority Modes: Title of the "Create a mode" dialog, to choose the mode type. [CHAR_LIMIT=30] -->
    <string name="zen_mode_new_title">Create a mode</string>
    <!-- Priority Modes: Option to add a "custom" mode in the "Add a mode" dialog. [CHAR_LIMIT=20] -->
    <string name="zen_mode_new_option_custom">Custom</string>
    <!-- Subtitle for the Do not Disturb slice. [CHAR LIMIT=50]-->
    <string name="zen_mode_slice_subtitle">Limit interruptions</string>
+23 −10
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.notification.modes;

import static com.google.common.base.Preconditions.checkState;

import android.app.Flags;
import android.content.Context;
import android.service.notification.ZenPolicy;
@@ -30,8 +32,6 @@ import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.notification.modes.ZenMode;
import com.android.settingslib.notification.modes.ZenModesBackend;

import com.google.common.base.Preconditions;

import java.util.function.Function;

/**
@@ -41,8 +41,8 @@ abstract class AbstractZenModePreferenceController extends AbstractPreferenceCon

    private static final String TAG = "AbstractZenModePreferenceController";

    @Nullable
    protected ZenModesBackend mBackend;
    @Nullable protected final ZenModesBackend mBackend;


    @Nullable  // only until setZenMode() is called
    private ZenMode mZenMode;
@@ -50,14 +50,27 @@ abstract class AbstractZenModePreferenceController extends AbstractPreferenceCon
    @NonNull
    private final String mKey;

    // ZenModesBackend should only be passed in if the preference controller may set the user's
    // policy for this zen mode. Otherwise, if the preference controller is essentially read-only
    // and leads to a further Settings screen, backend should be null.
    /**
     * Constructor suitable for "read-only" controllers (e.g. link to a different sub-screen.
     * Controllers that call this constructor to initialize themselves <em>cannot</em> call
     * {@link #saveMode} or {@link #savePolicy} later.
     */
    AbstractZenModePreferenceController(@NonNull Context context, @NonNull String key) {
        super(context);
        mKey = key;
        mBackend = null;
    }

    /**
     * Constructor suitable for controllers that will update the associated {@link ZenMode}.
     * Controllers that call this constructor to initialize themselves may call {@link #saveMode} or
     * {@link #savePolicy} later.
     */
    AbstractZenModePreferenceController(@NonNull Context context, @NonNull String key,
            @Nullable ZenModesBackend backend) {
            @NonNull ZenModesBackend backend) {
        super(context);
        mBackend = backend;
        mKey = key;
        mBackend = backend;
    }

    @Override
@@ -135,7 +148,7 @@ abstract class AbstractZenModePreferenceController extends AbstractPreferenceCon
     *                instance is ok.
     */
    protected final boolean saveMode(Function<ZenMode, ZenMode> updater) {
        Preconditions.checkState(mBackend != null);
        checkState(mBackend != null);
        ZenMode mode = mZenMode;
        if (mode == null) {
            Log.wtf(TAG, "Cannot save mode, it hasn't been loaded (" + getClass() + ")");
Loading