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

Commit 6fc08e6a authored by DvTonder's avatar DvTonder Committed by Gerrit Code Review
Browse files

Settings: Allow/Prevent notification light in Zen mode (2 of 2)

This allows the user to prevent the notification lights from showing during Zen mode as per Android 5.0.x

Change-Id: Ia3563d79f5c1fc012411496c7b8901099a78282e
parent 1d6bc068
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1158,6 +1158,7 @@
    <string name="interruptions_ignore_while_media_summary">Do not reduce media playback volume when a notification arrives</string>
    <string name="none_is_silent_title">None is Silent mode</string>
    <string name="none_is_silent_summary">Silent mode always sounds alarms</string>
    <string name="allow_lights_title">Allow notification lights</string>

    <!-- LiveDisplay -->
    <string name="live_display_title" translatable="false">LiveDisplay</string>
+10 −0
Original line number Diff line number Diff line
@@ -100,6 +100,16 @@
                android:title="@string/zen_mode_downtime_mode_title"
                android:order="100"
                android:persistent="false" />

        <!-- Whether to allow notification lights in zen mode -->
        <!-- This is set to true to match the default state in Android 5.1 -->
        <com.android.settings.cyanogenmod.SystemSettingSwitchPreference
            android:key="allow_lights"
            android:title="@string/allow_lights_title"
            android:order="101"
            android:defaultValue="true"
            settings:advanced="true" />

    </PreferenceCategory>

    <PreferenceCategory
+8 −0
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
    private static final String KEY_CONDITION_PROVIDERS = "manage_condition_providers";
    private static final String KEY_MUSIC_INTERRUPTIONS = "music_interruptions";

    private static final String KEY_ALLOW_LIGHTS = "allow_lights";

    private static final SettingPrefWithCallback PREF_ZEN_MODE = new SettingPrefWithCallback(
            SettingPref.TYPE_GLOBAL, KEY_ZEN_MODE, Global.ZEN_MODE, Global.ZEN_MODE_OFF,
            Global.ZEN_MODE_OFF, Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS,
@@ -343,6 +345,12 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index
            });
            mDowntimeMode.setOrder(10);  // sort at the bottom of the category
            mDowntimeMode.setDependency(mDays.getKey());

            // Remove of the "Allow notification light" setting if an led is not supported
            if (!getResources().getBoolean(
                    com.android.internal.R.bool.config_intrusiveNotificationLed)) {
                downtime.removePreference(findPreference(KEY_ALLOW_LIGHTS));
            }
        }

        mAutomationCategory = (PreferenceCategory) findPreference(KEY_AUTOMATION);