From fbf5549182a6cf39210ce027b63159684f7479d4 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 1f57c878598f41d69e704c79276973223c7c33ad 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();