mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
add a helper function for deleting a contact group
This commit is contained in:
@ -399,6 +399,20 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun deleteGroup(id: Long) {
|
||||||
|
try {
|
||||||
|
val operations = ArrayList<ContentProviderOperation>()
|
||||||
|
val uri = ContentUris.withAppendedId(ContactsContract.Groups.CONTENT_URI, id).buildUpon()
|
||||||
|
.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
|
||||||
|
.build()
|
||||||
|
|
||||||
|
operations.add(ContentProviderOperation.newDelete(uri).build())
|
||||||
|
activity.contentResolver.applyBatch(ContactsContract.AUTHORITY, operations)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
activity.showErrorToast(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getContactWithId(id: Int, isLocalPrivate: Boolean): Contact? {
|
fun getContactWithId(id: Int, isLocalPrivate: Boolean): Contact? {
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
return null
|
return null
|
||||||
|
Reference in New Issue
Block a user