Unverified Commit 649e1a9f authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #1466 from shubhsherl/bug_1464

[FIX] Message retain
parents 33ed32da 075d8054
...@@ -111,7 +111,7 @@ interface ChatRoomView : LoadingView, MessageView { ...@@ -111,7 +111,7 @@ interface ChatRoomView : LoadingView, MessageView {
/** /**
* Clears the message composition. * Clears the message composition.
*/ */
fun clearMessageComposition() fun clearMessageComposition(deleteMessage: Boolean)
fun showInvalidFileSize(fileSize: Int, maxFileSize: Int) fun showInvalidFileSize(fileSize: Int, maxFileSize: Int)
......
...@@ -522,15 +522,16 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -522,15 +522,16 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
ui { ui {
button_send.isEnabled = true button_send.isEnabled = true
text_message.isEnabled = true text_message.isEnabled = true
clearMessageComposition() clearMessageComposition(true)
} }
} }
override fun clearMessageComposition() { override fun clearMessageComposition(deleteMessage: Boolean) {
ui { ui {
citation = null citation = null
editingMessageId = null editingMessageId = null
if (deleteMessage)
text_message.textContent = "" text_message.textContent = ""
actionSnackbar.dismiss() actionSnackbar.dismiss()
} }
...@@ -782,7 +783,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -782,7 +783,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
var textMessage = citation ?: "" var textMessage = citation ?: ""
textMessage += text_message.textContent textMessage += text_message.textContent
sendMessage(textMessage) sendMessage(textMessage)
clearMessageComposition() clearMessageComposition(true)
} }
button_show_attachment_options.setOnClickListener { button_show_attachment_options.setOnClickListener {
...@@ -874,8 +875,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -874,8 +875,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private fun setupActionSnackbar() { private fun setupActionSnackbar() {
actionSnackbar = ActionSnackbar.make(message_list_container, parser = parser) actionSnackbar = ActionSnackbar.make(message_list_container, parser = parser)
actionSnackbar.cancelView.setOnClickListener { actionSnackbar.cancelView.setOnClickListener {
clearMessageComposition() clearMessageComposition(false)
KeyboardHelper.showSoftKeyboard(text_message) if (text_message.textContent.isEmpty()) {
KeyboardHelper.showSoftKeyboard(text_message)
}
} }
} }
...@@ -943,4 +946,4 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -943,4 +946,4 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private fun setupToolbar(toolbarTitle: String) { private fun setupToolbar(toolbarTitle: String) {
(activity as ChatRoomActivity).showToolbarTitle(toolbarTitle) (activity as ChatRoomActivity).showToolbarTitle(toolbarTitle)
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment