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

Commit c96a5dcb authored by John Spurlock's avatar John Spurlock
Browse files

Settings: External automatic rule settings.

 - Add external automatic rule settings page with the common
   settings for all rules (enabled, name, zen mode).
 - Pull common rule-instance settings into settings base class, share
   with existing schedule rule settings.
 - New page not searchable since it is at the rule-instance level.
 - Obtain external rule information from existing conditions provider
   metadata.  Includes rule type caption, sub-configuration activity,
   and default condition id.
 - If external condition providers exist with the appropriate metadata,
   display the external rule types as options in the new rule dialog.
   (max of 3 external types)
 - Pull common managed service listing code out of common settings base
   class and into a more reusable helper class.

Bug: 20064962
Change-Id: Ibc13607490b7312a7d9f7f3bd61c3cfcf71a2794
parent 3b1a4c6c
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -696,6 +696,10 @@
                <action android:name="android.settings.ZEN_MODE_AUTOMATION_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter android:priority="1">
                <action android:name="android.settings.ACTION_CONDITION_PROVIDER_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
@@ -729,6 +733,26 @@
                android:value="true" />
        </activity>

        <activity android:name="Settings$ZenModeExternalRuleSettingsActivity"
                android:exported="true"
                android:taskAffinity="">
            <intent-filter android:priority="1">
                <action android:name="android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="com.android.settings.SHORTCUT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.notification.ZenModeExternalRuleSettings" />
            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
                android:resource="@id/notification_settings" />
            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                android:value="true" />
        </activity>

        <activity android:name="Settings$HomeSettingsActivity"
                android:label="@string/home_settings"
                android:taskAffinity="">
+33 −2
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

@@ -29,4 +30,34 @@

    </EditText>

</FrameLayout>
    <RadioGroup
        android:id="@+id/rule_types"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="22dp"
        android:layout_marginRight="22dp"
        android:layout_marginTop="16dp"
        android:orientation="vertical"
        android:checkedButton="@+id/rule_type_schedule" >

        <RadioButton android:id="@+id/rule_type_schedule"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/zen_schedule_rule_type_name" />

        <RadioButton android:id="@+id/rule_type_2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <RadioButton android:id="@+id/rule_type_3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <RadioButton android:id="@+id/rule_type_4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </RadioGroup>

</LinearLayout>
+13 −1
Original line number Diff line number Diff line
@@ -5908,11 +5908,23 @@
    <!-- [CHAR LIMIT=40] Zen mode settings: Delete rule dialog button caption -->
    <string name="zen_mode_delete_rule_button">Delete</string>

    <!-- [CHAR LIMIT=40] Zen mode settings: External rule type -->
    <string name="zen_mode_rule_type">Rule type</string>

    <!-- [CHAR LIMIT=40] Zen mode settings: External rule type name if unknown -->
    <string name="zen_mode_rule_type_unknown">Unknown</string>

    <!-- [CHAR LIMIT=40] Zen mode settings: Configure external rule -->
    <string name="zen_mode_configure_rule">Configure rule</string>

    <!-- [CHAR LIMIT=40] Zen mode settings: Schedule rule type name -->
    <string name="zen_schedule_rule_type_name">Schedule rule</string>

    <!-- [CHAR LIMIT=40] Zen mode settings: Text to display if rule isn't found  -->
    <string name="zen_mode_rule_not_found_text">Rule not found.</string>

    <!-- [CHAR LIMIT=40] Zen mode settings: Rule summary template (when enabled)  -->
    <string name="zen_mode_rule_summary_template"><xliff:g id="days" example="Sun - Thu">%1$s</xliff:g> / <xliff:g id="timerange" example="10:00 PM to 7:30 AM">%2$s</xliff:g> / <xliff:g id="mode" example="Alarms only">%3$s</xliff:g></string>
    <string name="zen_mode_rule_summary_combination"><xliff:g id="description" example="Sun - Thu">%1$s</xliff:g> / <xliff:g id="mode" example="Alarms only">%2$s</xliff:g></string>

    <!-- [CHAR LIMIT=40] Zen mode settings: Timebased rule days option title -->
    <string name="zen_mode_schedule_rule_days">Days</string>
+45 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2015 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_mode_external_rule_settings" >

    <!-- Rule name -->
    <Preference
        android:key="rule_name"
        android:title="@string/zen_mode_rule_name"
        android:persistent="false" />

    <!-- Rule type -->
    <Preference
        android:key="type"
        android:title="@string/zen_mode_rule_type"
        android:persistent="false" />

    <!-- Configure -->
    <Preference
        android:key="configure"
        android:title="@string/zen_mode_configure_rule"
        android:persistent="false" />

    <!-- Zen mode -->
    <com.android.settings.DropDownPreference
        android:key="zen_mode"
        android:title="@string/zen_mode_settings_title"
        android:persistent="false" />

</PreferenceScreen>
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ public class Settings extends SettingsActivity {
    public static class ZenModePrioritySettingsActivity extends SettingsActivity { /* empty */ }
    public static class ZenModeAutomationSettingsActivity extends SettingsActivity { /* empty */ }
    public static class ZenModeScheduleRuleSettingsActivity extends SettingsActivity { /* empty */ }
    public static class ZenModeExternalRuleSettingsActivity extends SettingsActivity { /* empty */ }
    public static class NotificationSettingsActivity extends SettingsActivity { /* empty */ }
    public static class NotificationAppListActivity extends SettingsActivity { /* empty */ }
    public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
Loading