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))
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"
}

View file

@ -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)
}

View file

@ -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 {

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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()