simplify the way of getting selected item positions
This commit is contained in:
parent
06ad83c645
commit
6f7f59290e
4 changed files with 5 additions and 5 deletions
|
@ -41,7 +41,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.0.22'
|
||||
implementation 'com.simplemobiletools:commons:5.1.0'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
|
||||
|
|
|
@ -153,7 +153,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
|||
}
|
||||
|
||||
val contactsToRemove = getSelectedItems()
|
||||
val positions = getSelectedItemPositions(contactsToRemove.map { it.id })
|
||||
val positions = getSelectedItemPositions()
|
||||
contactItems.removeAll(contactsToRemove)
|
||||
|
||||
ContactsHelper(activity).deleteContacts(contactsToRemove)
|
||||
|
@ -169,7 +169,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
|||
// used for removing contacts from groups or favorites, not deleting actual contacts
|
||||
private fun removeContacts() {
|
||||
val contactsToRemove = getSelectedItems()
|
||||
val positions = getSelectedItemPositions(contactsToRemove.map { it.id })
|
||||
val positions = getSelectedItemPositions()
|
||||
contactItems.removeAll(contactsToRemove)
|
||||
|
||||
if (location == LOCATION_FAVORITES_TAB) {
|
||||
|
|
|
@ -102,7 +102,7 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
|
|||
}
|
||||
|
||||
val groupsToRemove = groups.filter { selectedKeys.contains(it.id.toInt()) } as ArrayList<Group>
|
||||
val positions = getSelectedItemPositions(groupsToRemove.map { it.id.toInt() })
|
||||
val positions = getSelectedItemPositions()
|
||||
groupsToRemove.forEach {
|
||||
if (it.isPrivateSecretGroup()) {
|
||||
activity.dbHelper.deleteGroup(it.id)
|
||||
|
|
|
@ -80,7 +80,7 @@ class RecentCallsAdapter(activity: SimpleActivity, var recentCalls: ArrayList<Re
|
|||
}
|
||||
|
||||
val callsToRemove = getSelectedItems()
|
||||
val positions = getSelectedItemPositions(callsToRemove.map { it.id })
|
||||
val positions = getSelectedItemPositions()
|
||||
ContactsHelper(activity).removeRecentCalls(callsToRemove.map { it.id } as ArrayList<Int>)
|
||||
recentCalls.removeAll(callsToRemove)
|
||||
|
||||
|
|
Loading…
Reference in a new issue