catch Exceptions thrown at updating calendars

This commit is contained in:
tibbi 2017-08-23 22:38:01 +02:00
parent c1a59f36a7
commit a914b2e593
19 changed files with 23 additions and 2 deletions

View file

@ -75,7 +75,7 @@ class UpdateEventTypeDialog(val activity: Activity, var eventType: EventType? =
dismiss()
callback.invoke(eventTypeId)
} else {
activity.toast(R.string.unknown_error_occurred)
activity.toast(R.string.editing_calendar_failed)
}
})
}

View file

@ -83,7 +83,11 @@ class CalDAVHandler(val context: Context) {
val uri = CalendarContract.Calendars.CONTENT_URI
val values = fillCalendarContentValues(eventType)
val newUri = ContentUris.withAppendedId(uri, eventType.caldavCalendarId.toLong())
return context.contentResolver.update(newUri, values, null, null) == 1
return try {
context.contentResolver.update(newUri, values, null, null) == 1
} catch (e: IllegalArgumentException) {
false
}
}
private fun fillCalendarContentValues(eventType: EventType): ContentValues {

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">CalDAV 캘린더들 새로고침</string>
<string name="refreshing">새로고침 중…</string>
<string name="refreshing_complete">새로고침 완료</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d 분</item>

View file

@ -204,6 +204,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minutę</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minuto</item>

View file

@ -213,6 +213,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d минута</item>

View file

@ -206,6 +206,7 @@
<string name="refresh_caldav_calendars">Obnoviť CalDAV kalendáre</string>
<string name="refreshing">Obnovuje sa…</string>
<string name="refreshing_complete">Obnovovanie ukončené</string>
<string name="editing_calendar_failed">Úprava kalendára zlyhala</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minútu</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minut</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>

View file

@ -199,6 +199,7 @@
<string name="refresh_caldav_calendars">Refresh CalDAV calendars</string>
<string name="refreshing">Refreshing…</string>
<string name="refreshing_complete">Refreshing complete</string>
<string name="editing_calendar_failed">Editing calendar failed</string>
<plurals name="by_minutes">
<item quantity="one">%1$d minute</item>