Commit 42a06734 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Restore UI state when message actions selector pops up

parent f4dc6a53
...@@ -302,6 +302,10 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView, ...@@ -302,6 +302,10 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
} }
} }
fun dispatchRestoreUIState() {
view.restoreUIState()
}
private suspend fun listenMessages(roomId: String) { private suspend fun listenMessages(roomId: String) {
launch(CommonPool + strategy.jobs) { launch(CommonPool + strategy.jobs) {
for (message in client.messagesChannel) { for (message in client.messagesChannel) {
......
...@@ -97,4 +97,9 @@ interface ChatRoomView : LoadingView, MessageView { ...@@ -97,4 +97,9 @@ interface ChatRoomView : LoadingView, MessageView {
fun clearMessageComposition() fun clearMessageComposition()
fun showInvalidFileSize(fileSize: Int, maxFileSize: Int) fun showInvalidFileSize(fileSize: Int, maxFileSize: Int)
/**
* Restore UI state.
*/
fun restoreUIState()
} }
\ No newline at end of file
...@@ -96,9 +96,8 @@ class ChatRoomAdapter(private val roomType: String, ...@@ -96,9 +96,8 @@ class ChatRoomAdapter(private val roomType: String,
setChecked(isPinned) setChecked(isPinned)
} }
val adapter = ActionListAdapter(menuItems, this@ViewHolder) val adapter = ActionListAdapter(menuItems, this@ViewHolder)
BottomSheetMenu(adapter).apply { presenter.dispatchRestoreUIState()
BottomSheetMenu(adapter).show(it.context)
}.show(it.context)
} }
} }
} }
......
...@@ -214,6 +214,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiFragment.EmojiKeyboardLi ...@@ -214,6 +214,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiFragment.EmojiKeyboardLi
adapter.removeItem(msgId) adapter.removeItem(msgId)
} }
override fun restoreUIState() {
hideAllKeyboards()
}
override fun showReplyingAction(username: String, replyMarkdown: String, quotedMessage: String) { override fun showReplyingAction(username: String, replyMarkdown: String, quotedMessage: String) {
activity?.apply { activity?.apply {
citation = replyMarkdown citation = replyMarkdown
......
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