From 9596ee1f28afc21814593a853c0ef1bd9fe0238b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 4 May 2018 18:23:12 +0200 Subject: [PATCH] fix #453, add an option to loop reminders until dismissed --- .../calendar/activities/SettingsActivity.kt | 9 ++++++++ .../calendar/extensions/Context.kt | 9 ++++++-- .../calendar/helpers/Config.kt | 4 ++++ .../calendar/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 23 +++++++++++++++++++ app/src/main/res/values-az/strings.xml | 1 + app/src/main/res/values-br/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-hi-rIN/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 5 ++-- app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-iw/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-no/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 33 files changed, 74 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt index 937c2fbb7..b59add11d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -55,6 +55,7 @@ class SettingsActivity : SimpleActivity() { setupVibrate() setupReminderSound() setupUseSameSnooze() + setupLoopReminders() setupSnoozeTime() setupDisplayPastEvents() setupFontSize() @@ -317,6 +318,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupLoopReminders() { + settings_loop_reminders.isChecked = config.loopReminders + settings_loop_reminders_holder.setOnClickListener { + settings_loop_reminders.toggle() + config.loopReminders = settings_loop_reminders.isChecked + } + } + private fun setupUseSameSnooze() { settings_snooze_time_holder.beVisibleIf(config.useSameSnooze) settings_use_same_snooze.isChecked = config.useSameSnooze diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt index 4230b4e31..991e42407 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -228,14 +228,19 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content: .addAction(R.drawable.ic_snooze, getString(R.string.snooze), getSnoozePendingIntent(this, event)) if (config.vibrateOnReminder) { - builder.setVibrate(longArrayOf(0, 300, 300, 300)) + val vibrateArray = LongArray(2) { 500 } + builder.setVibrate(vibrateArray) } if (!publicVersion) { builder.setPublicVersion(getNotification(pendingIntent, event, content, true)) } - return builder.build() + val notification = builder.build() + if (config.loopReminders) { + notification.flags = notification.flags or Notification.FLAG_INSISTENT + } + return notification } private fun getFormattedEventTime(startTime: String, endTime: String) = if (startTime == endTime) startTime else "$startTime \u2013 $endTime" diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt index eba7cd1db..a39b856b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt @@ -93,6 +93,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SHOW_GRID, false) set(showGrid) = prefs.edit().putBoolean(SHOW_GRID, showGrid).apply() + var loopReminders: Boolean + get() = prefs.getBoolean(LOOP_REMINDERS, false) + set(loopReminders) = prefs.edit().putBoolean(LOOP_REMINDERS, loopReminders).apply() + fun getSyncedCalendarIdsAsList() = caldavSyncedCalendarIDs.split(",").filter { it.trim().isNotEmpty() } as ArrayList fun addDisplayEventType(type: String) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt index c964d906b..55891cb5e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt @@ -49,6 +49,7 @@ const val DISPLAY_PAST_EVENTS = "display_past_events" const val REPLACE_DESCRIPTION = "replace_description" const val SHOW_GRID = "show_grid" const val IS_CUSTOMIZING_COLORS = "is_customizing_colors" +const val LOOP_REMINDERS = "loop_reminders" // repeat_rule for monthly repetition const val REPEAT_MONTH_SAME_DAY = 1 // ie 25th every month diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index d1a554663..32dad5eef 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -210,6 +210,29 @@ + + + + + + Bütün hadisələri sil Bütün hadisələri silmək istədiyinizə əminsiniz? Bu hadisələri və parametrlərini bütövlüklə siləcək. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-br/strings.xml b/app/src/main/res/values-br/strings.xml index 5983d204d..7c925172f 100644 --- a/app/src/main/res/values-br/strings.xml +++ b/app/src/main/res/values-br/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ae81dbfa9..881a2f391 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 764ec8307..36c4a3921 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -153,6 +153,7 @@ Slet alle begivenheder Er du sikker på at du vil slette alle begivenheder? Dine begivenhedstyper og andre indstillinger vil forblive intakte. Vis gitter + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 35acadd05..68a1dd1f4 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -153,6 +153,7 @@ Alle Termine löschen Bist du sicher, dass du alle Termine löschen willst? Deine Termintypen und Einstellungen bleiben erhalten. Raster anzeigen + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b90b95df7..fb93f0507 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7022107a1..a9634e01a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -153,6 +153,7 @@ Supprimer tous les événements Êtes-vous sûr de vouloir supprimer tous les événements ? Cela laissera vos types d\'événements et autres paramètres intacts. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 51eb5c678..e33a874cf 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index 72a6ce3b8..1640be0eb 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -154,6 +154,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 31f7bee64..19cc6ef7e 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -153,6 +153,7 @@ Izbriši sve događaje Jeste li sigurni da želite izbrisati sve događaje? To će ostaviti Vaše vrste događaja i druge postavke netaknutima. Prikaži mrežu + Loop reminders until dismissed CalDAV @@ -160,10 +161,10 @@ Upravljanje sinkroniziranim kalendarima Pohrani samo lokalno Osvježi CalDAV kalendare - Osvježavanje... + Osvježavanje… Osvježavanje završeno Uređivanje kalendara nije uspjelo - Sinkronizacija... + Sinkronizacija… Sinkronizacija završena diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 574ee89e4..bc1a1740b 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b780ecda2..2e1af8ae6 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -153,6 +153,7 @@ Cancella tutti gli eventi Vuoi cancellare tutti gli eventi? Questo lascerà i tuoi tipi evento e le altre impostazioni invariate. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index d658e0cff..e0739e4e4 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -154,6 +154,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 509bd6328..64cdff5b3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 6616c2414..4291e7e0e 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 076938021..a830262a6 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -153,6 +153,7 @@ Ištrinti visus įvykius Ar Jūs tikrai norite ištrinti visus įvykius? Tai neištrins įvykių tipų ir kitų nustatymų. Rodyti tinklelį + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index dff2fe84d..310edd525 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -153,6 +153,7 @@ Slett alle hendelser Er du sikker på at du vil slette alle hendelser? Dine hendelsestyper og andre innstillinger blir beholdt. Vis rutenett + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6f69f9252..b94248f51 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -153,6 +153,7 @@ Alle afspraken verwijderen Alle afspraken verwijderen? Afspraaktypes en andere instellingen blijven behouden. Rasterlijnen tonen + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 5a25446ae..8f77b6252 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 2d4e88329..cd8a44979 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -153,6 +153,7 @@    Usuń wszystkie wydarzenia    Czy na pewno mam usunąć wszystkie wydarzenia? Nie naruszy to typów wydarzeń i innych ustawień. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 497e48029..71bac6d39 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index ad80f9ecc..d2ab0c008 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -153,6 +153,7 @@ Apagar todos os eventos Tem a certeza de que deseja apagar todos os eventos? Esta ação não afeta os tipos de eventos nem as outras definições. Mostrar grelha + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 3083b6776..d0bc2ff50 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -153,6 +153,7 @@ Удалить все события Вы действительно хотите удалить все события? Это не затронет ваши типы событий и другие настройки. Показывать сетку + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 34d784226..ba48d9ea0 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -153,6 +153,7 @@ Odstrániť všetky udalosti Ste si istý, že chcete odstrániť všetky udalosti? Všetky typy udalostí a nastavenia ostanú nedotknuté. Zobraziť mriežku + Opakovať pripomienky až po odstránenie CalDAV diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 8efd995f0..95b43c882 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -153,6 +153,7 @@ Ta bort alla händelser Är du säker på att du vill ta bort alla händelser? Dina händelsetyper och andra inställningar påverkas inte av borttagningen. Visa ett rutnät + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 8474a6d8a..79324e41b 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index f883d8a77..ba56f5310 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -153,6 +153,7 @@ 刪除全部活動 你確定要刪除全部活動嗎?會完整留下你的活動類型和其他設定。 Show a grid + Loop reminders until dismissed CalDAV diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 287e07357..2c72ef694 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -153,6 +153,7 @@ Delete all events Are you sure you want to delete all events? This will leave your event types and other settings intact. Show a grid + Loop reminders until dismissed CalDAV