From 8bfae3e73770e5d80969056a745193bee3587a5b Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Aug 2017 20:55:41 +0200 Subject: [PATCH] adding a toggle for caldav sync --- .../calendar/activities/SettingsActivity.kt | 9 +++++++++ .../calendar/helpers/Config.kt | 4 ++++ .../calendar/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 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-hi-rIN/strings.xml | 1 + 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-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/strings.xml | 1 + 19 files changed, 49 insertions(+) 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 2c8e329e1..221ae8138 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -52,6 +52,7 @@ class SettingsActivity : SimpleActivity() { setContentView(R.layout.activity_settings) res = resources setupGoogleSync() + setupCaldavSync() } override fun onResume() { @@ -131,6 +132,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupCaldavSync() { + settings_caldav_sync.isChecked = config.caldavSync + settings_caldav_sync_holder.setOnClickListener { + settings_caldav_sync.toggle() + config.caldavSync = settings_caldav_sync.isChecked + } + } + private fun toggleGoogleSync() { settings_google_sync.toggle() 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 0e6d2018e..86b0d7eed 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt @@ -82,6 +82,10 @@ class Config(context: Context) : BaseConfig(context) { prefs.edit().putBoolean(GOOGLE_SYNC, googleSync).apply() } + var caldavSync: Boolean + get() = prefs.getBoolean(CALDAV_SYNC, false) + set(caldavSync) = prefs.edit().putBoolean(CALDAV_SYNC, caldavSync).apply() + var syncAccountName: String get() = prefs.getString(SYNC_ACCOUNT_NAME, "") set(syncAccountName) = prefs.edit().putString(SYNC_ACCOUNT_NAME, syncAccountName).apply() 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 be46055d7..ad564622b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt @@ -42,6 +42,7 @@ val REMINDER_MINUTES = "reminder_minutes" val DISPLAY_EVENT_TYPES = "display_event_types" val FONT_SIZE = "font_size" val GOOGLE_SYNC = "google_sync" +val CALDAV_SYNC = "caldav_sync" val SYNC_ACCOUNT_NAME = "sync_account_name" val SNOOZE_DELAY = "snooze_delay" val DISPLAY_PAST_EVENTS = "display_past_events" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index b748e7e14..d94568074 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -129,6 +129,26 @@ + + + + + + Kein Klingelton gewählt Terminbeginn kann nicht vor Terminende liegen Google Sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e3ab5910d..996b0514c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -187,6 +187,7 @@ Ninguno El día no puede terminar antes de que comience Sincronización de Google + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 885702800..4826b2b30 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -187,6 +187,7 @@ Aucune Le jour ne peut pas se terminer plus tôt qu\'il ne débute Synchronisation Google + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index f61c43ccb..693256131 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -187,6 +187,7 @@ None The day cannot end earlier than it starts Google sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 8c0f842a8..71341393b 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -187,6 +187,7 @@ None The day cannot end earlier than it starts Google sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 9b0c4faac..669e26c3e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -187,6 +187,7 @@ None The day cannot end earlier than it starts Google sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index b25f62680..1218d1658 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -187,6 +187,7 @@ ללא היום לא יכול להסתיים מוקדם משהוא מתחיל Google sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 65ffe98be..9eea525e3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -187,6 +187,7 @@ None The day cannot end earlier than it starts Google sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 9eab3b87b..653149ffe 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -187,6 +187,7 @@ Nenhum O dia final não pode ser antes do início Sincronização Google + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index cbe33aa0f..d6e052857 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -187,6 +187,7 @@ Nenhum O dia final não pode ser antes do inicial Sincronização Google + Sync with the local calendar (CalDAV) Mostrar eventos passados Adiar lembrete com a opção Snooze Widgets diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b015a1971..172adfa05 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -201,6 +201,7 @@ Нет Конец дня не может быть раньше начала Синхронизация с Google + Sync with the local calendar (CalDAV) Показывать прошедшие события Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index b252317ec..4cb4aa931 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -194,6 +194,7 @@ Žiadna Deň nemôže skončiť skôr než začne Google synchronizácia + Lokálna synchronizácia (CalDAV) Zobraziť minulé udalosti spred Posunúť pripomienku s Odložiť o Widgety diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 69780ed53..85d21471f 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -187,6 +187,7 @@ Ingen Dagen kan inte börja innan den tar slut Google Synk + Sync with the local calendar (CalDAV) Visa tidigare händelser Skjut upp påminnelse med Snooza Widgets diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index ef08df162..08cd67022 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -187,6 +187,7 @@ Boş Gün başlamadan önce bitemez Google senkronizasyonu + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0026ba653..4311bd72c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -187,6 +187,7 @@ None The day cannot end earlier than it starts Google sync + Sync with the local calendar (CalDAV) Display events from the past Postpone reminder with Snooze by Widgets