From fd48f10df999fb9c67898bdddedf3850055140ef Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sat, 18 Jan 2020 00:26:26 +0100 Subject: [PATCH] [Dialog/EventDetails] Show toast when calendar app not found instead of crashing. --- .../edziennik/ui/dialogs/event/EventDetailsDialog.kt | 7 ++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt index b689611d..3d0da8bc 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventDetailsDialog.kt @@ -4,6 +4,7 @@ package pl.szczodrzynski.edziennik.ui.dialogs.event +import android.content.ActivityNotFoundException import android.content.Intent import android.provider.CalendarContract import android.provider.CalendarContract.Events @@ -209,6 +210,10 @@ class EventDetailsDialog( } } - activity.startActivity(intent) + try { + activity.startActivity(intent) + } catch (e: ActivityNotFoundException) { + Toast.makeText(activity, R.string.calendar_app_not_found, Toast.LENGTH_SHORT).show() + } }} } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e3783e30..e0150396 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1160,4 +1160,5 @@ Synchronizuj Dzień wolny Konfigurowanie natychmiastowych powiadomień... + Nie znaleziono aplikacji kalendarza