From a8146b7f2db6323068c892fe23982416d9454109 Mon Sep 17 00:00:00 2001 From: Forrest Guice Date: Mon, 30 Sep 2024 22:22:15 -0700 Subject: [PATCH] BedtimeSettings #818 --- .../suntimeswidget/alarmclock/bedtime/BedtimeSettings.java | 4 ++-- app/src/main/res/values/pref_defaults.xml | 1 + app/src/main/res/values/strings.xml | 2 +- app/src/main/res/xml-v11/preference_alarms.xml | 3 ++- app/src/main/res/xml-v34/preference_alarms.xml | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/alarmclock/bedtime/BedtimeSettings.java b/app/src/main/java/com/forrestguice/suntimeswidget/alarmclock/bedtime/BedtimeSettings.java index e7fd3112a..ef2faafe3 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/alarmclock/bedtime/BedtimeSettings.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/alarmclock/bedtime/BedtimeSettings.java @@ -27,6 +27,7 @@ import android.support.annotation.Nullable; import android.util.Log; +import com.forrestguice.suntimeswidget.R; import com.forrestguice.suntimeswidget.alarmclock.AlarmSettings; import com.forrestguice.suntimeswidget.settings.PrefTypeInfo; @@ -76,7 +77,6 @@ public class BedtimeSettings public static final int PREF_DEF_BEDTIME_DND_FILTER = DND_FILTER_PRIORITY; public static final String PREF_KEY_BEDTIME_DND_RULEBASED = "app_bedtime_dnd_rulebased"; - public static final boolean PREF_DEF_BEDTIME_DND_RULEBASED = true; public static final String PREF_KEY_BEDTIME_REMINDER = "app_bedtime_reminder"; public static final boolean PREF_DEF_BEDTIME_REMINDER = false; @@ -153,7 +153,7 @@ public static void savePrefBedtimeDoNotDisturb(Context context, boolean value) public static boolean loadPrefBedtimeDoNotDisturbRuleBased(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - return prefs.getBoolean(PREF_KEY_BEDTIME_DND_RULEBASED, PREF_DEF_BEDTIME_DND_RULEBASED); + return prefs.getBoolean(PREF_KEY_BEDTIME_DND_RULEBASED, context.getResources().getBoolean(R.bool.def_app_bedtime_dnd_rulebased)); } public static int loadPrefBedtimeDoNotDisturbFilter(Context context) { diff --git a/app/src/main/res/values/pref_defaults.xml b/app/src/main/res/values/pref_defaults.xml index a005b622f..b3487193f 100644 --- a/app/src/main/res/values/pref_defaults.xml +++ b/app/src/main/res/values/pref_defaults.xml @@ -65,5 +65,6 @@ NONE 5400000 + true diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b5b3c87ed..3e060b854 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1407,7 +1407,7 @@ Bedtime (Active) Bedtime (Paused) - Use \'Do Not Disturb\' rule + \'Do Not Disturb\' rules Trigger \'Do Not Disturb\' settings using an automatic rule (recommended). Bedtime (Suntimes) diff --git a/app/src/main/res/xml-v11/preference_alarms.xml b/app/src/main/res/xml-v11/preference_alarms.xml index 6afffe08a..493b28483 100644 --- a/app/src/main/res/xml-v11/preference_alarms.xml +++ b/app/src/main/res/xml-v11/preference_alarms.xml @@ -91,7 +91,8 @@ + android:summary="@string/configLabel_dnd_rulebased_summary" + android:defaultValue="@bool/def_app_bedtime_dnd_rulebased" /> diff --git a/app/src/main/res/xml-v34/preference_alarms.xml b/app/src/main/res/xml-v34/preference_alarms.xml index d475619e9..7347db188 100644 --- a/app/src/main/res/xml-v34/preference_alarms.xml +++ b/app/src/main/res/xml-v34/preference_alarms.xml @@ -96,7 +96,8 @@ + android:summary="@string/configLabel_dnd_rulebased_summary" + android:defaultValue="@bool/def_app_bedtime_dnd_rulebased" />