mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed history/conversations list scroll position not retained upon rotation
This commit is contained in:
parent
6308d66eb6
commit
3359fbcbd7
3 changed files with 13 additions and 7 deletions
|
|
@ -337,9 +337,6 @@ class ConversationsListFragment : AbstractMainFragment() {
|
|||
} catch (e: IllegalStateException) {
|
||||
Log.e("$TAG Failed to unregister data observer to adapter: $e")
|
||||
}
|
||||
|
||||
// Scroll to top when fragment is resumed
|
||||
binding.conversationsList.scrollToPosition(0)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
|
|
|||
|
|
@ -195,6 +195,13 @@ class HistoryListFragment : AbstractMainFragment() {
|
|||
listViewModel.fetchInProgress.value = false
|
||||
}
|
||||
|
||||
listViewModel.historyInsertedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
// Scroll to top to display latest call log
|
||||
binding.historyList.scrollToPosition(0)
|
||||
}
|
||||
}
|
||||
|
||||
listViewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.w("$TAG All call logs have been deleted")
|
||||
|
|
@ -262,9 +269,6 @@ class HistoryListFragment : AbstractMainFragment() {
|
|||
Log.i("$TAG Fragment is resumed, resetting missed calls count")
|
||||
sharedViewModel.resetMissedCallsCountEvent.value = Event(true)
|
||||
sharedViewModel.refreshDrawerMenuAccountsListEvent.value = Event(false)
|
||||
|
||||
// Scroll to top to display latest call logs
|
||||
binding.historyList.scrollToPosition(0)
|
||||
}
|
||||
|
||||
private fun copyNumberOrAddressToClipboard(value: String) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ class HistoryListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
|
||||
val fetchInProgress = MutableLiveData<Boolean>()
|
||||
|
||||
val historyInsertedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
val historyDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
|
@ -56,8 +60,9 @@ class HistoryListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
|||
}
|
||||
|
||||
override fun onCallLogUpdated(core: Core, callLog: CallLog) {
|
||||
Log.i("$TAG A call log was updated, updating list")
|
||||
Log.i("$TAG A call log was created, updating list")
|
||||
computeCallLogsList(currentFilter)
|
||||
historyInsertedEvent.postValue(Event(true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue