diff --git a/app/build.gradle b/app/build.gradle index cb7fee3ac..0a4c1fd50 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,13 +11,13 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 28 - buildToolsVersion "28.0.3" + compileSdkVersion 29 + buildToolsVersion "29.0.2" defaultConfig { applicationId "com.simplemobiletools.calendar.pro" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 170 versionName "6.8.3" multiDexEnabled true diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4678901fb..daf970ab4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -25,6 +25,7 @@ android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_launcher_name" + android:requestLegacyExternalStorage="true" android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/AppTheme"> 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 ec71371be..53768d7be 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 @@ -360,8 +360,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { private fun checkIsViewIntent() { if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { val uri = intent.data - if (uri.authority == "com.android.calendar") { - if (uri.path.startsWith("/events")) { + if (uri?.authority?.equals("com.android.calendar") == true) { + if (uri.path!!.startsWith("/events")) { ensureBackgroundThread { // intents like content://com.android.calendar/events/1756 val eventId = uri.lastPathSegment @@ -384,7 +384,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { } } } else { - tryImportEventsFromFile(uri) + tryImportEventsFromFile(uri!!) } } } @@ -753,7 +753,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { private fun tryImportEventsFromFile(uri: Uri) { when { - uri.scheme == "file" -> showImportEventsDialog(uri.path) + uri.scheme == "file" -> showImportEventsDialog(uri.path!!) uri.scheme == "content" -> { val tempFile = getTempFile() if (tempFile == null) { @@ -763,7 +763,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { val inputStream = contentResolver.openInputStream(uri) val out = FileOutputStream(tempFile) - inputStream.copyTo(out) + inputStream!!.copyTo(out) showImportEventsDialog(tempFile.absolutePath) } else -> toast(R.string.invalid_file_format) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt index 0dc32d1c3..78493ebc9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/DayFragment.kt @@ -37,7 +37,7 @@ class DayFragment : Fragment() { val view = inflater.inflate(R.layout.fragment_day, container, false) mHolder = view.day_holder - mDayCode = arguments!!.getString(DAY_CODE) + mDayCode = arguments!!.getString(DAY_CODE)!! setupButtons() return view } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthFragment.kt index 1722c199e..718dc0da8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/MonthFragment.kt @@ -43,7 +43,7 @@ class MonthFragment : Fragment(), MonthlyCalendar { mRes = resources mPackageName = activity!!.packageName mHolder = view.month_calendar_holder - mDayCode = arguments!!.getString(DAY_CODE) + mDayCode = arguments!!.getString(DAY_CODE)!! mConfig = context!!.config storeStateVariables() diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt index 4b2401d44..7c6a04fcc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt @@ -340,7 +340,7 @@ class CalDAVHelper(val context: Context) { val newUri = context.contentResolver.insert(uri, values) val calendarId = event.getCalDAVCalendarId() - val eventRemoteID = java.lang.Long.parseLong(newUri.lastPathSegment) + val eventRemoteID = java.lang.Long.parseLong(newUri!!.lastPathSegment!!) event.importId = getCalDAVEventImportId(calendarId, eventRemoteID) setupCalDAVEventReminders(event) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt index a4039255d..43f0667ed 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt @@ -33,15 +33,15 @@ class Config(context: Context) : BaseConfig(context) { set(vibrate) = prefs.edit().putBoolean(VIBRATE, vibrate).apply() var reminderSoundUri: String - get() = prefs.getString(REMINDER_SOUND_URI, context.getDefaultAlarmUri(ALARM_SOUND_TYPE_NOTIFICATION).toString()) + get() = prefs.getString(REMINDER_SOUND_URI, context.getDefaultAlarmUri(ALARM_SOUND_TYPE_NOTIFICATION).toString())!! set(reminderSoundUri) = prefs.edit().putString(REMINDER_SOUND_URI, reminderSoundUri).apply() var reminderSoundTitle: String - get() = prefs.getString(REMINDER_SOUND_TITLE, context.getDefaultAlarmTitle(ALARM_SOUND_TYPE_NOTIFICATION)) + get() = prefs.getString(REMINDER_SOUND_TITLE, context.getDefaultAlarmTitle(ALARM_SOUND_TYPE_NOTIFICATION))!! set(reminderSoundTitle) = prefs.edit().putString(REMINDER_SOUND_TITLE, reminderSoundTitle).apply() var lastSoundUri: String - get() = prefs.getString(LAST_SOUND_URI, "") + get() = prefs.getString(LAST_SOUND_URI, "")!! set(lastSoundUri) = prefs.edit().putString(LAST_SOUND_URI, lastSoundUri).apply() var lastReminderChannel: Long @@ -69,7 +69,7 @@ class Config(context: Context) : BaseConfig(context) { set(displayPastEvents) = prefs.edit().putInt(DISPLAY_PAST_EVENTS, displayPastEvents).apply() var displayEventTypes: Set - get() = prefs.getStringSet(DISPLAY_EVENT_TYPES, HashSet()) + get() = prefs.getStringSet(DISPLAY_EVENT_TYPES, HashSet())!! set(displayEventTypes) = prefs.edit().remove(DISPLAY_EVENT_TYPES).putStringSet(DISPLAY_EVENT_TYPES, displayEventTypes).apply() var listWidgetViewToOpen: Int @@ -84,7 +84,7 @@ class Config(context: Context) : BaseConfig(context) { } var caldavSyncedCalendarIds: String - get() = prefs.getString(CALDAV_SYNCED_CALENDAR_IDS, "") + get() = prefs.getString(CALDAV_SYNCED_CALENDAR_IDS, "")!! set(calendarIDs) = prefs.edit().putString(CALDAV_SYNCED_CALENDAR_IDS, calendarIDs).apply() var lastUsedCaldavCalendarId: Int diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/services/SnoozeService.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/services/SnoozeService.kt index 52890ebb3..344c6628b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/services/SnoozeService.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/services/SnoozeService.kt @@ -8,9 +8,11 @@ import com.simplemobiletools.calendar.pro.extensions.rescheduleReminder import com.simplemobiletools.calendar.pro.helpers.EVENT_ID class SnoozeService : IntentService("Snooze") { - override fun onHandleIntent(intent: Intent) { - val eventId = intent.getLongExtra(EVENT_ID, 0L) - val event = eventsDB.getEventWithId(eventId) - rescheduleReminder(event, config.snoozeTime) + override fun onHandleIntent(intent: Intent?) { + if (intent != null) { + val eventId = intent.getLongExtra(EVENT_ID, 0L) + val event = eventsDB.getEventWithId(eventId) + rescheduleReminder(event, config.snoozeTime) + } } }