implementing the Select All menu button

This commit is contained in:
tibbi 2020-04-03 17:27:40 +02:00
parent 067c1d3876
commit c1daccb969
1 changed files with 11 additions and 1 deletions

View File

@ -29,7 +29,15 @@ class MessagesAdapter(
override fun prepareActionMode(menu: Menu) {} override fun prepareActionMode(menu: Menu) {}
override fun actionItemPressed(id: Int) {} override fun actionItemPressed(id: Int) {
if (selectedKeys.isEmpty()) {
return
}
when (id) {
R.id.cab_select_all -> selectAll()
}
}
override fun getSelectableItemCount() = messages.size override fun getSelectableItemCount() = messages.size
@ -61,6 +69,8 @@ class MessagesAdapter(
private fun setupView(view: View, message: Message) { private fun setupView(view: View, message: Message) {
view.apply { view.apply {
message_frame.isSelected = selectedKeys.contains(message.id)
message_address.text = message.address message_address.text = message.address
message_body_short.text = message.body message_body_short.text = message.body
message_date.text = message.date.formatDate(context) message_date.text = message.date.formatDate(context)