updating commons, kotlin, room and target sdk to 29

This commit is contained in:
tibbi
2019-11-28 11:34:01 +01:00
parent 3198e19bc6
commit 219a7be1c5
8 changed files with 19 additions and 19 deletions

View File

@ -8,13 +8,13 @@ def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
compileSdkVersion 28 compileSdkVersion 29
buildToolsVersion "28.0.3" buildToolsVersion "29.0.2"
defaultConfig { defaultConfig {
applicationId "com.simplemobiletools.contacts.pro" applicationId "com.simplemobiletools.contacts.pro"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 29
versionCode 52 versionCode 52
versionName "6.4.4" versionName "6.4.4"
setProperty("archivesBaseName", "contacts") setProperty("archivesBaseName", "contacts")
@ -51,12 +51,12 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.19.15' implementation 'com.simplemobiletools:commons:5.20.0'
implementation 'joda-time:joda-time:2.10.1' implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
kapt "androidx.room:room-compiler:2.2.1" kapt "androidx.room:room-compiler:2.2.2"
implementation "androidx.room:room-runtime:2.2.1" implementation "androidx.room:room-runtime:2.2.2"
annotationProcessor "androidx.room:room-compiler:2.2.1" annotationProcessor "androidx.room:room-compiler:2.2.2"
} }

View File

@ -131,10 +131,10 @@ class EditContactActivity : ContactActivity() {
val action = intent.action val action = intent.action
if (contactId == 0 && (action == Intent.ACTION_EDIT || action == ADD_NEW_CONTACT_NUMBER)) { if (contactId == 0 && (action == Intent.ACTION_EDIT || action == ADD_NEW_CONTACT_NUMBER)) {
val data = intent.data val data = intent.data
if (data != null) { if (data != null && data.path != null) {
val rawId = if (data.path.contains("lookup")) { val rawId = if (data.path!!.contains("lookup")) {
if (data.pathSegments.last().startsWith("local_")) { if (data.pathSegments.last().startsWith("local_")) {
data.path.substringAfter("local_").toInt() data.path!!.substringAfter("local_").toInt()
} else { } else {
getLookupUriRawId(data) getLookupUriRawId(data)
} }

View File

@ -32,7 +32,7 @@ class GroupContactsActivity : SimpleActivity(), RemoveFromGroupListener, Refresh
setContentView(R.layout.activity_group_contacts) setContentView(R.layout.activity_group_contacts)
updateTextColors(group_contacts_coordinator) updateTextColors(group_contacts_coordinator)
group = intent.extras.getSerializable(GROUP) as Group group = intent.extras?.getSerializable(GROUP) as Group
supportActionBar?.title = group.title supportActionBar?.title = group.title
group_contacts_fab.setOnClickListener { group_contacts_fab.setOnClickListener {

View File

@ -384,7 +384,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
) )
if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { if (intent?.action == Intent.ACTION_VIEW && intent.data != null) {
tryImportContactsFromFile(intent.data) tryImportContactsFromFile(intent.data!!)
intent.data = null intent.data = null
} }
@ -463,7 +463,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
private fun tryImportContactsFromFile(uri: Uri) { private fun tryImportContactsFromFile(uri: Uri) {
when { when {
uri.scheme == "file" -> showImportContactsDialog(uri.path) uri.scheme == "file" -> showImportContactsDialog(uri.path!!)
uri.scheme == "content" -> { uri.scheme == "content" -> {
val tempFile = getTempFile() val tempFile = getTempFile()
if (tempFile == null) { if (tempFile == null) {
@ -474,7 +474,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
try { try {
val inputStream = contentResolver.openInputStream(uri) val inputStream = contentResolver.openInputStream(uri)
val out = FileOutputStream(tempFile) val out = FileOutputStream(tempFile)
inputStream.copyTo(out) inputStream!!.copyTo(out)
showImportContactsDialog(tempFile.absolutePath) showImportContactsDialog(tempFile.absolutePath)
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)

View File

@ -100,7 +100,7 @@ class ViewContactActivity : ContactActivity() {
if (contactId == 0 && isViewIntent) { if (contactId == 0 && isViewIntent) {
val data = intent.data val data = intent.data
if (data != null) { if (data != null) {
val rawId = if (data.path.contains("lookup")) { val rawId = if (data.path!!.contains("lookup")) {
val lookupKey = getLookupKeyFromUri(data) val lookupKey = getLookupKeyFromUri(data)
if (lookupKey != null) { if (lookupKey != null) {
contact = ContactsHelper(this).getContactWithLookupKey(lookupKey) contact = ContactsHelper(this).getContactWithLookupKey(lookupKey)

View File

@ -126,7 +126,7 @@ fun Context.getContactUriRawId(uri: Uri): Int {
var cursor: Cursor? = null var cursor: Cursor? = null
try { try {
cursor = contentResolver.query(uri, projection, null, null, null) cursor = contentResolver.query(uri, projection, null, null, null)
if (cursor.moveToFirst()) { if (cursor!!.moveToFirst()) {
return cursor.getIntValue(ContactsContract.Contacts.NAME_RAW_CONTACT_ID) return cursor.getIntValue(ContactsContract.Contacts.NAME_RAW_CONTACT_ID)
} }
} catch (ignored: Exception) { } catch (ignored: Exception) {
@ -380,7 +380,7 @@ fun Context.deleteBlockedNumber(number: String) {
val values = ContentValues() val values = ContentValues()
values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number) values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number)
val uri = contentResolver.insert(BlockedNumbers.CONTENT_URI, values) val uri = contentResolver.insert(BlockedNumbers.CONTENT_URI, values)
contentResolver.delete(uri, null, null) contentResolver.delete(uri!!, null, null)
} }
@TargetApi(Build.VERSION_CODES.M) @TargetApi(Build.VERSION_CODES.M)

View File

@ -29,7 +29,7 @@ class Config(context: Context) : BaseConfig(context) {
set(startNameWithSurname) = prefs.edit().putBoolean(START_NAME_WITH_SURNAME, startNameWithSurname).apply() set(startNameWithSurname) = prefs.edit().putBoolean(START_NAME_WITH_SURNAME, startNameWithSurname).apply()
var lastUsedContactSource: String 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() set(lastUsedContactSource) = prefs.edit().putString(LAST_USED_CONTACT_SOURCE, lastUsedContactSource).apply()
var onContactClick: Int var onContactClick: Int

View File

@ -1455,7 +1455,7 @@ class ContactsHelper(val context: Context) {
val baseUri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, contactId) val baseUri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, contactId)
val displayPhotoUri = Uri.withAppendedPath(baseUri, ContactsContract.RawContacts.DisplayPhoto.CONTENT_DIRECTORY) val displayPhotoUri = Uri.withAppendedPath(baseUri, ContactsContract.RawContacts.DisplayPhoto.CONTENT_DIRECTORY)
val fileDescriptor = context.contentResolver.openAssetFileDescriptor(displayPhotoUri, "rw") val fileDescriptor = context.contentResolver.openAssetFileDescriptor(displayPhotoUri, "rw")
val photoStream = fileDescriptor.createOutputStream() val photoStream = fileDescriptor!!.createOutputStream()
photoStream.write(fullSizePhotoData) photoStream.write(fullSizePhotoData)
photoStream.close() photoStream.close()
fileDescriptor.close() fileDescriptor.close()