From b2b919a0eb36bad8d82f895a2b564cacc1a640eb Mon Sep 17 00:00:00 2001 From: Xose M <704948+xmgz@users.noreply.github.com> Date: Sat, 30 Dec 2017 06:53:54 +0100 Subject: [PATCH 01/94] crear strings en galego novo idioma para Calendar --- app/src/main/res/values-gl/strings.xml | 1 + 1 file changed, 1 insertion(+) create mode 100644 app/src/main/res/values-gl/strings.xml diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml new file mode 100644 index 000000000..816f79f93 --- /dev/null +++ b/app/src/main/res/values-gl/strings.xml @@ -0,0 +1 @@ +idioma galego From 3b1629d547b07d10f48b088f9916cd63b6fb872e Mon Sep 17 00:00:00 2001 From: Xose M <704948+xmgz@users.noreply.github.com> Date: Sat, 30 Dec 2017 06:56:07 +0100 Subject: [PATCH 02/94] copiado de values-es para ter unha referencia do sentido das cadeas --- app/src/main/res/values-gl/strings.xml | 303 ++++++++++++++++++++++++- 1 file changed, 302 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 816f79f93..4b2bbff53 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -1 +1,302 @@ -idioma galego + + + Simple Calendar + Simple Calendar + Cambiar vista + Vista semanal + Vista mensual + Vista anual + Lista de eventos sencilla + Parece que no tienes ningún evento próximo. + Puede añadir algunos con el botón Más en la parte inferior. + Detalles + Ir al día de hoy + Snooze + + + Calendario mensual + Lista de eventos del calendario + + + Evento + Editar evento + Nuevo evento + El título no puede estar vacío + El evento no puede acabar antes de iniciarse + El evento se ha añadido con éxito + El evento se ha actualizado con éxito + Filtrar eventos según tipo + + + Repetición + Sin repetición + Diariamente + Semanalmente + Mensualmente + Anualmente + semanas + meses + años + Repetir hasta + Siempre + The event is repeatable + La selección contiene eventos repetitivos + Eliminar sólo el evento seleccionado + Eliminar todos los eventos + Actualizar sólo el evento seleccionado + Actualizar todos los eventos + Repetir hasta la fecha + Repetir x veces + Repetir por siempre + veces + Repetir + Repertir los + Cada día + En los días seleccionados + El mismo día + El último día + Repetir en el mismo día cada mes + Repetir en el último día del mes + Repetir cada + Cada + primero + segundo + tercero + cuarto + último + + + + Repetir cada + Cada + primero + segundo + tercero + cuarto + último + + + %d día + %d días + + + + %d semana + %d semanas + + + + %d mes + %d meses + + + + %d año + %d años + + + + Birthdays + Add contact birthdays + No birthdays have been found + Birthdays added successfully + + + Anniversaries + Add contact anniversaries + No anniversaries have been found + Anniversaries added successfully + + + Recordatorio + Sin recordatorio + Al inicio + Personalizado + antes + minutos + horas + días + Agregar otro recordatorio + Event reminders + + + %d minuto antes + %d minutos antes + + + + %d hora antes + %d horas antes + + + + %d día antes + %d días antes + + + + Importing… + Exporting… + Importar eventos + Exportar eventos + Importar eventos desde un archivo .ics + Exportar eventos desde un archivo .ics + Eventos importados exitosamente + Los eventos han sido exportados exitosamente + Error en la importación de eventos + Error en la exportación de eventos + Error al importar algunos eventos + Error al exportar algunos eventos + Tipo de evento predeterminado + No se han encontrado eventos para la exportación + También exportar eventos pasados + Include event types + Filename (without .ics) + No title + + + Título + Location + Descripción + Todo el día + + + Semana + + + Tipos de eventos + Agregar un nuevo tipo de evento + Editar tipo de evento + Ya existe un tipo de evento con este nombre + Color + Evento regular + No se puede eliminar el tipo de evento predeterminado + Seleccione un tipo de evento + Move affected events into the default event type + Permanently remove affected events + To remove a CalDAV calendar you have to unsynchronize it + + + Holidays + Add holidays + National holidays + Religious holidays + Holidays have been successfully imported into a new event type + Importing some events failed + Importing holidays failed + + + Gestionar tipos de eventos + Usar formato de 24 horas + Domingo como primer día de la semana + El día en la vista semanal comienza a las + El día en la vista semanal finaliza a las + Mostrar los números de la semana + Vibración en notificación de recordatorio + Sonido de recordatorio + Recordatorio predeterminado de un evento + No se ha encontrado ninguna aplicación capaz de establecer el tono de llamada + Ninguno + El día no puede terminar antes de que comience + CalDAV sync + Event lists + Display events from the past + Postpone reminder with Snooze by + Widgets + Replace Description with Location at list view entries + + + CalDAV + Select calendars to sync + Manage synced calendars + Store locally only + Refresh CalDAV calendars + Refreshing… + Refreshing complete + Editing calendar failed + Syncing… + Sync completed + + + %d minute + %d minutes + + + + %d hour + %d hours + + + Never + + Enero + Febrero + Marzo + Abril + Mayo + Junio + Julio + Agosto + Septiembre + Octubre + Noviembre + Diciembre + + L + M + X + J + V + S + D + + Lunes + Martes + Miércoles + Jueves + Viernes + Sábado + Domingo + + + + Lunes + Martes + Miércoles + Jueves + Viernes + Sábado + Domingo + + + Ejercicio + Ejercitar piernas + Reunión con John + En el jardín de Rockstone + Biblioteca + Almuerzo con María + En la plaza + Hora de café + + + + Un sencillo calendario con eventos, widget personalizable y sin anuncios. + + Un calendario sin conexión sin ninguna otra integración con el calendario. Usted puede crear fácilmente eventos recurrentes y configurar recordatorios. También muestra los números de semana. + + Contiene un widget 4x4 de tamaño variable en el que se puede personalizar el color del texto, así como el alfa y el color del fondo. + + No contiene anuncios ni permisos innecesarios. Es totalmente de código abierto y ofrece un tema oscuro también. + + The Storage permission is needed only for importing events from .ics files. + + Contacts permission is used only at importing contact birthdays. + + Esta aplicación es solo una parte de una serie más grande de aplicaciones. Puede encontrar el resto de ellas en http://www.simplemobiletools.com + + + + From f94fd3b57b534f612265710dcc12a483a143fc1f Mon Sep 17 00:00:00 2001 From: Xose M <704948+xmgz@users.noreply.github.com> Date: Sat, 30 Dec 2017 06:58:55 +0100 Subject: [PATCH 03/94] primeiras cadeas --- app/src/main/res/values-gl/strings.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 4b2bbff53..95f4d44c5 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -1,21 +1,21 @@ Simple Calendar - Simple Calendar + Calendario Cambiar vista Vista semanal Vista mensual Vista anual - Lista de eventos sencilla - Parece que no tienes ningún evento próximo. - Puede añadir algunos con el botón Más en la parte inferior. - Detalles - Ir al día de hoy - Snooze + Lista de eventos simple + Semella que non ten ningún evento próximo. + Pode engadir algún co botón Máis na parte inferior. + Detalle + Ir ao día de hoxe + Retrasar Calendario mensual - Lista de eventos del calendario + Lista de eventos do calendario Evento From fe0e2fcae5e6ad23e1dfb03291672f0181af0134 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 29 Jan 2018 21:55:09 +0100 Subject: [PATCH 04/94] Dutch --- app/src/main/res/values-nl/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 4b1fb67af..064120497 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -47,7 +47,7 @@ Al deze afspraken verwijderen Alleen huidige afspraak bijwerken Alle afspraken bijwerken - Herhalen tot een datum + Herhalen tot datum Aantal keren herhalen Voor altijd herhalen keer @@ -139,8 +139,8 @@ Afspraken importeren Afspraken exporteren - Afspraken uit een .ics-bestand importeren - Afspraken naar een .ics-bestand exporteren + Afspraken uit .ics-bestand importeren + Afspraken naar .ics-bestand exporteren Standaard afspraaktype Afspraken uit verleden ook exporteren Afspraaktypes weergeven From f7010a9529fd641bd51c2b5ccbe3a124f5c162f3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 Jan 2018 19:31:12 +0100 Subject: [PATCH 05/94] shorten the search closing code --- .../com/simplemobiletools/calendar/activities/MainActivity.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index 8c7f1e0f3..6aac1e10e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -241,9 +241,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun closeSearch() { - if (mSearchMenuItem != null) { - MenuItemCompat.collapseActionView(mSearchMenuItem) - } + mSearchMenuItem?.collapseActionView() } private fun checkOpenIntents() { From ba70e6b523e9a340a338fc2fc0d94e986d93edd5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 Jan 2018 21:17:45 +0100 Subject: [PATCH 06/94] check if we can generate a public uri from the selected reminder sound uri --- .../calendar/activities/SettingsActivity.kt | 16 +++++++++++++--- .../calendar/extensions/Context.kt | 5 ++++- 2 files changed, 17 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 15f0b32cd..77575a858 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -7,6 +7,7 @@ import android.net.Uri import android.os.Bundle import android.os.Parcelable import android.text.TextUtils +import com.simplemobiletools.calendar.BuildConfig import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog import com.simplemobiletools.calendar.dialogs.SelectCalendarsDialog @@ -23,6 +24,7 @@ import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALENDAR import com.simplemobiletools.commons.models.RadioItem import kotlinx.android.synthetic.main.activity_settings.* +import java.io.File import java.util.* class SettingsActivity : SimpleActivity() { @@ -367,12 +369,20 @@ class SettingsActivity : SimpleActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (resultCode == RESULT_OK) { if (requestCode == GET_RINGTONE_URI) { - val uri = data?.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI) + var uri = data?.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI) + if (uri == null) { config.reminderSound = "" } else { - settings_reminder_sound.text = RingtoneManager.getRingtone(this, uri as Uri)?.getTitle(this) - config.reminderSound = uri.toString() + try { + if ((uri as Uri).scheme == "file") { + uri = getFilePublicUri(File(uri.path), BuildConfig.APPLICATION_ID) + } + settings_reminder_sound.text = RingtoneManager.getRingtone(this, uri)?.getTitle(this) + config.reminderSound = uri.toString() + } catch (e: Exception) { + showErrorToast(e) + } } } } 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 2f219c92e..b3559b606 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -199,7 +199,10 @@ private fun getNotification(context: Context, pendingIntent: PendingIntent, even var soundUri = Uri.parse(context.config.reminderSound) if (soundUri.scheme == "file") { - soundUri = context.getFilePublicUri(File(soundUri.path), BuildConfig.APPLICATION_ID) + try { + soundUri = context.getFilePublicUri(File(soundUri.path), BuildConfig.APPLICATION_ID) + } catch (ignored: Exception) { + } } val builder = NotificationCompat.Builder(context) From f994a085e14374fd8bff0d9cf7e1a05137abc6f0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 Jan 2018 21:24:25 +0100 Subject: [PATCH 07/94] catch security exceptions thrown at alarm setRepeating --- .../com/simplemobiletools/calendar/extensions/Context.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 b3559b606..1a2940808 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -278,7 +278,10 @@ fun Context.scheduleCalDAVSync(activate: Boolean) { if (activate) { val syncCheckInterval = 4 * AlarmManager.INTERVAL_HOUR - alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + syncCheckInterval, syncCheckInterval, pendingIntent) + try { + alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + syncCheckInterval, syncCheckInterval, pendingIntent) + } catch (ignored: SecurityException) { + } } else { alarm.cancel(pendingIntent) } From 005c65cc76b2fde25999499d75400859f2ad965f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 Jan 2018 23:14:47 +0100 Subject: [PATCH 08/94] remove the Default Event Reminder setting, remember last selection --- .../calendar/activities/EventActivity.kt | 20 +- .../calendar/activities/SettingsActivity.kt | 13 -- .../calendar/helpers/Config.kt | 10 +- .../calendar/helpers/Constants.kt | 218 +++++++++--------- app/src/main/res/layout/activity_settings.xml | 35 --- 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-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-ko/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/strings.xml | 1 - 28 files changed, 134 insertions(+), 185 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index 74403fed3..1bd67449c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -66,8 +66,8 @@ class EventActivity : SimpleActivity() { } else { mEvent = Event() mReminder1Minutes = config.defaultReminderMinutes - mReminder2Minutes = -1 - mReminder3Minutes = -1 + mReminder2Minutes = config.defaultReminderMinutes3 + mReminder3Minutes = config.defaultReminderMinutes2 setupNewEvent() } @@ -551,14 +551,24 @@ class EventActivity : SimpleActivity() { } val reminders = sortedSetOf(mReminder1Minutes, mReminder2Minutes, mReminder3Minutes).filter { it != REMINDER_OFF } + val reminder1 = reminders.getOrElse(0, { REMINDER_OFF }) + val reminder2 = reminders.getOrElse(1, { REMINDER_OFF }) + val reminder3 = reminders.getOrElse(2, { REMINDER_OFF }) + + config.apply { + defaultReminderMinutes = reminder1 + defaultReminderMinutes2 = reminder2 + defaultReminderMinutes3 = reminder3 + } + mEvent.apply { startTS = newStartTS endTS = newEndTS title = newTitle description = event_description.value - reminder1Minutes = reminders.elementAtOrElse(0) { REMINDER_OFF } - reminder2Minutes = reminders.elementAtOrElse(1) { REMINDER_OFF } - reminder3Minutes = reminders.elementAtOrElse(2) { REMINDER_OFF } + reminder1Minutes = reminder1 + reminder2Minutes = reminder2 + reminder3Minutes = reminder3 repeatInterval = mRepeatInterval importId = newImportId flags = if (event_all_day.isChecked) (mEvent.flags or FLAG_ALL_DAY) else (mEvent.flags.removeFlag(FLAG_ALL_DAY)) 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 77575a858..51c0d8843 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -56,7 +56,6 @@ class SettingsActivity : SimpleActivity() { setupVibrate() setupReminderSound() setupSnoozeDelay() - setupEventReminder() setupDisplayPastEvents() setupFontSize() updateTextColors(settings_holder) @@ -300,18 +299,6 @@ class SettingsActivity : SimpleActivity() { settings_snooze_delay.text = res.getQuantityString(R.plurals.by_minutes, config.snoozeDelay, config.snoozeDelay) } - private fun setupEventReminder() { - var reminderMinutes = config.defaultReminderMinutes - settings_default_reminder.text = getFormattedMinutes(reminderMinutes) - settings_default_reminder_holder.setOnClickListener { - showEventReminderDialog(reminderMinutes) { - config.defaultReminderMinutes = it - reminderMinutes = it - settings_default_reminder.text = getFormattedMinutes(it) - } - } - } - private fun getHoursString(hours: Int): String { return if (hours < 10) { "0$hours:00" 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 c1e12b3a1..c0ad18e6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Config.kt @@ -53,7 +53,15 @@ class Config(context: Context) : BaseConfig(context) { var defaultReminderMinutes: Int get() = prefs.getInt(REMINDER_MINUTES, 10) - set(mins) = prefs.edit().putInt(REMINDER_MINUTES, mins).apply() + set(defaultReminderMinutes) = prefs.edit().putInt(REMINDER_MINUTES, defaultReminderMinutes).apply() + + var defaultReminderMinutes2: Int + get() = prefs.getInt(REMINDER_MINUTES_2, REMINDER_OFF) + set(defaultReminderMinutes2) = prefs.edit().putInt(REMINDER_MINUTES_2, defaultReminderMinutes2).apply() + + var defaultReminderMinutes3: Int + get() = prefs.getInt(REMINDER_MINUTES_3, REMINDER_OFF) + set(defaultReminderMinutes3) = prefs.edit().putInt(REMINDER_MINUTES_3, defaultReminderMinutes3).apply() var snoozeDelay: Int get() = prefs.getInt(SNOOZE_DELAY, 10) 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 64c5336c5..d48f72f0e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt @@ -2,139 +2,141 @@ package com.simplemobiletools.calendar.helpers import com.simplemobiletools.calendar.R -val LOW_ALPHA = .3f -val MEDIUM_ALPHA = .6f -val STORED_LOCALLY_ONLY = 0 +const val LOW_ALPHA = .3f +const val MEDIUM_ALPHA = .6f +const val STORED_LOCALLY_ONLY = 0 -val DAY_CODE = "day_code" -val YEAR_LABEL = "year" -val EVENT_ID = "event_id" -val EVENT_OCCURRENCE_TS = "event_occurrence_ts" -val NEW_EVENT_START_TS = "new_event_start_ts" -val WEEK_START_TIMESTAMP = "week_start_timestamp" -val NEW_EVENT_SET_HOUR_DURATION = "new_event_set_hour_duration" -val WEEK_START_DATE_TIME = "week_start_date_time" -val CALDAV = "Caldav" -val OPEN_MONTH = "open_month" +const val DAY_CODE = "day_code" +const val YEAR_LABEL = "year" +const val EVENT_ID = "event_id" +const val EVENT_OCCURRENCE_TS = "event_occurrence_ts" +const val NEW_EVENT_START_TS = "new_event_start_ts" +const val WEEK_START_TIMESTAMP = "week_start_timestamp" +const val NEW_EVENT_SET_HOUR_DURATION = "new_event_set_hour_duration" +const val WEEK_START_DATE_TIME = "week_start_date_time" +const val CALDAV = "Caldav" +const val OPEN_MONTH = "open_month" -val MONTHLY_VIEW = 1 -val YEARLY_VIEW = 2 -val EVENTS_LIST_VIEW = 3 -val WEEKLY_VIEW = 4 -val DAILY_VIEW = 5 +const val MONTHLY_VIEW = 1 +const val YEARLY_VIEW = 2 +const val EVENTS_LIST_VIEW = 3 +const val WEEKLY_VIEW = 4 +const val DAILY_VIEW = 5 -val REMINDER_OFF = -1 +const val REMINDER_OFF = -1 -val DAY = 86400 -val WEEK = 604800 -val MONTH = 2592001 // exact value not taken into account, Joda is used for adding months and years -val YEAR = 31536000 +const val DAY = 86400 +const val WEEK = 604800 +const val MONTH = 2592001 // exact value not taken into account, Joda is used for adding months and years +const val YEAR = 31536000 -val DAY_MINUTES = 24 * 60 -val DAY_SECONDS = 24 * 60 * 60 -val WEEK_SECONDS = 7 * DAY_SECONDS +const val DAY_MINUTES = 24 * 60 +const val DAY_SECONDS = 24 * 60 * 60 +const val WEEK_SECONDS = 7 * DAY_SECONDS // Shared Preferences -val USE_24_HOUR_FORMAT = "use_24_hour_format" -val SUNDAY_FIRST = "sunday_first" -val WEEK_NUMBERS = "week_numbers" -val START_WEEKLY_AT = "start_weekly_at" -val END_WEEKLY_AT = "end_weekly_at" -val VIBRATE = "vibrate" -val REMINDER_SOUND = "reminder_sound" -val VIEW = "view" -val REMINDER_MINUTES = "reminder_minutes" -val DISPLAY_EVENT_TYPES = "display_event_types" -val FONT_SIZE = "font_size" -val CALDAV_SYNC = "caldav_sync" -val CALDAV_SYNCED_CALENDAR_IDS = "caldav_synced_calendar_ids" -val LAST_USED_CALDAV_CALENDAR = "last_used_caldav_calendar" -val SNOOZE_DELAY = "snooze_delay" -val DISPLAY_PAST_EVENTS = "display_past_events" -val REPLACE_DESCRIPTION = "replace_description" +const val USE_24_HOUR_FORMAT = "use_24_hour_format" +const val SUNDAY_FIRST = "sunday_first" +const val WEEK_NUMBERS = "week_numbers" +const val START_WEEKLY_AT = "start_weekly_at" +const val END_WEEKLY_AT = "end_weekly_at" +const val VIBRATE = "vibrate" +const val REMINDER_SOUND = "reminder_sound" +const val VIEW = "view" +const val REMINDER_MINUTES = "reminder_minutes" +const val REMINDER_MINUTES_2 = "reminder_minutes_2" +const val REMINDER_MINUTES_3 = "reminder_minutes_3" +const val DISPLAY_EVENT_TYPES = "display_event_types" +const val FONT_SIZE = "font_size" +const val CALDAV_SYNC = "caldav_sync" +const val CALDAV_SYNCED_CALENDAR_IDS = "caldav_synced_calendar_ids" +const val LAST_USED_CALDAV_CALENDAR = "last_used_caldav_calendar" +const val SNOOZE_DELAY = "snooze_delay" +const val DISPLAY_PAST_EVENTS = "display_past_events" +const val REPLACE_DESCRIPTION = "replace_description" val letterIDs = intArrayOf(R.string.sunday_letter, R.string.monday_letter, R.string.tuesday_letter, R.string.wednesday_letter, R.string.thursday_letter, R.string.friday_letter, R.string.saturday_letter) // repeat_rule for weekly repetition -val MONDAY = 1 -val TUESDAY = 2 -val WEDNESDAY = 4 -val THURSDAY = 8 -val FRIDAY = 16 -val SATURDAY = 32 -val SUNDAY = 64 -val EVERY_DAY = 127 +const val MONDAY = 1 +const val TUESDAY = 2 +const val WEDNESDAY = 4 +const val THURSDAY = 8 +const val FRIDAY = 16 +const val SATURDAY = 32 +const val SUNDAY = 64 +const val EVERY_DAY = 127 // repeat_rule for monthly repetition -val REPEAT_MONTH_SAME_DAY = 1 // ie 25th every month -val REPEAT_MONTH_ORDER_WEEKDAY_USE_LAST = 2 // ie every xth sunday. 4th if a month has 4 sundays, 5th if 5 -val REPEAT_MONTH_LAST_DAY = 3 // ie every last day of the month -val REPEAT_MONTH_ORDER_WEEKDAY = 4 // ie every 4th sunday, even if a month has 4 sundays only (will stay 4th even at months with 5) +const val REPEAT_MONTH_SAME_DAY = 1 // ie 25th every month +const val REPEAT_MONTH_ORDER_WEEKDAY_USE_LAST = 2 // ie every xth sunday. 4th if a month has 4 sundays, 5th if 5 +const val REPEAT_MONTH_LAST_DAY = 3 // ie every last day of the month +const val REPEAT_MONTH_ORDER_WEEKDAY = 4 // ie every 4th sunday, even if a month has 4 sundays only (will stay 4th even at months with 5) // special event flags -val FLAG_ALL_DAY = 1 +const val FLAG_ALL_DAY = 1 // constants related to ICS file exporting / importing -val BEGIN_CALENDAR = "BEGIN:VCALENDAR" -val END_CALENDAR = "END:VCALENDAR" -val CALENDAR_PRODID = "PRODID:-//Simple Mobile Tools//NONSGML Event Calendar//EN" -val CALENDAR_VERSION = "VERSION:2.0" -val BEGIN_EVENT = "BEGIN:VEVENT" -val END_EVENT = "END:VEVENT" -val BEGIN_ALARM = "BEGIN:VALARM" -val END_ALARM = "END:VALARM" -val DTSTART = "DTSTART" -val DTEND = "DTEND" -val LAST_MODIFIED = "LAST-MODIFIED" -val DURATION = "DURATION:" -val SUMMARY = "SUMMARY" -val DESCRIPTION = "DESCRIPTION:" -val UID = "UID:" -val ACTION = "ACTION:" -val TRIGGER = "TRIGGER:" -val RRULE = "RRULE:" -val CATEGORIES = "CATEGORIES:" -val STATUS = "STATUS:" -val EXDATE = "EXDATE" -val BYDAY = "BYDAY" -val BYMONTHDAY = "BYMONTHDAY" -val LOCATION = "LOCATION:" +const val BEGIN_CALENDAR = "BEGIN:VCALENDAR" +const val END_CALENDAR = "END:VCALENDAR" +const val CALENDAR_PRODID = "PRODID:-//Simple Mobile Tools//NONSGML Event Calendar//EN" +const val CALENDAR_VERSION = "VERSION:2.0" +const val BEGIN_EVENT = "BEGIN:VEVENT" +const val END_EVENT = "END:VEVENT" +const val BEGIN_ALARM = "BEGIN:VALARM" +const val END_ALARM = "END:VALARM" +const val DTSTART = "DTSTART" +const val DTEND = "DTEND" +const val LAST_MODIFIED = "LAST-MODIFIED" +const val DURATION = "DURATION:" +const val SUMMARY = "SUMMARY" +const val DESCRIPTION = "DESCRIPTION:" +const val UID = "UID:" +const val ACTION = "ACTION:" +const val TRIGGER = "TRIGGER:" +const val RRULE = "RRULE:" +const val CATEGORIES = "CATEGORIES:" +const val STATUS = "STATUS:" +const val EXDATE = "EXDATE" +const val BYDAY = "BYDAY" +const val BYMONTHDAY = "BYMONTHDAY" +const val LOCATION = "LOCATION:" // this tag isn't a standard ICS tag, but there's no official way of adding a category color in an ics file -val CATEGORY_COLOR = "CATEGORY_COLOR:" +const val CATEGORY_COLOR = "CATEGORY_COLOR:" -val DISPLAY = "DISPLAY" -val FREQ = "FREQ" -val UNTIL = "UNTIL" -val COUNT = "COUNT" -val INTERVAL = "INTERVAL" -val CONFIRMED = "CONFIRMED" -val VALUE = "VALUE" -val DATE = "DATE" +const val DISPLAY = "DISPLAY" +const val FREQ = "FREQ" +const val UNTIL = "UNTIL" +const val COUNT = "COUNT" +const val INTERVAL = "INTERVAL" +const val CONFIRMED = "CONFIRMED" +const val VALUE = "VALUE" +const val DATE = "DATE" -val DAILY = "DAILY" -val WEEKLY = "WEEKLY" -val MONTHLY = "MONTHLY" -val YEARLY = "YEARLY" +const val DAILY = "DAILY" +const val WEEKLY = "WEEKLY" +const val MONTHLY = "MONTHLY" +const val YEARLY = "YEARLY" -val MO = "MO" -val TU = "TU" -val WE = "WE" -val TH = "TH" -val FR = "FR" -val SA = "SA" -val SU = "SU" +const val MO = "MO" +const val TU = "TU" +const val WE = "WE" +const val TH = "TH" +const val FR = "FR" +const val SA = "SA" +const val SU = "SU" // font sizes -val FONT_SIZE_SMALL = 0 -val FONT_SIZE_MEDIUM = 1 -val FONT_SIZE_LARGE = 2 +const val FONT_SIZE_SMALL = 0 +const val FONT_SIZE_MEDIUM = 1 +const val FONT_SIZE_LARGE = 2 -val SOURCE_SIMPLE_CALENDAR = "simple-calendar" -val SOURCE_IMPORTED_ICS = "imported-ics" -val SOURCE_CONTACT_BIRTHDAY = "contact-birthday" -val SOURCE_CONTACT_ANNIVERSARY = "contact-anniversary" +const val SOURCE_SIMPLE_CALENDAR = "simple-calendar" +const val SOURCE_IMPORTED_ICS = "imported-ics" +const val SOURCE_CONTACT_BIRTHDAY = "contact-birthday" +const val SOURCE_CONTACT_ANNIVERSARY = "contact-anniversary" // deprecated -val SOURCE_GOOGLE_CALENDAR = 1 +const val SOURCE_GOOGLE_CALENDAR = 1 diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index eeadd4c68..25fd15e75 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -217,41 +217,6 @@ - - - - - - - - Diskouez niverennoù ar sizhun Froumal evit ar rebuzadurioù adc\'halv Soniri adc\'halv - Adc\'halv darvoud dre ziouer N\'eus bet kavet arload ebet gouest da arventennañ ur soniri Hini ebet An devezh n\'hall ket echuiñ abretoc\'h eget ma krog diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index f6194abe2..2232c67e1 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -193,7 +193,6 @@ Zobrazovat číslo týdne Vibrovat Tón oznámení - Standardní připomenutí události Nebyla nalezena žádná aplikace, která by mohla nastavit vyzvánění žádný Den nemůže skončit dřív, než začne diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 181612e49..8c1c96838 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -186,7 +186,6 @@ Vis ugenumre Vibrer under påmindelser Lyd til påmindelser - Påmindelsesstandard Der blev ikke fundet en app til indstilling af ringetone Ingen Dagen skal starte inden den slutter! diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 7110cc305..9c4b4c8fa 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -186,7 +186,6 @@ Zeige Kalenderwoche an Vibration bei Erinnerung Erinnerungston - Standard Termin Erinnerung Keine App zum Setzen des Klingeltons gefunden Kein Klingelton gewählt Terminbeginn kann nicht vor Terminende liegen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d90424205..e2cd8b0e8 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -186,7 +186,6 @@ Mostrar los números de la semana Vibración en notificación de recordatorio Sonido de recordatorio - Recordatorio predeterminado de un evento No se ha encontrado ninguna aplicación capaz de establecer el tono de llamada Ninguno El día no puede terminar antes de que comience diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e040055ce..45898ef7e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -186,7 +186,6 @@ Afficher les numéros de semaine Vibrer à la notification de rappel Son de rappel - Rappel d\'événement par défaut Aucune application capable de configurer la sonnerie trouvée Aucune Le jour ne peut pas se terminer plus tôt qu\'il ne débute diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index d86b67747..c39dcbb1b 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -187,7 +187,6 @@ सफ्ताह क्रमांक दिखाए Vibrate on reminder notification Reminder sound - Default event reminder No app capable of setting ringtone found None The day cannot end earlier than it starts diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index b0429b841..9d41c7962 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -186,7 +186,6 @@ Hetek sorszámának mutatása Emlékeztetőnél rezgés Reminder sound - Alapértelmezett emlékeztetés No app capable of setting ringtone found None The day cannot end earlier than it starts diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index fa22f895d..95ba74e65 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -186,7 +186,6 @@ Show week numbers Vibrate on reminder notification Reminder sound - Default event reminder No app capable of setting ringtone found None The day cannot end earlier than it starts diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 06b40797e..f70a5160f 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -187,7 +187,6 @@ הצגת מספרי השבועות בתצפית חודשית רטט בהתראת תזכורת צליל תזכורת - תזכורת קבועה לאירוע לא נמצאה אפליקציה להגדרת רינגטון ללא היום לא יכול להסתיים מוקדם משהוא מתחיל diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 22601fd64..1ed656ce6 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -186,7 +186,6 @@ 週番号を表示 リマインダー通知で振動 Reminder sound - デフォルトのイベント リマインダー No app capable of setting ringtone found None The day cannot end earlier than it starts diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 2422153be..857f5e69b 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -186,7 +186,6 @@ 주 번호 표시 알림 시 진동 알림 소리 - 기본 이벤트 알림 벨소리를 설정할 수 있는 앱이 없습니다 없음 요일은 시작하기 전에 끝날 수 없습니다 diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index f3a2412ba..f1e91fde7 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -186,7 +186,6 @@ Vis ukenummer Vibrer ved påminnelsesvarsel Påminnelseslyd - Standard hendelsespåminnelse Ingen app i stand til å sette ringetone funnet Ingen Dagen kan ikke slutte tidligere enn den starter diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 064120497..143721853 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -186,7 +186,6 @@ Weeknummers tonen Trillen bij notificaties Geluid voor herinnering - Standaardherinnering Geen app gevonden om geluid te kiezen Geen De begintijd valt na de eindtijd diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 43290c725..c7c403e3b 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -186,7 +186,6 @@ Vis ukenummer Vibrer ved påminnelsesvarsel Påminnelseslyd - Standard hendelsespåminnelse Ingen app i stand til å sette ringetone funnet Ingen Dagen kan ikke slutte tidligere enn den starter diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7e44b20fa..ae1a989e7 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -191,7 +191,6 @@ Pokazuj numery tygodnia Powiadamiaj wibracjami o wydarzeniu Dźwięk powiadomień - Domyślne przypomnienie o wydarzeniach Nie znalazłem aplikacji mogącej ustawiać dzwonki Żaden Dzień nie może zakończyć się wcześniej niż się zaczyna diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 096ee2bee..0ecbcd8db 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -186,7 +186,6 @@ Mostrar número das semanas Vibrar ao notificar sobre o lembrete Som do lembrete - Lembrete padrão Não foi encontrado nenhum aplicativo capaz de definir o som Nenhum O dia final não pode ser antes do início diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 2b06f6df3..bc9a57b21 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -186,7 +186,6 @@ Mostrar número das semanas Vibrar ao notificar sobre o lembrete Som do lembrete - Lembrete padrão Não foi encontrada uma aplicação capaz de definir o som Nenhum O dia final não pode ser antes do inicial diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9ea595661..39297f167 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -200,7 +200,6 @@ Отображать номера недель Вибрация при напоминании Звук напоминания - Напоминание для событий по умолчанию Не найдено приложение для выбора рингтона Нет Конец дня не может быть раньше начала diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 71cff9935..85bfde8f7 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -193,7 +193,6 @@ Zobraziť čísla týždňov Vibrovať pri pripomienke Zvučka pripomienky - Predvolená hodnota pripomienky Nenašla sa žiadna aplikácia na zmenu zvučky Žiadna Deň nemôže skončiť skôr než začne diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index fff9c7817..9589b2423 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -186,7 +186,6 @@ Visa veckonumret i månadsvyn Vibrera vid påminnelseaviseringen Påminnelseljud - Standardhändelsepåminnelse Hittade ingen app som kan ställa in ljudet Ingen Dagen kan inte börja innan den tar slut diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6def3cd2c..e0a75e3cc 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -186,7 +186,6 @@ Aylık görünümde hafta sayılarını göster Hatırlatma bildiriminde titreşim Hatırlatma sesi - Varsayılan olay hatırlatıcısı Zil sesi ayarlayabilen hiçbir uygulama bulunamadı Boş Gün başlamadan önce bitemez diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c9d6ab2ee..563a88c90 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -186,7 +186,6 @@ Show week numbers Vibrate on reminder notification Reminder sound - Default event reminder No app capable of setting ringtone found None The day cannot end earlier than it starts From 58102447af2a7cedb27851661e158f130b07fd96 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 31 Jan 2018 23:49:38 +0100 Subject: [PATCH 09/94] add a setting for deleting all events --- .../calendar/activities/SettingsActivity.kt | 10 +++++++++ .../calendar/helpers/CalDAVHandler.kt | 1 - .../calendar/helpers/DBHelper.kt | 4 ++++ app/src/main/res/layout/activity_settings.xml | 22 +++++++++++++++++++ app/src/main/res/values-br/strings.xml | 2 ++ app/src/main/res/values-cs/strings.xml | 2 ++ app/src/main/res/values-da/strings.xml | 2 ++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-es/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-hi-rIN/strings.xml | 2 ++ app/src/main/res/values-hu/strings.xml | 2 ++ app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-iw/strings.xml | 2 ++ app/src/main/res/values-ja/strings.xml | 2 ++ app/src/main/res/values-ko/strings.xml | 2 ++ app/src/main/res/values-nb/strings.xml | 2 ++ app/src/main/res/values-nl/strings.xml | 2 ++ app/src/main/res/values-no/strings.xml | 2 ++ app/src/main/res/values-pl/strings.xml | 2 ++ app/src/main/res/values-pt-rBR/strings.xml | 2 ++ app/src/main/res/values-pt/strings.xml | 2 ++ app/src/main/res/values-ru/strings.xml | 2 ++ app/src/main/res/values-sk/strings.xml | 2 ++ app/src/main/res/values-sv/strings.xml | 2 ++ app/src/main/res/values-tr/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 27 files changed, 82 insertions(+), 1 deletion(-) 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 51c0d8843..cb3c8b68a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.helpers.FONT_SIZE_LARGE import com.simplemobiletools.calendar.helpers.FONT_SIZE_MEDIUM import com.simplemobiletools.calendar.helpers.FONT_SIZE_SMALL import com.simplemobiletools.calendar.models.EventType +import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_READ_CALENDAR @@ -49,6 +50,7 @@ class SettingsActivity : SimpleActivity() { setupManageEventTypes() setupHourFormat() setupSundayFirst() + setupDeleteAllEvents() setupReplaceDescription() setupWeekNumbers() setupWeeklyStart() @@ -204,6 +206,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupDeleteAllEvents() { + settings_delete_all_events_holder.setOnClickListener { + ConfirmationDialog(this, messageId = R.string.delete_all_events_confirmation) { + dbHelper.deleteAllEvents() + } + } + } + private fun setupReplaceDescription() { settings_replace_description.isChecked = config.replaceDescription settings_replace_description_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt index 7eb444543..90d166db4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/CalDAVHandler.kt @@ -412,7 +412,6 @@ class CalDAVHandler(val context: Context) { try { context.contentResolver.delete(contentUri, null, null) } catch (ignored: Exception) { - } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index 324aef5d5..5f5d97b98 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -426,6 +426,10 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont return fillEvents(cursor) } + fun deleteAllEvents() { + + } + fun deleteEvents(ids: Array, deleteFromCalDAV: Boolean) { val args = TextUtils.join(", ", ids) val selection = "$MAIN_TABLE_NAME.$COL_ID IN ($args)" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 25fd15e75..50ef0227d 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -109,6 +109,28 @@ + + + + + + Daleañ an adc\'halv eus Widjetoù Amsaviñ an deskrivadur gant al lec\'hiadur er gwell roll enankadoù + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 2232c67e1..98f1486a9 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -202,6 +202,8 @@ Odložit připomenutí pomocí funkce Snooze by Widgety Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 8c1c96838..82b36b4ef 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -195,6 +195,8 @@ Udsæt påmindelsen med en snooze på Widgets Erstat beskrivelse med sted på visningen af begivenhedslisten + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 9c4b4c8fa..41574ee21 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -195,6 +195,8 @@ Erinnerung mit Snooze verschieben um Widgets Ersetze Beschreibung mit Ort bei Listeneinträgen + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e2cd8b0e8..0c100eb3a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -195,6 +195,8 @@ Retrasar recordatorio durante Widgets Remplazar la descripción con la ubicación al mostrar entradas + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 45898ef7e..3dc89a785 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -195,6 +195,8 @@ Reporter le rappel avec Snooze de Widgets Remplacer la description par la position dans la vue sous forme de liste + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index c39dcbb1b..5682d5d37 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -196,6 +196,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 9d41c7962..0bb7d0d41 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -195,6 +195,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 95ba74e65..e71a0caf3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -195,6 +195,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index f70a5160f..d0dfe4bbc 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -196,6 +196,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 1ed656ce6..565926fa1 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -195,6 +195,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 857f5e69b..7655fed6d 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -195,6 +195,8 @@ 스누즈 알림 시간 위젯 목록보기의 설명정보를 위치정보로 대체 + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index f1e91fde7..35855ca10 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -195,6 +195,8 @@ Utsett påminnelser med Snooze Moduler Erstatt Beskrivelse med Sted i listevisningen + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 143721853..955aada6a 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -195,6 +195,8 @@ Herinnering uitstellen met Widgets Beschrijving vervangen door Locatie in lijstweergave + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index c7c403e3b..62e781e9a 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -195,6 +195,8 @@ Utsett påminnelser med Snooze med Moduler Erstatt Beskrivelse med Sted i listevisningen + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index ae1a989e7..038a9f71a 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -200,6 +200,8 @@ Opóźnij przypomnienie o Widżety Zastąp Opis z Lokalizacją w widoku wejść + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 0ecbcd8db..2d26d119b 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -195,6 +195,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bc9a57b21..ce7d69f4c 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -195,6 +195,8 @@ Adiar lembrete com a opção Snooze Widgets Substituir descrição e localização nas entradas da vista de lista + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 39297f167..e380ef2b7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -209,6 +209,8 @@ Отложить напоминание на Виджеты Показывать место вместо описания в списке событий + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 85bfde8f7..f70b39f73 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -202,6 +202,8 @@ Posunúť pripomienku s Odložiť o Widgety Nahradiť Popis udalosti Miestom v listových zobrazeniach + Odstrániť všetky udalosti + Ste si istý, že chcete odstrániť všetky udalosti? Všetky typy udalostí a nastavenia ostanú nedotknuté. CalDAV diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 9589b2423..916421b08 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -195,6 +195,8 @@ Skjut upp påminnelse med Snooza Widgetar Ersätt Beskrivning med Plats i listvyn + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index e0a75e3cc..f24fbbba7 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -195,6 +195,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 563a88c90..bd5e44685 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -195,6 +195,8 @@ Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries + Delete all events + Are you sure you want to delete all events? This will leave your event types and other settings intact. CalDAV From 7bf1d9253213d6529a5885af385258d7b6698638 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 00:03:51 +0100 Subject: [PATCH 10/94] fix #123, allow deleting all events --- .../kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index 5f5d97b98..8d1424cee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -427,7 +427,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont } fun deleteAllEvents() { - + val cursor = getEventsCursor() + val events = fillEvents(cursor).map { it.id.toString() }.toTypedArray() + deleteEvents(events, true) } fun deleteEvents(ids: Array, deleteFromCalDAV: Boolean) { From 4edd3af2026ff23ad6c63339c2e6571958c1daac Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 00:07:41 +0100 Subject: [PATCH 11/94] make sure removing fragments is synchronous, hopefully fixes blank screens --- .../com/simplemobiletools/calendar/activities/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index 6aac1e10e..b075fd69b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -499,7 +499,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { private fun updateViewPager(dayCode: String? = Formatter.getTodayCode(applicationContext)) { val fragment = getFragmentsHolder() currentFragments.forEach { - supportFragmentManager.beginTransaction().remove(it).commit() + supportFragmentManager.beginTransaction().remove(it).commitNow() } currentFragments.clear() currentFragments.add(fragment) From 454a48d5b4ec5b8015dc960c89b85c7c0ed6c461 Mon Sep 17 00:00:00 2001 From: Phoenix1747 Date: Thu, 1 Feb 2018 09:57:15 +0100 Subject: [PATCH 12/94] Update strings.xml --- app/src/main/res/values-de/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 41574ee21..782f9dca9 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -195,8 +195,8 @@ Erinnerung mit Snooze verschieben um Widgets Ersetze Beschreibung mit Ort bei Listeneinträgen - Delete all events - Are you sure you want to delete all events? This will leave your event types and other settings intact. + Alle Termine löschen + Bist du sicher, dass du alle Termine löschen willst? Deine Termintypen und Einstellungen bleiben erhalten. CalDAV From fdc3fff54abaffaa83f2da56ce4d96db692fd6ea Mon Sep 17 00:00:00 2001 From: 10cents Date: Thu, 1 Feb 2018 11:22:15 +0100 Subject: [PATCH 13/94] delete_all_events_confirmation done --- app/src/main/res/values-da/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 82b36b4ef..97e0dbab2 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -195,8 +195,8 @@ Udsæt påmindelsen med en snooze på Widgets Erstat beskrivelse med sted på visningen af begivenhedslisten - Delete all events - Are you sure you want to delete all events? This will leave your event types and other settings intact. + Slet alle begivenheder + Er du sikker på at du vil slette alle begivenheder? Dine begivenhedstyper og andre indstillinger vil forblive intakte. CalDAV From e0b070b6dca91f8f225d0a4fd1e7b4b1a61f2115 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 12:04:56 +0100 Subject: [PATCH 14/94] fix #334, make sure the FAB works properly at third party intents --- .../simplemobiletools/calendar/activities/MainActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index b075fd69b..526c5f96f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -72,7 +72,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { appLaunched() checkWhatsNewDialog() calendar_fab.beVisibleIf(config.storedView != YEARLY_VIEW) + calendar_fab.setOnClickListener { + launchNewEventIntent(currentFragments.last().getNewEventDayCode()) + } + storeStateVariables() if (resources.getBoolean(R.bool.portrait_only)) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT } @@ -93,7 +97,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { } } - storeStateVariables() updateViewPager() if (!hasPermission(PERMISSION_WRITE_CALENDAR) || !hasPermission(PERMISSION_READ_CALENDAR)) { @@ -104,9 +107,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { refreshCalDAVCalendars(false) } - calendar_fab.setOnClickListener { - launchNewEventIntent(currentFragments.last().getNewEventDayCode()) - } checkOpenIntents() } From 7a3e0a2e985835099b28b508980a43b80b6971fa Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 12:30:42 +0100 Subject: [PATCH 15/94] fix #330, show a Back button on the actionmenu at opening a subview --- .../simplemobiletools/calendar/activities/MainActivity.kt | 4 ++++ .../calendar/activities/SettingsActivity.kt | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index 526c5f96f..ae80d2783 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -179,6 +179,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { R.id.export_events -> tryExportEvents() R.id.settings -> launchSettings() R.id.about -> launchAbout() + android.R.id.home -> onBackPressed() else -> return super.onOptionsItemSelected(item) } return true @@ -523,6 +524,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commit() resetActionBarTitle() calendar_fab.beVisible() + supportActionBar?.setDisplayHomeAsUpEnabled(true) } fun openDayFromMonthly(dateTime: DateTime) { @@ -532,6 +534,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { bundle.putString(DAY_CODE, Formatter.getDayCodeFromDateTime(dateTime)) fragment.arguments = bundle supportFragmentManager.beginTransaction().add(R.id.fragments_holder, fragment).commit() + supportActionBar?.setDisplayHomeAsUpEnabled(true) } private fun getThisWeekDateTime(): String { @@ -559,6 +562,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { updateActionBarTitle() } calendar_fab.beGoneIf(currentFragments.size == 1 && config.storedView == YEARLY_VIEW) + supportActionBar?.setDisplayHomeAsUpEnabled(currentFragments.size > 1) } private fun refreshViewPager() { 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 cb3c8b68a..a5e38a50d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -334,10 +334,11 @@ class SettingsActivity : SimpleActivity() { } private fun getDisplayPastEventsText(displayPastEvents: Int): String { - return if (displayPastEvents == 0) + return if (displayPastEvents == 0) { getString(R.string.never) - else + } else { getFormattedMinutes(displayPastEvents, false) + } } private fun setupFontSize() { From bf179350e88ca3ae55bbab6e8f6ed220dbef56a1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 13:30:06 +0100 Subject: [PATCH 16/94] apply the month fragment padding only to the top --- app/src/main/res/layout/fragment_month.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/fragment_month.xml b/app/src/main/res/layout/fragment_month.xml index 9cbf46536..a7c627fdb 100644 --- a/app/src/main/res/layout/fragment_month.xml +++ b/app/src/main/res/layout/fragment_month.xml @@ -5,7 +5,7 @@ android:id="@+id/month_calendar_holder" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="@dimen/medium_margin"> + android:paddingTop="@dimen/medium_margin"> From 829fd61ec236371672170981ef2950f95ea121b0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 13:42:16 +0100 Subject: [PATCH 17/94] remove some deprecated constants --- .../com/simplemobiletools/calendar/helpers/Constants.kt | 3 --- .../com/simplemobiletools/calendar/helpers/DBHelper.kt | 7 +++---- 2 files changed, 3 insertions(+), 7 deletions(-) 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 d48f72f0e..b3ee11732 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/Constants.kt @@ -137,6 +137,3 @@ const val SOURCE_SIMPLE_CALENDAR = "simple-calendar" const val SOURCE_IMPORTED_ICS = "imported-ics" const val SOURCE_CONTACT_BIRTHDAY = "contact-birthday" const val SOURCE_CONTACT_ANNIVERSARY = "contact-anniversary" - -// deprecated -const val SOURCE_GOOGLE_CALENDAR = 1 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index 8d1424cee..c74bce1c7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -38,7 +38,6 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont private val COL_LAST_UPDATED = "last_updated" private val COL_EVENT_SOURCE = "event_source" private val COL_LOCATION = "location" - private val COL_SOURCE = "source" // deprecated private val META_TABLE_NAME = "events_meta" private val COL_EVENT_ID = "event_id" @@ -65,9 +64,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont private val mDb: SQLiteDatabase = writableDatabase companion object { - private val DB_VERSION = 19 - val DB_NAME = "events.db" - val REGULAR_EVENT_TYPE_ID = 1 + private const val DB_VERSION = 19 + const val DB_NAME = "events.db" + const val REGULAR_EVENT_TYPE_ID = 1 var dbInstance: DBHelper? = null fun newInstance(context: Context): DBHelper { From 0c57eb02388cd7acd98ee17aa242588ad8794d2d Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 14:15:54 +0100 Subject: [PATCH 18/94] remove the customizable snooze delay from settings --- .../calendar/activities/SettingsActivity.kt | 15 -------- app/src/main/res/layout/activity_settings.xml | 35 ------------------- 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-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-ko/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/strings.xml | 1 - 25 files changed, 73 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 a5e38a50d..930607d7a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -57,7 +57,6 @@ class SettingsActivity : SimpleActivity() { setupWeeklyEnd() setupVibrate() setupReminderSound() - setupSnoozeDelay() setupDisplayPastEvents() setupFontSize() updateTextColors(settings_holder) @@ -295,20 +294,6 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupSnoozeDelay() { - updateSnoozeText() - settings_snooze_delay_holder.setOnClickListener { - SnoozePickerDialog(this, config.snoozeDelay) { - config.snoozeDelay = it - updateSnoozeText() - } - } - } - - private fun updateSnoozeText() { - settings_snooze_delay.text = res.getQuantityString(R.plurals.by_minutes, config.snoozeDelay, config.snoozeDelay) - } - private fun getHoursString(hours: Int): String { return if (hours < 10) { "0$hours:00" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 50ef0227d..e9e3eede6 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -204,41 +204,6 @@ - - - - - - - - Goubredañ CalDAV Roll an darvoudoù Skrammañ darvoudoù an amzer tremenet - Daleañ an adc\'halv eus Widjetoù Amsaviñ an deskrivadur gant al lec\'hiadur er gwell roll enankadoù Delete all events diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 98f1486a9..fee52920d 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -199,7 +199,6 @@ CalDAV sync Seznamy událostí Zobrazit minulé události - Odložit připomenutí pomocí funkce Snooze by Widgety Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 97e0dbab2..4ad714e89 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Begivenhedsliste Vis overståede begivenheder - Udsæt påmindelsen med en snooze på Widgets Erstat beskrivelse med sted på visningen af begivenhedslisten Slet alle begivenheder diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 782f9dca9..e5c5a3e3a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -192,7 +192,6 @@ CalDAV Sync Terminlisten Vergangene Termine anzeigen - Erinnerung mit Snooze verschieben um Widgets Ersetze Beschreibung mit Ort bei Listeneinträgen Alle Termine löschen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 0c100eb3a..9888980a6 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -192,7 +192,6 @@ Sincronizar CalDAV Listas de eventos Mostrar eventos pasados - Retrasar recordatorio durante Widgets Remplazar la descripción con la ubicación al mostrar entradas Delete all events diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 3dc89a785..2df1519c0 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -192,7 +192,6 @@ Synchronisation CalDAV Listes d\'événements Afficher les événements du passé - Reporter le rappel avec Snooze de Widgets Remplacer la description par la position dans la vue sous forme de liste Delete all events diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index 5682d5d37..4285ac226 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -193,7 +193,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 0bb7d0d41..2972c4b8d 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e71a0caf3..c0d3d3665 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index d0dfe4bbc..a8890c30e 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -193,7 +193,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 565926fa1..95538d099 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 7655fed6d..82e00d521 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -192,7 +192,6 @@ CalDAV 동기화 Event lists 과거의 이벤트 표시 - 스누즈 알림 시간 위젯 목록보기의 설명정보를 위치정보로 대체 Delete all events diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 35855ca10..f787ab5c4 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -192,7 +192,6 @@ CalDAV-synkronisering Hendelseslister Vis hendelser fra fortiden - Utsett påminnelser med Snooze Moduler Erstatt Beskrivelse med Sted i listevisningen Delete all events diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 955aada6a..e456b58ea 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -192,7 +192,6 @@ CalDAV-synchronisatie Afsprakenlijst Afgelopen afspraken tonen - Herinnering uitstellen met Widgets Beschrijving vervangen door Locatie in lijstweergave Delete all events diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 62e781e9a..458b4e73c 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -192,7 +192,6 @@ CalDAV-synkronisering Hendelseslister Vis hendelser fra fortiden - Utsett påminnelser med Snooze med Moduler Erstatt Beskrivelse med Sted i listevisningen Delete all events diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 038a9f71a..db65318a4 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -197,7 +197,6 @@ Synchronizacja CalDAV Lista wydarzeń Pokazuj wydarzenia z przeszłości - Opóźnij przypomnienie o Widżety Zastąp Opis z Lokalizacją w widoku wejść Delete all events diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 2d26d119b..b9eb5fa6c 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index ce7d69f4c..c5beb9865 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -192,7 +192,6 @@ Sincronização CalDAV Lista de eventos Mostrar eventos passados - Adiar lembrete com a opção Snooze Widgets Substituir descrição e localização nas entradas da vista de lista Delete all events diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e380ef2b7..4ed0ad605 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -206,7 +206,6 @@ Синхронизация по CalDAV Списки событий Показывать прошедшие события - Отложить напоминание на Виджеты Показывать место вместо описания в списке событий Delete all events diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f70b39f73..0e1e2f13d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -199,7 +199,6 @@ CalDAV synchronizácia Zoznamy udalostí Zobraziť minulé udalosti spred - Posunúť pripomienku s Odložiť o Widgety Nahradiť Popis udalosti Miestom v listových zobrazeniach Odstrániť všetky udalosti diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 916421b08..f2c8386e4 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -192,7 +192,6 @@ CalDAV-synkronisering Händelselistor Visa tidigare händelser - Skjut upp påminnelse med Snooza Widgetar Ersätt Beskrivning med Plats i listvyn Delete all events diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f24fbbba7..9d0f16ebd 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bd5e44685..4b91cae5a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -192,7 +192,6 @@ CalDAV sync Event lists Display events from the past - Postpone reminder with Snooze by Widgets Replace Description with Location at list view entries Delete all events From a9eee4ff50ddf36751bc7c16788947f5aa72a7d6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 14:45:32 +0100 Subject: [PATCH 19/94] move RepeatIntervalDialog and ReminderDialog in activity extensions --- .../calendar/activities/SimpleActivity.kt | 87 +------------------ .../calendar/extensions/Activity.kt | 81 ++++++++++++++++- 2 files changed, 81 insertions(+), 87 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SimpleActivity.kt index c66b67731..ab24d64f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SimpleActivity.kt @@ -1,90 +1,5 @@ package com.simplemobiletools.calendar.activities -import com.simplemobiletools.calendar.R -import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog -import com.simplemobiletools.calendar.dialogs.CustomEventRepeatIntervalDialog -import com.simplemobiletools.calendar.extensions.getFormattedMinutes -import com.simplemobiletools.calendar.extensions.getRepetitionText -import com.simplemobiletools.calendar.helpers.DAY -import com.simplemobiletools.calendar.helpers.MONTH -import com.simplemobiletools.calendar.helpers.WEEK -import com.simplemobiletools.calendar.helpers.YEAR import com.simplemobiletools.commons.activities.BaseSimpleActivity -import com.simplemobiletools.commons.dialogs.RadioGroupDialog -import com.simplemobiletools.commons.extensions.hideKeyboard -import com.simplemobiletools.commons.models.RadioItem -import java.util.TreeSet -import kotlin.collections.ArrayList -open class SimpleActivity : BaseSimpleActivity() { - protected fun showEventReminderDialog(curMinutes: Int, callback: (minutes: Int) -> Unit) { - hideKeyboard() - val minutes = TreeSet() - minutes.apply { - add(-1) - add(0) - add(10) - add(30) - add(curMinutes) - } - - val items = ArrayList(minutes.size + 1) - minutes.mapIndexedTo(items, { index, value -> - RadioItem(index, getFormattedMinutes(value), value) - }) - - var selectedIndex = 0 - minutes.forEachIndexed { index, value -> - if (value == curMinutes) - selectedIndex = index - } - - items.add(RadioItem(-2, getString(R.string.custom))) - - RadioGroupDialog(this, items, selectedIndex) { - if (it == -2) { - CustomEventReminderDialog(this) { - callback(it) - } - } else { - callback(it as Int) - } - } - } - - protected fun showEventRepeatIntervalDialog(curSeconds: Int, callback: (minutes: Int) -> Unit) { - hideKeyboard() - val seconds = TreeSet() - seconds.apply { - add(0) - add(DAY) - add(WEEK) - add(MONTH) - add(YEAR) - add(curSeconds) - } - - val items = ArrayList(seconds.size + 1) - seconds.mapIndexedTo(items, { index, value -> - RadioItem(index, getRepetitionText(value), value) - }) - - var selectedIndex = 0 - seconds.forEachIndexed { index, value -> - if (value == curSeconds) - selectedIndex = index - } - - items.add(RadioItem(-1, getString(R.string.custom))) - - RadioGroupDialog(this, items, selectedIndex) { - if (it == -1) { - CustomEventRepeatIntervalDialog(this) { - callback(it) - } - } else { - callback(it as Int) - } - } - } -} +open class SimpleActivity : BaseSimpleActivity() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt index ce0577fe5..d2099fae0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt @@ -1,13 +1,21 @@ package com.simplemobiletools.calendar.extensions +import android.app.Activity import com.simplemobiletools.calendar.BuildConfig import com.simplemobiletools.calendar.R -import com.simplemobiletools.calendar.helpers.IcsExporter +import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog +import com.simplemobiletools.calendar.dialogs.CustomEventRepeatIntervalDialog +import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.getFilePublicUri +import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.shareUri import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.models.RadioItem import java.io.File +import java.util.TreeSet +import kotlin.collections.ArrayList fun BaseSimpleActivity.shareEvents(ids: List) { val file = getTempFile() @@ -36,3 +44,74 @@ fun BaseSimpleActivity.getTempFile(): File? { return File(folder, "events.ics") } + +fun Activity.showEventReminderDialog(curMinutes: Int, callback: (minutes: Int) -> Unit) { + hideKeyboard() + val minutes = TreeSet() + minutes.apply { + add(-1) + add(0) + add(10) + add(30) + add(curMinutes) + } + + val items = ArrayList(minutes.size + 1) + minutes.mapIndexedTo(items, { index, value -> + RadioItem(index, getFormattedMinutes(value), value) + }) + + var selectedIndex = 0 + minutes.forEachIndexed { index, value -> + if (value == curMinutes) + selectedIndex = index + } + + items.add(RadioItem(-2, getString(R.string.custom))) + + RadioGroupDialog(this, items, selectedIndex) { + if (it == -2) { + CustomEventReminderDialog(this) { + callback(it) + } + } else { + callback(it as Int) + } + } +} + +fun Activity.showEventRepeatIntervalDialog(curSeconds: Int, callback: (minutes: Int) -> Unit) { + hideKeyboard() + val seconds = TreeSet() + seconds.apply { + add(0) + add(DAY) + add(WEEK) + add(MONTH) + add(YEAR) + add(curSeconds) + } + + val items = ArrayList(seconds.size + 1) + seconds.mapIndexedTo(items, { index, value -> + RadioItem(index, getRepetitionText(value), value) + }) + + var selectedIndex = 0 + seconds.forEachIndexed { index, value -> + if (value == curSeconds) + selectedIndex = index + } + + items.add(RadioItem(-1, getString(R.string.custom))) + + RadioGroupDialog(this, items, selectedIndex) { + if (it == -1) { + CustomEventRepeatIntervalDialog(this) { + callback(it) + } + } else { + callback(it as Int) + } + } +} From c671727270d2e9b426daf6a5a28330102e8e6039 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 16:10:32 +0100 Subject: [PATCH 20/94] allow changing the Snooze interval after clicking Snooze --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 6 ++- .../activities/SnoozeReminderActivity.kt | 39 +++++++++++++++++++ .../calendar/extensions/Activity.kt | 18 ++++++--- .../calendar/extensions/Context.kt | 13 ++++--- .../calendar/services/SnoozeService.kt | 23 ----------- 6 files changed, 63 insertions(+), 38 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/calendar/activities/SnoozeReminderActivity.kt delete mode 100644 app/src/main/kotlin/com/simplemobiletools/calendar/services/SnoozeService.kt diff --git a/app/build.gradle b/app/build.gradle index 45b9baf4b..b6a9abe16 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,7 +43,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.8.11' + implementation 'com.simplemobiletools:commons:3.9.7' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.android.support:multidex:1.0.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7bdfe96d0..bf49ce368 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -119,6 +119,10 @@ android:label="@string/event_types" android:parentActivityName=".activities.SettingsActivity"/> + + - - diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SnoozeReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SnoozeReminderActivity.kt new file mode 100644 index 000000000..fce53b522 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SnoozeReminderActivity.kt @@ -0,0 +1,39 @@ +package com.simplemobiletools.calendar.activities + +import android.app.NotificationManager +import android.content.Context +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import com.simplemobiletools.calendar.extensions.config +import com.simplemobiletools.calendar.extensions.dbHelper +import com.simplemobiletools.calendar.extensions.scheduleEventIn +import com.simplemobiletools.calendar.extensions.showEventReminderDialog +import com.simplemobiletools.calendar.helpers.EVENT_ID + +class SnoozeReminderActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + showEventReminderDialog(config.snoozeDelay, true, cancelCallback = { dialogCancelled() }) { + val eventId = intent.getIntExtra(EVENT_ID, 0) + val event = dbHelper.getEventWithId(eventId) + config.snoozeDelay = it + + if (eventId != 0 && event != null) { + applicationContext.scheduleEventIn(System.currentTimeMillis() + it * 60000, event) + val manager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + manager.cancel(eventId) + } + finishActivity() + } + } + + private fun dialogCancelled() { + finishActivity() + } + + private fun finishActivity() { + finish() + overridePendingTransition(0, 0) + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt index d2099fae0..41c540e9e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Activity.kt @@ -45,31 +45,37 @@ fun BaseSimpleActivity.getTempFile(): File? { return File(folder, "events.ics") } -fun Activity.showEventReminderDialog(curMinutes: Int, callback: (minutes: Int) -> Unit) { +fun Activity.showEventReminderDialog(curMinutes: Int, isSnoozePicker: Boolean = false, cancelCallback: (() -> Unit)? = null, callback: (minutes: Int) -> Unit) { hideKeyboard() val minutes = TreeSet() minutes.apply { - add(-1) - add(0) + if (!isSnoozePicker) { + add(-1) + add(0) + } + add(5) add(10) + add(20) add(30) + add(60) add(curMinutes) } val items = ArrayList(minutes.size + 1) minutes.mapIndexedTo(items, { index, value -> - RadioItem(index, getFormattedMinutes(value), value) + RadioItem(index, getFormattedMinutes(value, !isSnoozePicker), value) }) var selectedIndex = 0 minutes.forEachIndexed { index, value -> - if (value == curMinutes) + if (value == curMinutes) { selectedIndex = index + } } items.add(RadioItem(-2, getString(R.string.custom))) - RadioGroupDialog(this, items, selectedIndex) { + RadioGroupDialog(this, items, selectedIndex, showOKButton = isSnoozePicker, cancelCallback = cancelCallback) { if (it == -2) { CustomEventReminderDialog(this) { callback(it) 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 1a2940808..7e941a940 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -23,12 +23,12 @@ import com.simplemobiletools.calendar.BuildConfig import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.activities.EventActivity import com.simplemobiletools.calendar.activities.SimpleActivity +import com.simplemobiletools.calendar.activities.SnoozeReminderActivity import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.helpers.Formatter import com.simplemobiletools.calendar.models.* import com.simplemobiletools.calendar.receivers.CalDAVSyncReceiver import com.simplemobiletools.calendar.receivers.NotificationReceiver -import com.simplemobiletools.calendar.services.SnoozeService import com.simplemobiletools.commons.extensions.* import org.joda.time.DateTime import org.joda.time.DateTimeZone @@ -217,11 +217,13 @@ private fun getNotification(context: Context, pendingIntent: PendingIntent, even .setChannelId(channelId) .addAction(R.drawable.ic_snooze, context.getString(R.string.snooze), getSnoozePendingIntent(context, event)) - if (context.isLollipopPlus()) + if (context.isLollipopPlus()) { builder.setVisibility(Notification.VISIBILITY_PUBLIC) + } - if (context.config.vibrateOnReminder) + if (context.config.vibrateOnReminder) { builder.setVibrate(longArrayOf(0, 300, 300, 300)) + } return builder.build() } @@ -236,10 +238,9 @@ private fun getPendingIntent(context: Context, event: Event): PendingIntent { } private fun getSnoozePendingIntent(context: Context, event: Event): PendingIntent { - val intent = Intent(context, SnoozeService::class.java).setAction("snooze") + val intent = Intent(context, SnoozeReminderActivity::class.java).setAction("snooze") intent.putExtra(EVENT_ID, event.id) - intent.putExtra(EVENT_OCCURRENCE_TS, event.startTS) - return PendingIntent.getService(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT) + return PendingIntent.getActivity(context, event.id, intent, PendingIntent.FLAG_UPDATE_CURRENT) } fun Context.launchNewEventIntent(dayCode: String = Formatter.getTodayCode(this)) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/services/SnoozeService.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/services/SnoozeService.kt deleted file mode 100644 index 03f06176b..000000000 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/services/SnoozeService.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.simplemobiletools.calendar.services - -import android.app.IntentService -import android.app.NotificationManager -import android.content.Context -import android.content.Intent -import com.simplemobiletools.calendar.extensions.config -import com.simplemobiletools.calendar.extensions.dbHelper -import com.simplemobiletools.calendar.extensions.scheduleEventIn -import com.simplemobiletools.calendar.helpers.EVENT_ID - -class SnoozeService : IntentService("Snooze") { - override fun onHandleIntent(intent: Intent) { - val eventId = intent.getIntExtra(EVENT_ID, 0) - val event = dbHelper.getEventWithId(eventId) - - if (eventId != 0 && event != null) { - applicationContext.scheduleEventIn(System.currentTimeMillis() + applicationContext.config.snoozeDelay * 60000, event) - val manager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - manager.cancel(eventId) - } - } -} From 93efa290376c083d30178639ba01084d3bbeaa7e Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 17:16:36 +0100 Subject: [PATCH 21/94] update commons to 3.9.9 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index b6a9abe16..42132a374 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,7 +43,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.7' + implementation 'com.simplemobiletools:commons:3.9.9' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.android.support:multidex:1.0.2' From 9eee2253418e26688fa1f40d7a16395b33d5e328 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 17:23:59 +0100 Subject: [PATCH 22/94] add an option for preventing displaying of Whats New --- .../calendar/activities/SettingsActivity.kt | 10 +++++++++- app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) 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 930607d7a..4dd4d4a80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -11,7 +11,6 @@ import com.simplemobiletools.calendar.BuildConfig import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.dialogs.CustomEventReminderDialog import com.simplemobiletools.calendar.dialogs.SelectCalendarsDialog -import com.simplemobiletools.calendar.dialogs.SnoozePickerDialog import com.simplemobiletools.calendar.extensions.* import com.simplemobiletools.calendar.helpers.CalDAVHandler import com.simplemobiletools.calendar.helpers.FONT_SIZE_LARGE @@ -50,6 +49,7 @@ class SettingsActivity : SimpleActivity() { setupManageEventTypes() setupHourFormat() setupSundayFirst() + setupAvoidWhatsNew() setupDeleteAllEvents() setupReplaceDescription() setupWeekNumbers() @@ -205,6 +205,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupAvoidWhatsNew() { + settings_avoid_whats_new.isChecked = config.avoidWhatsNew + settings_avoid_whats_new_holder.setOnClickListener { + settings_avoid_whats_new.toggle() + config.avoidWhatsNew = settings_avoid_whats_new.isChecked + } + } + private fun setupDeleteAllEvents() { settings_delete_all_events_holder.setOnClickListener { ConfirmationDialog(this, messageId = R.string.delete_all_events_confirmation) { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index e9e3eede6..164779ea2 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -109,6 +109,26 @@ + + + + + + Date: Thu, 1 Feb 2018 18:01:25 +0100 Subject: [PATCH 23/94] update kotlin to 1.2.21 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 89e92a15c..66c86d612 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.0' + ext.kotlin_version = '1.2.21' repositories { jcenter() From 328a1d4cf68c0110a40a6e3f81e9159979744acf Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 18:17:31 +0100 Subject: [PATCH 24/94] update version to 3.2.3 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 42132a374..d8cef6523 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.calendar" minSdkVersion 16 targetSdkVersion 27 - versionCode 110 - versionName "3.2.2" + versionCode 111 + versionName "3.2.3" multiDexEnabled true setProperty("archivesBaseName", "calendar") } From 27c8549af99bb6864968d894e479455d6a6776c7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 1 Feb 2018 18:17:37 +0100 Subject: [PATCH 25/94] updating changelog --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09df8f89a..d35a8a9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ Changelog ========== +Version 3.2.3 *(2018-02-01)* +---------------------------- + + * Fixed blank screens in some cases + * Make sure the Add New Event button works when opening the app from a widget + * Removed the "Default event reminder" from settings, remember last used values + * Allow selecting Snooze interval at pressing Snooze + * Allow disabling displaying of What's New + * Add a Back button at the actionmenu when opening a subview + * Allow deleting all events at once without reseting event types and other settings + Version 3.2.2 *(2018-01-27)* ---------------------------- From 7d1952e00f8584567f3bc101b2f7cfb5ffa0ea79 Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Wed, 31 Jan 2018 00:00:38 +0300 Subject: [PATCH 26/94] Set unique applicationIdSuffix in debug builds --- app/build.gradle | 3 +++ app/src/debug/res/values/strings.xml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 45b9baf4b..b8f9c75ed 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,6 +21,9 @@ android { } buildTypes { + debug { + applicationIdSuffix ".debug" + } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml index c7ff04099..39feb947e 100644 --- a/app/src/debug/res/values/strings.xml +++ b/app/src/debug/res/values/strings.xml @@ -1,4 +1,5 @@ + Calendar_debug Calendar Leaks - \ No newline at end of file + From 4588af1fe2cef31664492ff42bda6ba34235265c Mon Sep 17 00:00:00 2001 From: Guillaume Date: Thu, 1 Feb 2018 23:26:20 +0100 Subject: [PATCH 27/94] Dutch --- app/src/main/res/values-nl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index e456b58ea..affdbc2d6 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -194,8 +194,8 @@ Afgelopen afspraken tonen Widgets Beschrijving vervangen door Locatie in lijstweergave - Delete all events - Are you sure you want to delete all events? This will leave your event types and other settings intact. + Alle afspraken verwijderen + Alle afspraken verwijderen? Afspraaktypes en andere instellingen blijven behouden. CalDAV From c52f469220670d8fbe90830cad321dadf571e3da Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Fri, 2 Feb 2018 17:47:37 +0300 Subject: [PATCH 28/94] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 4ed0ad605..e3e08cb3b 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -208,8 +208,8 @@ Показывать прошедшие события Виджеты Показывать место вместо описания в списке событий - Delete all events - Are you sure you want to delete all events? This will leave your event types and other settings intact. + Удалить все события + Вы действительно хотите удалить все события? Это не затронет ваши типы событий и другие настройки. CalDAV From 64997579f81ba3e95fe2b844184de8b7f6752539 Mon Sep 17 00:00:00 2001 From: FTno <16176811+FTno@users.noreply.github.com> Date: Fri, 2 Feb 2018 20:24:06 +0100 Subject: [PATCH 29/94] Update strings.xml Norwegian (nb) translation update --- app/src/main/res/values-nb/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index f787ab5c4..6998df428 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -194,8 +194,8 @@ Vis hendelser fra fortiden Moduler Erstatt Beskrivelse med Sted i listevisningen - Delete all events - Are you sure you want to delete all events? This will leave your event types and other settings intact. + Slett alle hendelser + Er du sikker på at du vil slette alle hendelser? Dine hendelsestyper og andre innstillinger blir beholdt. CalDAV From 90b89067c4bc220edfd487894cd23ed16e48201d Mon Sep 17 00:00:00 2001 From: gregory678 Date: Sat, 3 Feb 2018 01:20:08 +0100 Subject: [PATCH 30/94] Update strings.xml --- app/src/main/res/values-pl/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index db65318a4..0156736f3 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1,9 +1,9 @@ Prosty Kalendarz - Kalendarz + Prosty Kalendarz Zmień widok - Daily view + Dzień Tydzień Miesiąc Rok @@ -15,8 +15,8 @@ Drzemka - Simple Calendar - widok miesięczny - Simple Calendar - lista wydarzeń + Prosty Kalendarz - widok miesięczny + Prosty Kalendarz - lista wydarzeń Wydarzenie @@ -27,7 +27,7 @@ Wydarzenie zostało dodane Wydarzenie zostało zaktualizowane Filtruj wydarzenia według typu - Please fill in a location to be shown on a map +    Wpisz lokalizację, która ma być pokazana na mapie Powtórzenie @@ -122,7 +122,7 @@ godziny dni Dodaj inne przypomnienie - Event reminders +    Przypomnienia %d minutę przed @@ -198,9 +198,9 @@ Lista wydarzeń Pokazuj wydarzenia z przeszłości Widżety - Zastąp Opis z Lokalizacją w widoku wejść - Delete all events - Are you sure you want to delete all events? This will leave your event types and other settings intact. +    Zastępuj opis na lokalizację we wpisach widoku listy +    Usuń wszystkie wydarzenia +    Czy na pewno mam usunąć wszystkie wydarzenia? Nie naruszy to typów wydarzeń i innych ustawień. CalDAV From 54922fc779147f09868beef4b2c3903a8eda76b6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 4 Feb 2018 12:03:24 +0100 Subject: [PATCH 31/94] add a "New Event" content description to the Floating action button --- app/src/main/res/layout/activity_main.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2cfdbb257..23ad427ea 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -17,6 +17,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/activity_margin" + android:contentDescription="@string/new_event" android:src="@drawable/ic_plus" app:backgroundTint="@color/color_primary" app:rippleColor="@color/pressed_item_foreground"/> From 1a20688b8f53ee896dd34a3498cbbb82250efb44 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 12:40:33 +0100 Subject: [PATCH 32/94] update commons to 3.10.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 32edaff55..f4c4c4299 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.9.9' + implementation 'com.simplemobiletools:commons:3.10.0' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.android.support:multidex:1.0.2' From 6f93c2170220dc4682f0f7af44ab5b36b196a81c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Feb 2018 14:28:44 +0100 Subject: [PATCH 33/94] use our own MyLinearLayoutManager at recycler views --- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/activity_manage_event_types.xml | 2 +- app/src/main/res/layout/dialog_export_events.xml | 2 +- app/src/main/res/layout/dialog_filter_event_types.xml | 2 +- app/src/main/res/layout/fragment_day.xml | 2 +- app/src/main/res/layout/fragment_event_list.xml | 2 +- app/src/main/res/layout/widget_config_list.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 23ad427ea..e486b4871 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -62,7 +62,7 @@ android:layout_height="match_parent" android:clipToPadding="false" android:scrollbars="vertical" - app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> diff --git a/app/src/main/res/layout/activity_manage_event_types.xml b/app/src/main/res/layout/activity_manage_event_types.xml index eb17f556f..c4b9c9f86 100644 --- a/app/src/main/res/layout/activity_manage_event_types.xml +++ b/app/src/main/res/layout/activity_manage_event_types.xml @@ -6,4 +6,4 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" - app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> diff --git a/app/src/main/res/layout/dialog_export_events.xml b/app/src/main/res/layout/dialog_export_events.xml index c733b8db6..7a6623400 100644 --- a/app/src/main/res/layout/dialog_export_events.xml +++ b/app/src/main/res/layout/dialog_export_events.xml @@ -87,7 +87,7 @@ android:clipToPadding="false" android:overScrollMode="never" android:paddingTop="@dimen/medium_margin" - app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> diff --git a/app/src/main/res/layout/dialog_filter_event_types.xml b/app/src/main/res/layout/dialog_filter_event_types.xml index a77264d7b..572d34b8b 100644 --- a/app/src/main/res/layout/dialog_filter_event_types.xml +++ b/app/src/main/res/layout/dialog_filter_event_types.xml @@ -8,4 +8,4 @@ android:clipToPadding="false" android:overScrollMode="never" android:paddingTop="@dimen/medium_margin" - app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> diff --git a/app/src/main/res/layout/fragment_day.xml b/app/src/main/res/layout/fragment_day.xml index 392a5b1c9..1a8eab200 100644 --- a/app/src/main/res/layout/fragment_day.xml +++ b/app/src/main/res/layout/fragment_day.xml @@ -15,6 +15,6 @@ android:layout_height="match_parent" android:layout_below="@+id/top_value" android:clipToPadding="false" - app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> diff --git a/app/src/main/res/layout/fragment_event_list.xml b/app/src/main/res/layout/fragment_event_list.xml index b0a654c2d..bbe1830a8 100644 --- a/app/src/main/res/layout/fragment_event_list.xml +++ b/app/src/main/res/layout/fragment_event_list.xml @@ -14,7 +14,7 @@ android:paddingTop="@dimen/medium_margin" android:scrollbars="vertical" android:visibility="gone" - app:layoutManager="android.support.v7.widget.LinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/> + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>