Search Result | scroll jumps after pagination (#2238)

This commit is contained in:
Benoit Marty 2020-10-30 09:02:29 +01:00
parent 5f99eb8c97
commit 225a5d4e59
3 changed files with 4 additions and 11 deletions

View File

@ -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 🗣:
-

View File

@ -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)
}

View File

@ -8,8 +8,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/searchResultRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:overScrollMode="always"
tools:itemCount="2"
tools:listitem="@layout/item_search_result" />
</im.vector.app.core.platform.StateView>