From 219a7be1c537b9200a59036703e9b00a2a94f33a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 28 Nov 2019 11:34:01 +0100 Subject: [PATCH] updating commons, kotlin, room and target sdk to 29 --- app/build.gradle | 14 +++++++------- .../contacts/pro/activities/EditContactActivity.kt | 6 +++--- .../pro/activities/GroupContactsActivity.kt | 2 +- .../contacts/pro/activities/MainActivity.kt | 6 +++--- .../contacts/pro/activities/ViewContactActivity.kt | 2 +- .../contacts/pro/extensions/Context.kt | 4 ++-- .../contacts/pro/helpers/Config.kt | 2 +- .../contacts/pro/helpers/ContactsHelper.kt | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index de96b850..2cbb6cbb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,13 +8,13 @@ def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android { - compileSdkVersion 28 - buildToolsVersion "28.0.3" + compileSdkVersion 29 + buildToolsVersion "29.0.2" defaultConfig { applicationId "com.simplemobiletools.contacts.pro" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 52 versionName "6.4.4" setProperty("archivesBaseName", "contacts") @@ -51,12 +51,12 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.19.15' + implementation 'com.simplemobiletools:commons:5.20.0' implementation 'joda-time:joda-time:2.10.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' - kapt "androidx.room:room-compiler:2.2.1" - implementation "androidx.room:room-runtime:2.2.1" - annotationProcessor "androidx.room:room-compiler:2.2.1" + kapt "androidx.room:room-compiler:2.2.2" + implementation "androidx.room:room-runtime:2.2.2" + annotationProcessor "androidx.room:room-compiler:2.2.2" } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt index eb4c2531..8f1950d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/EditContactActivity.kt @@ -131,10 +131,10 @@ class EditContactActivity : ContactActivity() { val action = intent.action if (contactId == 0 && (action == Intent.ACTION_EDIT || action == ADD_NEW_CONTACT_NUMBER)) { val data = intent.data - if (data != null) { - val rawId = if (data.path.contains("lookup")) { + if (data != null && data.path != null) { + val rawId = if (data.path!!.contains("lookup")) { if (data.pathSegments.last().startsWith("local_")) { - data.path.substringAfter("local_").toInt() + data.path!!.substringAfter("local_").toInt() } else { getLookupUriRawId(data) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt index 91394c9b..415768c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/GroupContactsActivity.kt @@ -32,7 +32,7 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh setContentView(R.layout.activity_group_contacts) updateTextColors(group_contacts_coordinator) - group = intent.extras.getSerializable(GROUP) as Group + group = intent.extras?.getSerializable(GROUP) as Group supportActionBar?.title = group.title group_contacts_fab.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt index 2fb0a66b..c6c9b749 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt @@ -384,7 +384,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { ) if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { - tryImportContactsFromFile(intent.data) + tryImportContactsFromFile(intent.data!!) intent.data = null } @@ -463,7 +463,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { private fun tryImportContactsFromFile(uri: Uri) { when { - uri.scheme == "file" -> showImportContactsDialog(uri.path) + uri.scheme == "file" -> showImportContactsDialog(uri.path!!) uri.scheme == "content" -> { val tempFile = getTempFile() if (tempFile == null) { @@ -474,7 +474,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { try { val inputStream = contentResolver.openInputStream(uri) val out = FileOutputStream(tempFile) - inputStream.copyTo(out) + inputStream!!.copyTo(out) showImportContactsDialog(tempFile.absolutePath) } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt index b7702d93..7efcd46d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/ViewContactActivity.kt @@ -100,7 +100,7 @@ class ViewContactActivity : ContactActivity() { if (contactId == 0 && isViewIntent) { val data = intent.data if (data != null) { - val rawId = if (data.path.contains("lookup")) { + val rawId = if (data.path!!.contains("lookup")) { val lookupKey = getLookupKeyFromUri(data) if (lookupKey != null) { contact = ContactsHelper(this).getContactWithLookupKey(lookupKey) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt index 2aafcf93..81978f54 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt @@ -126,7 +126,7 @@ fun Context.getContactUriRawId(uri: Uri): Int { var cursor: Cursor? = null try { cursor = contentResolver.query(uri, projection, null, null, null) - if (cursor.moveToFirst()) { + if (cursor!!.moveToFirst()) { return cursor.getIntValue(ContactsContract.Contacts.NAME_RAW_CONTACT_ID) } } catch (ignored: Exception) { @@ -380,7 +380,7 @@ fun Context.deleteBlockedNumber(number: String) { val values = ContentValues() values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number) val uri = contentResolver.insert(BlockedNumbers.CONTENT_URI, values) - contentResolver.delete(uri, null, null) + contentResolver.delete(uri!!, null, null) } @TargetApi(Build.VERSION_CODES.M) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt index 0098fbb3..e1a40af8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt @@ -29,7 +29,7 @@ class Config(context: Context) : BaseConfig(context) { set(startNameWithSurname) = prefs.edit().putBoolean(START_NAME_WITH_SURNAME, startNameWithSurname).apply() var lastUsedContactSource: String - get() = prefs.getString(LAST_USED_CONTACT_SOURCE, "") + get() = prefs.getString(LAST_USED_CONTACT_SOURCE, "")!! set(lastUsedContactSource) = prefs.edit().putString(LAST_USED_CONTACT_SOURCE, lastUsedContactSource).apply() var onContactClick: Int diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index c7b26bab..92d7122e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -1455,7 +1455,7 @@ class ContactsHelper(val context: Context) { val baseUri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, contactId) val displayPhotoUri = Uri.withAppendedPath(baseUri, ContactsContract.RawContacts.DisplayPhoto.CONTENT_DIRECTORY) val fileDescriptor = context.contentResolver.openAssetFileDescriptor(displayPhotoUri, "rw") - val photoStream = fileDescriptor.createOutputStream() + val photoStream = fileDescriptor!!.createOutputStream() photoStream.write(fullSizePhotoData) photoStream.close() fileDescriptor.close()