From 93761a8346333da46d5ed55184eaa37c401a9bc8 Mon Sep 17 00:00:00 2001 From: Stypox Date: Wed, 14 Sep 2022 14:01:59 +0200 Subject: [PATCH 1/3] Fix wrong icons being set on suggestion items The diff util wrongly considered as equal two items with the same text but with different `fromHistory` value --- .../newpipe/fragments/list/search/SuggestionListAdapter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SuggestionListAdapter.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SuggestionListAdapter.java index f859c9e54..856ba22f1 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SuggestionListAdapter.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SuggestionListAdapter.java @@ -80,13 +80,14 @@ public class SuggestionListAdapter @Override public boolean areItemsTheSame(@NonNull final SuggestionItem oldItem, @NonNull final SuggestionItem newItem) { - return oldItem.query.equals(newItem.query); + return oldItem.fromHistory == newItem.fromHistory + && oldItem.query.equals(newItem.query); } @Override public boolean areContentsTheSame(@NonNull final SuggestionItem oldItem, @NonNull final SuggestionItem newItem) { - return oldItem.equals(newItem); + return true; // items' contents never change; the list of items themselves does } } } From d6bbb9528b12978cc3f328fe24f99cb21dbf4410 Mon Sep 17 00:00:00 2001 From: Stypox Date: Wed, 14 Sep 2022 14:03:15 +0200 Subject: [PATCH 2/3] Disable suggestion list animations: not meaningful The animations were just in the way and did not help in choosing items, since the suggestion items keep changing too much. --- .../schabi/newpipe/fragments/list/search/SearchFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 6827ddaaf..0b1d145f2 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -340,6 +340,8 @@ public class SearchFragment extends BaseListFragment Date: Wed, 14 Sep 2022 14:39:32 +0200 Subject: [PATCH 3/3] 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. --- .../schabi/newpipe/fragments/list/search/SearchFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 0b1d145f2..5175e0096 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -946,8 +946,8 @@ public class SearchFragment extends BaseListFragment searchBinding.suggestionsList.scrollToPosition(0)); if (suggestionsPanelVisible && isErrorPanelVisible()) { hideLoading();