Skip to content

Commit

Permalink
BedtimeSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestguice committed Oct 1, 2024
1 parent a3c081c commit a8146b7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/pref_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@
<string name="def_app_alarms_dismiss_challenge" translatable="false">NONE</string>

<string name="def_app_bedtime_sleepCycleMillis" translatable="false">5400000</string> <!-- 90m -->
<bool name="def_app_bedtime_dnd_rulebased">true</bool>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@
<string name="configLabel_bedtime_tile_active">Bedtime (Active)</string>
<string name="configLabel_bedtime_tile_paused">Bedtime (Paused)</string>

<string name="configLabel_dnd_rulebased">Use \'Do Not Disturb\' rule</string> <!-- TODO -->
<string name="configLabel_dnd_rulebased">\'Do Not Disturb\' rules</string> <!-- TODO -->
<string name="configLabel_dnd_rulebased_summary">Trigger \'Do Not Disturb\' settings using an automatic rule (recommended).</string> <!-- TODO -->

<string name="configLabel_bedtime_zenrule_name">Bedtime (Suntimes)</string> <!-- do-not-disturb rule name; appears in global-dnd-settings/schedule -->
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/xml-v11/preference_alarms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
<CheckBoxPreference
android:key="app_bedtime_dnd_rulebased"
android:title="@string/configLabel_dnd_rulebased"
android:summary="@string/configLabel_dnd_rulebased_summary" />
android:summary="@string/configLabel_dnd_rulebased_summary"
android:defaultValue="@bool/def_app_bedtime_dnd_rulebased" />

</PreferenceCategory>

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/xml-v34/preference_alarms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
<CheckBoxPreference
android:key="app_bedtime_dnd_rulebased"
android:title="@string/configLabel_dnd_rulebased"
android:summary="@string/configLabel_dnd_rulebased_summary" />
android:summary="@string/configLabel_dnd_rulebased_summary"
android:defaultValue="@bool/def_app_bedtime_dnd_rulebased" />

</PreferenceCategory>

Expand Down

0 comments on commit a8146b7

Please sign in to comment.