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 propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1 propVersionCode = 1
propVersionName = '5.28.18' propVersionName = '5.28.19'
kotlin_version = '1.3.72' kotlin_version = '1.3.72'
} }

View file

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