minor cleanup to remove unnecessary indentation
This commit is contained in:
parent
f9fb62366b
commit
1797f17f31
1 changed files with 139 additions and 137 deletions
|
|
@ -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
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue