mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
minor cleanup to remove unnecessary indentation
This commit is contained in:
@ -598,10 +598,12 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateContact(contact: Contact, photoUpdateStatus: Int): Boolean {
|
fun updateContact(contact: Contact, photoUpdateStatus: Int): Boolean {
|
||||||
return if (contact.source == SMT_PRIVATE) {
|
|
||||||
activity.dbHelper.updateContact(contact)
|
|
||||||
} else try {
|
|
||||||
activity.toast(R.string.updating)
|
activity.toast(R.string.updating)
|
||||||
|
if (contact.source == SMT_PRIVATE) {
|
||||||
|
return activity.dbHelper.updateContact(contact)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
val operations = ArrayList<ContentProviderOperation>()
|
val operations = ArrayList<ContentProviderOperation>()
|
||||||
ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI).apply {
|
ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI).apply {
|
||||||
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ?"
|
val selection = "${ContactsContract.Data.RAW_CONTACT_ID} = ? AND ${ContactsContract.Data.MIMETYPE} = ?"
|
||||||
@ -737,10 +739,10 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)
|
activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)
|
||||||
true
|
return true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
activity.showErrorToast(e)
|
activity.showErrorToast(e)
|
||||||
false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,9 +809,10 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun insertContact(contact: Contact): Boolean {
|
fun insertContact(contact: Contact): Boolean {
|
||||||
return if (contact.source == SMT_PRIVATE) {
|
if (contact.source == SMT_PRIVATE) {
|
||||||
insertLocalContact(contact)
|
return insertLocalContact(contact)
|
||||||
} else {
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val operations = ArrayList<ContentProviderOperation>()
|
val operations = ArrayList<ContentProviderOperation>()
|
||||||
ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI).apply {
|
ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI).apply {
|
||||||
@ -935,11 +938,10 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||||||
activity.contentResolver.update(uri, contentValues, null, null)
|
activity.contentResolver.update(uri, contentValues, null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
return true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
activity.showErrorToast(e)
|
activity.showErrorToast(e)
|
||||||
false
|
return false
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user