mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-22 12:15:00 +01:00
move saving of conversation list scroll-position to onPause
otherwise, it's would not work when just reopening the app from background Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
71e454d135
commit
38b5098492
@ -345,6 +345,16 @@ class ConversationsListActivity :
|
||||
showSearchOrToolbar()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
val firstVisible = layoutManager?.findFirstVisibleItemPosition() ?: 0
|
||||
val firstItem = adapter?.getItem(firstVisible)
|
||||
val firstTop = (firstItem as ConversationItem).mHolder?.itemView?.top
|
||||
val firstOffset = firstTop?.minus(CONVERSATION_ITEM_HEIGHT) ?: 0
|
||||
|
||||
appPreferences.setConversationListPositionAndOffset(firstVisible, firstOffset)
|
||||
}
|
||||
|
||||
// if edge to edge is used, add an empty item at the bottom of the list
|
||||
@Suppress("MagicNumber")
|
||||
private fun addEmptyItemForEdgeToEdgeIfNecessary() {
|
||||
@ -1881,12 +1891,6 @@ class ConversationsListActivity :
|
||||
bundle.putString(BundleKeys.KEY_MESSAGE_ID, selectedMessageId)
|
||||
selectedMessageId = null
|
||||
}
|
||||
val firstVisible = layoutManager?.findFirstVisibleItemPosition() ?: 0
|
||||
val firstItem = adapter?.getItem(firstVisible)
|
||||
val firstTop = (firstItem as ConversationItem).mHolder?.itemView?.top
|
||||
val firstOffset = firstTop?.minus(CONVERSATION_ITEM_HEIGHT) ?: 0
|
||||
|
||||
appPreferences.setConversationListPositionAndOffset(firstVisible, firstOffset)
|
||||
|
||||
val intent = Intent(context, ChatActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
|
Loading…
Reference in New Issue
Block a user