From 225a5d4e59f81c316f5e2c4565215b645a838a97 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 30 Oct 2020 09:02:29 +0100 Subject: [PATCH] Search Result | scroll jumps after pagination (#2238) --- CHANGES.md | 1 + .../features/home/room/detail/search/SearchFragment.kt | 10 ---------- vector/src/main/res/layout/fragment_search.xml | 4 +++- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5ef46e5e90..02580338d6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ Improvements 🙌: Bugfix 🐛: - Messages encrypted with no way to decrypt after SDK update from 0.18 to 1.0.0 (#2252) + - Search Result | scroll jumps after pagination (#2238) Translations 🗣: - diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchFragment.kt index 10dc9254d8..6528f0b12b 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/search/SearchFragment.kt @@ -52,8 +52,6 @@ class SearchFragment @Inject constructor( private val fragmentArgs: SearchArgs by args() private val searchViewModel: SearchViewModel by fragmentViewModel() - private var pendingScrollToPosition: Int? = null - override fun getLayoutResId() = R.layout.fragment_search override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -70,12 +68,6 @@ class SearchFragment @Inject constructor( searchResultRecycler.configureWith(controller, showDivider = false) (searchResultRecycler.layoutManager as? LinearLayoutManager)?.stackFromEnd = true controller.listener = this - - controller.addModelBuildListener { - pendingScrollToPosition?.let { - searchResultRecycler.smoothScrollToPosition(it) - } - } } override fun onDestroy() { @@ -100,8 +92,6 @@ class SearchFragment @Inject constructor( } } } else { - pendingScrollToPosition = (state.lastBatchSize - 1).coerceAtLeast(0) - stateView.state = StateView.State.Content controller.setData(state) } diff --git a/vector/src/main/res/layout/fragment_search.xml b/vector/src/main/res/layout/fragment_search.xml index 330e70d86b..84547a4355 100644 --- a/vector/src/main/res/layout/fragment_search.xml +++ b/vector/src/main/res/layout/fragment_search.xml @@ -8,8 +8,10 @@ \ No newline at end of file