Added left to right swipe action on chat rooms as a shortcut to mark as read
This commit is contained in:
parent
9147601a1a
commit
e2324eae66
2 changed files with 13 additions and 2 deletions
|
@ -25,6 +25,7 @@ This version is a full rewrite of the app in kotlin, using modern Android compon
|
|||
- Can display multiple files in the same chat bubble
|
||||
- Display video in recordings if available
|
||||
- "Swipe left to delete" action available on calls history, contacts & chat rooms list
|
||||
- "Swipe right" to mark a chat room as read
|
||||
- Android 11 people & conversation compliant
|
||||
- New animations between fragments and for unread chat messages / missed calls counters (can be disabled)
|
||||
- Bubble & conversation support for chat message notifications
|
||||
|
|
|
@ -103,8 +103,18 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
|
|||
white,
|
||||
ContextCompat.getColor(requireContext(), R.color.red_color)
|
||||
)
|
||||
swipeConfiguration.leftToRightAction = RecyclerViewSwipeConfiguration.Action(
|
||||
requireContext().getString(R.string.received_chat_notification_mark_as_read_label),
|
||||
white,
|
||||
ContextCompat.getColor(requireContext(), R.color.imdn_read_color)
|
||||
)
|
||||
val swipeListener = object : RecyclerViewSwipeListener {
|
||||
override fun onLeftToRightSwipe(viewHolder: RecyclerView.ViewHolder) {}
|
||||
override fun onLeftToRightSwipe(viewHolder: RecyclerView.ViewHolder) {
|
||||
adapter.notifyItemChanged(viewHolder.adapterPosition)
|
||||
val chatRoom = adapter.currentList[viewHolder.adapterPosition]
|
||||
chatRoom.markAsRead()
|
||||
coreContext.notificationsManager.dismissChatNotification(chatRoom)
|
||||
}
|
||||
|
||||
override fun onRightToLeftSwipe(viewHolder: RecyclerView.ViewHolder) {
|
||||
val viewModel = DialogViewModel(getString(R.string.chat_room_delete_one_dialog))
|
||||
|
@ -123,7 +133,7 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
|
|||
dialog.show()
|
||||
}
|
||||
}
|
||||
RecyclerViewSwipeUtils(ItemTouchHelper.LEFT, swipeConfiguration, swipeListener)
|
||||
RecyclerViewSwipeUtils(ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT, swipeConfiguration, swipeListener)
|
||||
.attachToRecyclerView(binding.chatList)
|
||||
|
||||
// Divider between items
|
||||
|
|
Loading…
Reference in a new issue