Skip to content

Commit 28b34f3

Browse files
committed
Fix scroll issues in suggestion list
Before if the list before updating contained item 'test' at position 0 and after updating that value went to the bottom, the list would incorrectly scroll to the bottom to follow that item. Now the scrolling is done after the list is updated.
1 parent 1f57c87 commit 28b34f3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ public void handleSuggestions(@NonNull final List<SuggestionItem> suggestions) {
946946
if (DEBUG) {
947947
Log.d(TAG, "handleSuggestions() called with: suggestions = [" + suggestions + "]");
948948
}
949-
searchBinding.suggestionsList.smoothScrollToPosition(0);
950-
suggestionListAdapter.submitList(suggestions);
949+
suggestionListAdapter.submitList(suggestions,
950+
() -> searchBinding.suggestionsList.scrollToPosition(0));
951951

952952
if (suggestionsPanelVisible && isErrorPanelVisible()) {
953953
hideLoading();

0 commit comments

Comments
 (0)