Commit 94ce1336 authored by shubhsherl's avatar shubhsherl

Fix Message retain issue

parent b48db851
...@@ -119,7 +119,7 @@ interface ChatRoomView : LoadingView, MessageView { ...@@ -119,7 +119,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)
......
...@@ -283,7 +283,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -283,7 +283,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
} }
sendButton.setOnClickListener { sendButton.setOnClickListener {
uploadFile(data, (citation ?:"") + description.text.toString()) uploadFile(data, (citation ?:"") + description.text.toString())
clearMessageComposition() clearMessageComposition(true)
alertDialog.dismiss() alertDialog.dismiss()
} }
cancelButton.setOnClickListener { cancelButton.setOnClickListener {
...@@ -563,15 +563,16 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -563,15 +563,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()
} }
...@@ -823,7 +824,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -823,7 +824,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 {
...@@ -914,7 +915,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -914,7 +915,8 @@ 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)
if (text_message.textContent.isEmpty())
KeyboardHelper.showSoftKeyboard(text_message) KeyboardHelper.showSoftKeyboard(text_message)
} }
} }
......
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