mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Keep scroll position in conversation when going back after leaving
This commit is contained in:
parent
ad1625dbb3
commit
1723525077
2 changed files with 9 additions and 0 deletions
|
|
@ -283,11 +283,18 @@ class ConversationFragment : GenericFragment() {
|
|||
val id = LinphoneUtils.getChatRoomId(args.localSipUri, args.remoteSipUri)
|
||||
Log.i("$TAG Asking notifications manager not to notify chat messages for chat room [$id]")
|
||||
coreContext.notificationsManager.setCurrentlyDisplayedChatRoomId(id)
|
||||
|
||||
if (viewModel.scrollingPosition != -1) {
|
||||
binding.eventsList.scrollToPosition(viewModel.scrollingPosition)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
coreContext.notificationsManager.resetCurrentlyDisplayedChatRoomId()
|
||||
|
||||
val layoutManager = binding.eventsList.layoutManager as LinearLayoutManager
|
||||
viewModel.scrollingPosition = layoutManager.findFirstVisibleItemPosition()
|
||||
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ class ConversationViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val isReplyingToMessage = MutableLiveData<String>()
|
||||
|
||||
var scrollingPosition: Int = -1
|
||||
|
||||
val requestKeyboardHidingEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue