mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Conversation performances improvements
This commit is contained in:
parent
889b98db1e
commit
655cc8c291
2 changed files with 12 additions and 5 deletions
|
|
@ -346,13 +346,16 @@ class ConversationFragment : SlidingPaneChildFragment() {
|
|||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
|
||||
viewModel = ViewModelProvider(this)[ConversationViewModel::class.java]
|
||||
sendMessageViewModel = ViewModelProvider(this)[SendMessageInConversationViewModel::class.java]
|
||||
|
||||
// The following prevents re-computing conversation history
|
||||
// when going back from a sub-fragment such as media grid or info
|
||||
if (!::viewModel.isInitialized) {
|
||||
viewModel = ViewModelProvider(this)[ConversationViewModel::class.java]
|
||||
}
|
||||
binding.viewModel = viewModel
|
||||
binding.sendMessageViewModel = sendMessageViewModel
|
||||
|
||||
observeToastEvents(viewModel)
|
||||
|
||||
sendMessageViewModel = ViewModelProvider(this)[SendMessageInConversationViewModel::class.java]
|
||||
binding.sendMessageViewModel = sendMessageViewModel
|
||||
observeToastEvents(sendMessageViewModel)
|
||||
|
||||
binding.setBackClickListener {
|
||||
|
|
|
|||
|
|
@ -333,6 +333,10 @@ class ConversationViewModel @UiThread constructor() : AbstractConversationViewMo
|
|||
Log.i("$TAG Conversation found and not the same as before, configuring it...")
|
||||
chatRoom.addListener(chatRoomListener)
|
||||
configureChatRoom()
|
||||
} else {
|
||||
// This is required to have events displayed when fragment is recreated
|
||||
// due to a rotation or theme switching between light & dark for example
|
||||
updateEvents.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue