diff --git a/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java b/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java index 56f3e4c83..56da308dd 100644 --- a/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java +++ b/app/src/main/java/com/orgzly/android/prefs/AppPreferences.java @@ -302,6 +302,12 @@ public static boolean remindersVibrate(Context context) { context.getResources().getBoolean(R.bool.pref_default_reminders_vibrate)); } + public static boolean remindersSticky(Context context) { + return getDefaultSharedPreferences(context).getBoolean( + context.getResources().getString(R.string.pref_key_reminders_sticky), + context.getResources().getBoolean(R.bool.pref_default_reminders_sticky)); + } + public static int remindersSnoozeTime(Context context) { return Integer.parseInt(getDefaultSharedPreferences(context).getString( context.getResources().getString(R.string.pref_key_snooze_time), diff --git a/app/src/main/java/com/orgzly/android/reminders/RemindersNotifications.kt b/app/src/main/java/com/orgzly/android/reminders/RemindersNotifications.kt index 2106cc5fe..493fc6941 100644 --- a/app/src/main/java/com/orgzly/android/reminders/RemindersNotifications.kt +++ b/app/src/main/java/com/orgzly/android/reminders/RemindersNotifications.kt @@ -53,6 +53,12 @@ object RemindersNotifications { builder.setVibrate(VIBRATION_PATTERN) } + // Set notification sticky + if (AppPreferences.remindersSticky(context)) { + builder.setOngoing(true) + builder.setAutoCancel(false) + } + // Set notification sound if (AppPreferences.remindersSound(context)) { builder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) diff --git a/app/src/main/res/values/prefs_keys.xml b/app/src/main/res/values/prefs_keys.xml index 22074181c..0182992ef 100644 --- a/app/src/main/res/values/prefs_keys.xml +++ b/app/src/main/res/values/prefs_keys.xml @@ -257,6 +257,9 @@ pref_key_reminders_vibrate false + pref_key_reminders_sticky + false + pref_key_reminders_led true diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9af92234a..d562b43ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -474,6 +474,9 @@ Events Display notification for notes with event time + Sticky Reminders" + Reminders cannot be dismissed by swiping + Sound Vibration Light diff --git a/app/src/main/res/xml-v26/prefs_screen_reminders.xml b/app/src/main/res/xml-v26/prefs_screen_reminders.xml index b62342fa4..99845baf8 100644 --- a/app/src/main/res/xml-v26/prefs_screen_reminders.xml +++ b/app/src/main/res/xml-v26/prefs_screen_reminders.xml @@ -23,6 +23,12 @@ android:summary="@string/pref_title_summary_reminders_for_event_times" android:defaultValue="@bool/pref_default_use_reminders_for_event_times" /> + + diff --git a/app/src/main/res/xml/prefs_screen_reminders.xml b/app/src/main/res/xml/prefs_screen_reminders.xml index c40161461..6b4c22a6f 100644 --- a/app/src/main/res/xml/prefs_screen_reminders.xml +++ b/app/src/main/res/xml/prefs_screen_reminders.xml @@ -23,6 +23,12 @@ android:summary="@string/pref_title_summary_reminders_for_event_times" android:defaultValue="@bool/pref_default_use_reminders_for_event_times" /> + +