replace the Remove button with Delete at the blocked numbers screen

This commit is contained in:
tibbi 2020-05-23 17:46:02 +02:00
parent 315b275569
commit f37fcb9309
2 changed files with 7 additions and 7 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.28.18'
propVersionName = '5.28.19'
kotlin_version = '1.3.72'
}

View file

@ -18,13 +18,13 @@ class ManageBlockedNumbersAdapter(activity: BaseSimpleActivity, var blockedNumbe
setupDragListener(true)
}
override fun getActionMenuId() = R.menu.cab_remove_only
override fun getActionMenuId() = R.menu.cab_delete_only
override fun prepareActionMode(menu: Menu) {}
override fun actionItemPressed(id: Int) {
when (id) {
R.id.cab_remove -> removeSelection()
R.id.cab_delete -> deleteSelection()
}
}
@ -64,16 +64,16 @@ class ManageBlockedNumbersAdapter(activity: BaseSimpleActivity, var blockedNumbe
}
}
private fun removeSelection() {
val removeBlockedNumbers = ArrayList<BlockedNumber>(selectedKeys.size)
private fun deleteSelection() {
val deleteBlockedNumbers = ArrayList<BlockedNumber>(selectedKeys.size)
val positions = getSelectedItemPositions()
getSelectedItems().forEach {
removeBlockedNumbers.add(it)
deleteBlockedNumbers.add(it)
activity.deleteBlockedNumber(it.number)
}
blockedNumbers.removeAll(removeBlockedNumbers)
blockedNumbers.removeAll(deleteBlockedNumbers)
removeSelectedItems(positions)
if (blockedNumbers.isEmpty()) {
listener?.refreshItems()