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

Commit 574fcaf1 authored by Matías Hernández's avatar Matías Hernández
Browse files

Add mode: Choose name and icon for new custom modes

This also unifies the "icon picker" screen with the new "add mode" screen since in both cases we want to edit name and icon together (and not save updates until the user confirms).

Bug: 326442408
Bug: 346278854
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I8a9d07ba0b6c55f3abc1b9884f278d51d178dc83
parent 0037dfe9
Loading
Loading
Loading
Loading
+32 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <Button
        android:id="@+id/done"
        android:text="@string/done"
        style="@style/ActionPrimaryButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layout_marginEnd="20dp"
        />
</FrameLayout>
 No newline at end of file
+35 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@android:id/edit"
        android:maxLines="1"
        android:inputType="text|textCapSentences"
        android:imeOptions="actionDone"
        android:selectAllOnFocus="true"
        android:hint="@string/zen_mode_edit_name_hint" />

</LinearLayout>
 No newline at end of file
+12 −0
Original line number Original line Diff line number Diff line
@@ -9451,6 +9451,18 @@
    <!-- [CHAR LIMIT=40] Zen mode settings: Title for the "choose mode icon" screen -->
    <!-- [CHAR LIMIT=40] Zen mode settings: Title for the "choose mode icon" screen -->
    <string name="zen_mode_icon_picker_title">Change icon</string>
    <string name="zen_mode_icon_picker_title">Change icon</string>
    <!-- Priority Modes: Title for the "rename mode" screen [CHAR LIMIT=20] -->
    <string name="zen_mode_rename_title">Rename</string>
    <!-- Priority Modes: Title for the "add mode" screen [CHAR LIMIT=20] -->
    <string name="zen_mode_new_custom_title">Add mode</string>
    <!-- Priority Modes: Default name for new custom modes [CHAR LIMIT=30] -->
    <string name="zen_mode_new_custom_default_name">Custom mode</string>
    <!-- Priority Modes: Hint for the EditText for editing a mode's name [CHAR LIMIT=30] -->
    <string name="zen_mode_edit_name_hint">Mode name</string>
    <!-- Content description for help icon button [CHAR LIMIT=20] -->
    <!-- Content description for help icon button [CHAR LIMIT=20] -->
    <string name="warning_button_text">Warning</string>
    <string name="warning_button_text">Warning</string>
+13 −3
Original line number Original line Diff line number Diff line
@@ -18,20 +18,30 @@
<PreferenceScreen
<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="zen_mode_icon_picker_page"
    android:key="zen_mode_edit_name_icon"
    settings:searchable="false"
    settings:searchable="false"
    android:title="@string/zen_mode_icon_picker_title">
    android:title="@string/zen_mode_rename_title">


    <com.android.settingslib.widget.LayoutPreference
    <com.android.settingslib.widget.LayoutPreference
        android:key="current_icon"
        android:key="chosen_icon"
        android:layout="@layout/settings_entity_header" />
        android:layout="@layout/settings_entity_header" />


    <com.android.settings.applications.SpacePreference
    <com.android.settings.applications.SpacePreference
        android:layout_height="16dp" />
        android:layout_height="16dp" />


    <com.android.settingslib.widget.LayoutPreference
        android:key="name"
        android:layout="@layout/modes_edit_name" />

    <com.android.settings.applications.SpacePreference
        android:layout_height="32dp" />

    <com.android.settingslib.widget.LayoutPreference
    <com.android.settingslib.widget.LayoutPreference
        android:key="icon_list"
        android:key="icon_list"
        android:selectable="false"
        android:selectable="false"
        android:layout="@layout/modes_icon_list"/>
        android:layout="@layout/modes_icon_list"/>


    <com.android.settingslib.widget.LayoutPreference
        android:key="done"
        android:layout="@layout/modes_edit_done_button" />
</PreferenceScreen>
</PreferenceScreen>
+1 −1
Original line number Original line Diff line number Diff line
@@ -51,7 +51,7 @@ class ZenModeActionsPreferenceController extends AbstractZenModePreferenceContro
            Bundle bundle = new Bundle();
            Bundle bundle = new Bundle();
            bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
            bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
            new SubSettingLauncher(mContext)
            new SubSettingLauncher(mContext)
                    .setDestination(ZenModeIconPickerFragment.class.getName())
                    .setDestination(ZenModeEditNameIconFragment.class.getName())
                    // TODO: b/332937635 - Update metrics category
                    // TODO: b/332937635 - Update metrics category
                    .setSourceMetricsCategory(0)
                    .setSourceMetricsCategory(0)
                    .setArguments(bundle)
                    .setArguments(bundle)
Loading