mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-27 09:48:33 +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) {
|
} catch (e: IllegalStateException) {
|
||||||
Log.e("$TAG Failed to unregister data observer to adapter: $e")
|
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() {
|
override fun onPause() {
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,13 @@ class HistoryListFragment : AbstractMainFragment() {
|
||||||
listViewModel.fetchInProgress.value = false
|
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) {
|
listViewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
|
||||||
it.consume {
|
it.consume {
|
||||||
Log.w("$TAG All call logs have been deleted")
|
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")
|
Log.i("$TAG Fragment is resumed, resetting missed calls count")
|
||||||
sharedViewModel.resetMissedCallsCountEvent.value = Event(true)
|
sharedViewModel.resetMissedCallsCountEvent.value = Event(true)
|
||||||
sharedViewModel.refreshDrawerMenuAccountsListEvent.value = Event(false)
|
sharedViewModel.refreshDrawerMenuAccountsListEvent.value = Event(false)
|
||||||
|
|
||||||
// Scroll to top to display latest call logs
|
|
||||||
binding.historyList.scrollToPosition(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyNumberOrAddressToClipboard(value: String) {
|
private fun copyNumberOrAddressToClipboard(value: String) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,10 @@ class HistoryListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
||||||
|
|
||||||
val fetchInProgress = MutableLiveData<Boolean>()
|
val fetchInProgress = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val historyInsertedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||||
|
MutableLiveData<Event<Boolean>>()
|
||||||
|
}
|
||||||
|
|
||||||
val historyDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
val historyDeletedEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||||
MutableLiveData<Event<Boolean>>()
|
MutableLiveData<Event<Boolean>>()
|
||||||
}
|
}
|
||||||
|
|
@ -56,8 +60,9 @@ class HistoryListViewModel @UiThread constructor() : AbstractMainViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCallLogUpdated(core: Core, callLog: CallLog) {
|
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)
|
computeCallLogsList(currentFilter)
|
||||||
|
historyInsertedEvent.postValue(Event(true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue