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

Commit b9f38af6 authored by Beverly's avatar Beverly
Browse files

Add custom dnd pages for each dnd auto rule

- Fix strings
- Add zen custom settings dialog when custom settings are being applied
Test: make RunSettingsRoboTests -j40
Bug: 111475013
Fixes: 120787133
Fixes: 120796642
Fixes: 120865472
Change-Id: I34d6b4b23d36277e3704416d65e2418418c124e1
parent f30fb4b2
Loading
Loading
Loading
Loading
+171 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fadeScrollbars="false"
            android:scrollIndicators="top|bottom">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingStart="24dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_calls"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_calls" />

            <TextView
                android:id="@+id/zen_custom_settings_dialog_calls_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_messages"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_messages" />

            <TextView
                android:id="@+id/zen_custom_settings_dialog_messages_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_alarms"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_alarms" />

            <TextView
                android:id="@+id/zen_custom_settings_dialog_alarms_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_media"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_media" />

            <TextView
                android:id="@+id/zen_custom_settings_dialog_media_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_system"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_system" />

            <TextView
                android:id="@+id/zen_custom_settings_dialog_system_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_reminders"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_reminders"/>

            <TextView
                android:id="@+id/zen_custom_settings_dialog_reminders_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_events"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_mode_events"/>

            <TextView
                android:id="@+id/zen_custom_settings_dialog_events_allow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="14dp">
            <TextView
                android:id="@+id/zen_custom_settings_dialog_notifications"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/zen_custom_settings_notifications_header" />

            <TextView
                android:id="@+id/zen_custom_settings_dialog_show_notifications"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceListItem" />
        </LinearLayout>
    </LinearLayout>
</ScrollView>
 No newline at end of file
+2 −2
Original line number Original line Diff line number Diff line
@@ -1081,14 +1081,14 @@
        <item>@string/zen_mode_from_anyone</item>
        <item>@string/zen_mode_from_anyone</item>
        <item>@string/zen_mode_from_contacts</item>
        <item>@string/zen_mode_from_contacts</item>
        <item>@string/zen_mode_from_starred</item>
        <item>@string/zen_mode_from_starred</item>
        <item>@string/zen_mode_from_none_calls</item>
        <item>@string/zen_mode_from_none_messages</item>
    </string-array>
    </string-array>


    <string-array name="zen_mode_contacts_calls_entries" translatable="false">
    <string-array name="zen_mode_contacts_calls_entries" translatable="false">
        <item>@string/zen_mode_from_anyone</item>
        <item>@string/zen_mode_from_anyone</item>
        <item>@string/zen_mode_from_contacts</item>
        <item>@string/zen_mode_from_contacts</item>
        <item>@string/zen_mode_from_starred</item>
        <item>@string/zen_mode_from_starred</item>
        <item>@string/zen_mode_from_none_messages</item>
        <item>@string/zen_mode_from_none_calls</item>
    </string-array>
    </string-array>


    <string-array name="zen_mode_contacts_values" translatable="false">
    <string-array name="zen_mode_contacts_values" translatable="false">
+29 −6
Original line number Original line Diff line number Diff line
@@ -7328,8 +7328,8 @@
    <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing length of DND -->
    <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing length of DND -->
    <string name="zen_mode_settings_dnd_manual_indefinite">Do Not Disturb will stay on until you turn it off</string>
    <string name="zen_mode_settings_dnd_manual_indefinite">Do Not Disturb will stay on until you turn it off</string>
    <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing how DND was triggered by an automatic DND rule -->
    <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer showing how DND was triggered by an automatic DND schedule -->
    <string name="zen_mode_settings_dnd_automatic_rule">Do Not Disturb was automatically turned on by a rule (<xliff:g id="rule_name" example="Weeknights">%s</xliff:g>)</string>
    <string name="zen_mode_settings_dnd_automatic_rule">Do Not Disturb was automatically turned on by a schedule (<xliff:g id="rule_name" example="Weeknights">%s</xliff:g>)</string>
    <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer how DND was triggered by an app -->
    <!-- [CHAR LIMIT=110] Zen mode settings footer: Footer how DND was triggered by an app -->
    <string name="zen_mode_settings_dnd_automatic_rule_app">Do Not Disturb was automatically turned on by an app (<xliff:g id="app_name" example="Android Services">%s</xliff:g>)</string>
    <string name="zen_mode_settings_dnd_automatic_rule_app">Do Not Disturb was automatically turned on by an app (<xliff:g id="app_name" example="Android Services">%s</xliff:g>)</string>
@@ -7337,6 +7337,9 @@
    <!-- [CHAR LIMIT=120] Zen mode settings footer: Footer informing user DND has custom settings. -->
    <!-- [CHAR LIMIT=120] Zen mode settings footer: Footer informing user DND has custom settings. -->
    <string name="zen_mode_settings_dnd_custom_settings_footer">Do Not Disturb is on for <xliff:g id="rule_names" example="Sleeping and Work">%s</xliff:g> with custom settings.</string>
    <string name="zen_mode_settings_dnd_custom_settings_footer">Do Not Disturb is on for <xliff:g id="rule_names" example="Sleeping and Work">%s</xliff:g> with custom settings.</string>
    <!-- [CHAR LIMIT=120] Zen mode settings footer: Link following zen_mode_settings_dnd_custom_settings_footer to see the currently applied custom dnd settings. -->
    <string name="zen_mode_settings_dnd_custom_settings_footer_link"><annotation id="link"> View custom settings</annotation></string>
    <!--[CHAR LIMIT=40] Zen Interruption level: Priority.  -->
    <!--[CHAR LIMIT=40] Zen Interruption level: Priority.  -->
    <string name="zen_interruption_level_priority">Priority only</string>
    <string name="zen_interruption_level_priority">Priority only</string>
@@ -7400,6 +7403,17 @@
    <!-- Do not disturb settings, sound and vibrations summary [CHAR LIMIT=100]-->
    <!-- Do not disturb settings, sound and vibrations summary [CHAR LIMIT=100]-->
    <string name="zen_sound_three_allowed">Muted, but allow <xliff:g id="sound_type" example="alarms">%1$s</xliff:g>, <xliff:g id="sound_type" example="alarms">%2$s</xliff:g>, and <xliff:g id="sound_type" example="media">%3$s</xliff:g></string>
    <string name="zen_sound_three_allowed">Muted, but allow <xliff:g id="sound_type" example="alarms">%1$s</xliff:g>, <xliff:g id="sound_type" example="alarms">%2$s</xliff:g>, and <xliff:g id="sound_type" example="media">%3$s</xliff:g></string>
    <!-- Do not disturb custom settings dialog title [CHAR LIMIT=40]-->
    <string name="zen_custom_settings_dialog_title">Custom settings</string>
    <!-- Do not disturb custom settings dialog button label [CHAR LIMIT=40]-->
    <string name="zen_custom_settings_dialog_review_schedule">Review schedule</string>
    <!-- Do not disturb custom settings dialog button label [CHAR LIMIT=40]-->
    <string name="zen_custom_settings_dialog_ok">Got it</string>
    <!-- Do not disturb custom settings notifications header [CHAR LIMIT=40]-->
    <string name="zen_custom_settings_notifications_header">Notifications</string>
    <!-- Do not disturb custom settings duration header [CHAR LIMIT=40]-->
    <string name="zen_custom_settings_duration_header">Duration</string>
    <!-- Do not disturb settings, messages, events and reminders title [CHAR LIMIT=100]-->
    <!-- Do not disturb settings, messages, events and reminders title [CHAR LIMIT=100]-->
    <string name="zen_msg_event_reminder_title">Messages, events &amp; reminders</string>
    <string name="zen_msg_event_reminder_title">Messages, events &amp; reminders</string>
    <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
    <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
@@ -7941,6 +7955,9 @@
    <!-- [CHAR LIMIT=120] Zen mode settings: Summay text indicating the currenty dnd schedule is using custom behavior -->
    <!-- [CHAR LIMIT=120] Zen mode settings: Summay text indicating the currenty dnd schedule is using custom behavior -->
    <string name="zen_mode_custom_behavior_summary">Create custom settings for this schedule</string>
    <string name="zen_mode_custom_behavior_summary">Create custom settings for this schedule</string>
    <!-- [CHAR LIMIT=100] Zen mode settings: Category text indicating the schedule this custom behavior will be configured for-->
    <string name="zen_mode_custom_behavior_category_title">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019</string>
    <!-- [CHAR LIMIT=40] General divider text when concatenating multiple items in a text summary -->
    <!-- [CHAR LIMIT=40] General divider text when concatenating multiple items in a text summary -->
    <string name="summary_divider_text">,\u0020</string>
    <string name="summary_divider_text">,\u0020</string>
@@ -7956,9 +7973,12 @@
    <!-- [CHAR LIMIT=40] Zen mode settings: Allow calls toggle title -->
    <!-- [CHAR LIMIT=40] Zen mode settings: Allow calls toggle title -->
    <string name="zen_mode_calls_title">Calls</string>
    <string name="zen_mode_calls_title">Calls</string>
    <!-- [CHAR LIMIT=20] Zen mode settings: Calls screen footer -->
    <!-- [CHAR LIMIT=NONE] Zen mode settings: Calls screen footer -->
    <string name="zen_mode_calls_footer">When Do Not Disturb is on, incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
    <string name="zen_mode_calls_footer">When Do Not Disturb is on, incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
    <!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Calls screen footer -->
    <string name="zen_mode_custom_calls_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming calls are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
    <!-- [CHAR LIMIT=50] Zen mode settings: Starred contacts preference title -->
    <!-- [CHAR LIMIT=50] Zen mode settings: Starred contacts preference title -->
    <string name="zen_mode_starred_contacts_title">Starred contacts</string>
    <string name="zen_mode_starred_contacts_title">Starred contacts</string>
@@ -7974,6 +7994,9 @@
    <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
    <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
    <string name="zen_mode_messages_footer">When Do Not Disturb is on, incoming text messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
    <string name="zen_mode_messages_footer">When Do Not Disturb is on, incoming text messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
    <!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Messages screen footer -->
    <string name="zen_mode_custom_messages_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming text messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
    <!-- [CHAR LIMIT=40] Zen mode settings: Allow messages to bypass DND title -->
    <!-- [CHAR LIMIT=40] Zen mode settings: Allow messages to bypass DND title -->
    <string name="zen_mode_messages_title">Text messages</string>
    <string name="zen_mode_messages_title">Text messages</string>
@@ -8037,11 +8060,11 @@
    <!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND title-->
    <!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND title-->
    <string name="zen_mode_bypassing_apps_title">App exceptions</string>
    <string name="zen_mode_bypassing_apps_title">App exceptions</string>
    <!-- [CHAR LIMIT=80] Zen mode settings: Allow apps to bypass DND -->
    <!-- [CHAR LIMIT=120] Zen mode settings: Allow apps to bypass DND -->
    <plurals name="zen_mode_bypassing_apps_subtext">
    <plurals name="zen_mode_bypassing_apps_subtext">
        <item quantity="zero">No apps can override Do Not Disturb</item>
        <item quantity="zero">No apps can override Do Not Disturb</item>
        <item quantity="one">1 app can override Do Not Disturb</item>
        <item quantity="one">Notifications from 1 app can override Do Not Disturb</item>
        <item quantity="other"><xliff:g id="number" example="2">%1$d</xliff:g> apps can override Do Not Disturb</item>
        <item quantity="other">Notifications from <xliff:g id="number" example="2">%1$d</xliff:g> apps can override Do Not Disturb</item>
    </plurals>
    </plurals>
    <!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) -->
    <!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) -->
+66 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018 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.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="zen_custom_rule_configuration_page"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/zen_mode_settings_title">

    <PreferenceCategory
        android:key="zen_custom_rule_configuration_category">
        <!-- Calls -->
        <Preference
            android:key="zen_rule_calls_settings"
            android:title="@string/zen_mode_calls" />

        <!-- Messages -->
        <Preference
            android:key="zen_rule_messages_settings"
            android:title="@string/zen_mode_messages" />

        <!-- Alarms -->
        <SwitchPreference
            android:key="zen_rule_alarms"
            android:title="@string/zen_mode_alarms"/>

        <!-- Media -->
        <SwitchPreference
            android:key="zen_rule_media"
            android:title="@string/zen_mode_media"/>

        <!-- System -->
        <SwitchPreference
            android:key="zen_rule_system"
            android:title="@string/zen_mode_system"/>

        <!-- Reminders -->
        <SwitchPreference
            android:key="zen_rule_reminders"
            android:title="@string/zen_mode_reminders"/>

        <!-- Events -->
        <SwitchPreference
            android:key="zen_rule_events"
            android:title="@string/zen_mode_events"/>
    </PreferenceCategory>

    <Preference
        android:key="zen_rule_notifications"
        android:title="@string/zen_mode_restrict_notifications_title"
        settings:allowDividerAbove="true"/>
</PreferenceScreen>
+34 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018 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.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="zen_custom_rule_settings_page"
    android:title="@string/zen_mode_custom_behavior_title">

    <PreferenceCategory
        android:key="zen_custom_rule_category">
        <com.android.settings.notification.ZenCustomRadioButtonPreference
            android:key="zen_custom_rule_setting_default"
            android:title="@string/zen_mode_custom_behavior_summary_default"/>

        <com.android.settings.notification.ZenCustomRadioButtonPreference
            android:key="zen_custom_rule_setting"
            android:title="@string/zen_mode_custom_behavior_summary" />
    </PreferenceCategory>

</PreferenceScreen>
Loading