mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Merge pull request #2289 from nextcloud/bugfix/2287/fixSwipeToReply
Make sure to set swipe-to-reply after the room info has been loaded
This commit is contained in:
commit
b85ec904c1
@ -355,6 +355,8 @@ class ChatController(args: Bundle) :
|
|||||||
conversationUser
|
conversationUser
|
||||||
)
|
)
|
||||||
|
|
||||||
|
setupSwipeToReply()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setupMentionAutocomplete()
|
setupMentionAutocomplete()
|
||||||
checkShowCallButtons()
|
checkShowCallButtons()
|
||||||
@ -389,6 +391,27 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupSwipeToReply() {
|
||||||
|
if (hasChatPermission && !isReadOnlyConversation()) {
|
||||||
|
val messageSwipeController = MessageSwipeCallback(
|
||||||
|
activity!!,
|
||||||
|
object : MessageSwipeActions {
|
||||||
|
override fun showReplyUI(position: Int) {
|
||||||
|
val chatMessage = adapter?.items?.get(position)?.item as ChatMessage?
|
||||||
|
replyToMessage(chatMessage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
val itemTouchHelper = ItemTouchHelper(messageSwipeController)
|
||||||
|
try {
|
||||||
|
itemTouchHelper.attachToRecyclerView(binding.messagesListView)
|
||||||
|
} catch (npe: NullPointerException) {
|
||||||
|
Log.i(TAG, "UI already teared down", npe)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun handleFromNotification() {
|
private fun handleFromNotification() {
|
||||||
var apiVersion = 1
|
var apiVersion = 1
|
||||||
// FIXME Can this be called for guests?
|
// FIXME Can this be called for guests?
|
||||||
@ -610,20 +633,7 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context != null && hasChatPermission && !isReadOnlyConversation()) {
|
setupSwipeToReply()
|
||||||
val messageSwipeController = MessageSwipeCallback(
|
|
||||||
activity!!,
|
|
||||||
object : MessageSwipeActions {
|
|
||||||
override fun showReplyUI(position: Int) {
|
|
||||||
val chatMessage = adapter?.items?.get(position)?.item as ChatMessage?
|
|
||||||
replyToMessage(chatMessage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
val itemTouchHelper = ItemTouchHelper(messageSwipeController)
|
|
||||||
itemTouchHelper.attachToRecyclerView(binding.messagesListView)
|
|
||||||
}
|
|
||||||
|
|
||||||
layoutManager = binding.messagesListView.layoutManager as LinearLayoutManager?
|
layoutManager = binding.messagesListView.layoutManager as LinearLayoutManager?
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user