diff --git a/app/build.gradle b/app/build.gradle index fa53c59c1..b66e60389 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,7 +70,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:b0bdd457be' + implementation 'com.github.SimpleMobileTools:Simple-Commons:d46a47635d' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index ead99eded..fbdfea72d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.pro.activities import android.annotation.SuppressLint import android.app.Activity import android.app.SearchManager +import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.content.pm.ShortcutInfo @@ -1056,7 +1057,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { Intent(Intent.ACTION_GET_CONTENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "text/calendar" - startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT) + + try { + startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT) + } catch (e: ActivityNotFoundException) { + toast(R.string.system_service_disabled, Toast.LENGTH_LONG) + } catch (e: Exception) { + showErrorToast(e) + } } } else { handlePermission(PERMISSION_READ_STORAGE) { @@ -1118,7 +1126,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { putExtra(Intent.EXTRA_TITLE, file.name) addCategory(Intent.CATEGORY_OPENABLE) - startActivityForResult(this, PICK_EXPORT_FILE_INTENT) + try { + startActivityForResult(this, PICK_EXPORT_FILE_INTENT) + } catch (e: ActivityNotFoundException) { + toast(R.string.system_service_disabled, Toast.LENGTH_LONG) + } catch (e: Exception) { + showErrorToast(e) + } } } } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt index 939929fd3..921096fc3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt @@ -2,11 +2,13 @@ package com.simplemobiletools.calendar.pro.activities import android.app.Activity import android.app.TimePickerDialog +import android.content.ActivityNotFoundException import android.content.Intent import android.media.AudioManager import android.media.RingtoneManager import android.os.Bundle import android.view.Menu +import android.widget.Toast import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.dialogs.SelectCalendarsDialog import com.simplemobiletools.calendar.pro.dialogs.SelectEventTypeDialog @@ -893,7 +895,14 @@ class SettingsActivity : SimpleActivity() { Intent(Intent.ACTION_GET_CONTENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "text/plain" - startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT) + + try { + startActivityForResult(this, PICK_IMPORT_SOURCE_INTENT) + } catch (e: ActivityNotFoundException) { + toast(R.string.system_service_disabled, Toast.LENGTH_LONG) + } catch (e: Exception) { + showErrorToast(e) + } } } else { handlePermission(PERMISSION_READ_STORAGE) {