fix #391, show more detailed info at deleting elements
This commit is contained in:
parent
cbead76a0a
commit
853a6a8e87
|
@ -151,7 +151,18 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askConfirmDelete() {
|
private fun askConfirmDelete() {
|
||||||
ConfirmationDialog(activity) {
|
val itemsCnt = selectedKeys.size
|
||||||
|
val firstItem = getSelectedItems().first()
|
||||||
|
val items = if (itemsCnt == 1) {
|
||||||
|
"\"${firstItem.getNameToDisplay()}\""
|
||||||
|
} else {
|
||||||
|
resources.getQuantityString(R.plurals.delete_contacts, itemsCnt, itemsCnt)
|
||||||
|
}
|
||||||
|
|
||||||
|
val baseString = R.string.delete_contacts_confirmation
|
||||||
|
val question = String.format(resources.getString(baseString), items)
|
||||||
|
|
||||||
|
ConfirmationDialog(activity, question) {
|
||||||
deleteContacts()
|
deleteContacts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,18 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun askConfirmDelete() {
|
private fun askConfirmDelete() {
|
||||||
ConfirmationDialog(activity) {
|
val itemsCnt = selectedKeys.size
|
||||||
|
val firstItem = getSelectedItems().first()
|
||||||
|
val items = if (itemsCnt == 1) {
|
||||||
|
"\"${firstItem.title}\""
|
||||||
|
} else {
|
||||||
|
resources.getQuantityString(R.plurals.delete_groups, itemsCnt, itemsCnt)
|
||||||
|
}
|
||||||
|
|
||||||
|
val baseString = R.string.delete_contacts_confirmation
|
||||||
|
val question = String.format(resources.getString(baseString), items)
|
||||||
|
|
||||||
|
ConfirmationDialog(activity, question) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
deleteGroups()
|
deleteGroups()
|
||||||
}
|
}
|
||||||
|
@ -135,6 +146,8 @@ class GroupsAdapter(activity: SimpleActivity, var groups: ArrayList<Group>, val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getSelectedItems() = groups.filter { selectedKeys.contains(it.id?.toInt()) } as ArrayList<Group>
|
||||||
|
|
||||||
private fun setupView(view: View, group: Group) {
|
private fun setupView(view: View, group: Group) {
|
||||||
view.apply {
|
view.apply {
|
||||||
group_frame?.isSelected = selectedKeys.contains(group.id!!.toInt())
|
group_frame?.isSelected = selectedKeys.contains(group.id!!.toInt())
|
||||||
|
|
Loading…
Reference in New Issue