[Dialog/EventDetails] Show toast when calendar app not found instead of crashing.

This commit is contained in:
Kacper Ziubryniewicz 2020-01-18 00:26:26 +01:00
parent 6a54e7fef7
commit fd48f10df9
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@
package pl.szczodrzynski.edziennik.ui.dialogs.event package pl.szczodrzynski.edziennik.ui.dialogs.event
import android.content.ActivityNotFoundException
import android.content.Intent import android.content.Intent
import android.provider.CalendarContract import android.provider.CalendarContract
import android.provider.CalendarContract.Events import android.provider.CalendarContract.Events
@ -209,6 +210,10 @@ class EventDetailsDialog(
} }
} }
try {
activity.startActivity(intent) activity.startActivity(intent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(activity, R.string.calendar_app_not_found, Toast.LENGTH_SHORT).show()
}
}} }}
} }

View File

@ -1160,4 +1160,5 @@
<string name="counter_activity_sync">Synchronizuj</string> <string name="counter_activity_sync">Synchronizuj</string>
<string name="notification_day_free">Dzień wolny</string> <string name="notification_day_free">Dzień wolny</string>
<string name="edziennik_progress_endpoint_push_config">Konfigurowanie natychmiastowych powiadomień...</string> <string name="edziennik_progress_endpoint_push_config">Konfigurowanie natychmiastowych powiadomień...</string>
<string name="calendar_app_not_found">Nie znaleziono aplikacji kalendarza</string>
</resources> </resources>