From 4194ac2226a35aefc2df3fca33dbf635059b88e2 Mon Sep 17 00:00:00 2001 From: Roy Yosef Date: Tue, 21 Apr 2020 02:06:10 +0300 Subject: [PATCH] Display search suggestion: did you mean & showing result for --- .../fragments/list/search/SearchFragment.java | 36 +++++++++++++++++-- app/src/main/res/layout/fragment_search.xml | 26 ++++++++++++-- app/src/main/res/values-land/dimens.xml | 2 ++ app/src/main/res/values-sw600dp/dimens.xml | 1 + app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/strings.xml | 1 + 6 files changed, 63 insertions(+), 4 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 9bfead4f0..a5c3d0bb8 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 @@ -143,6 +143,9 @@ public class SearchFragment extends BaseListFragment()); showKeyboardSearch(); @@ -554,11 +562,13 @@ public class SearchFragment extends BaseListFragment { + correctSuggestionPanel.setVisibility(View.GONE); + search(result.getSearchSuggestion(), contentFilter, sortFilter); + searchEditText.setText(result.getSearchSuggestion()); + }); + + correctSuggestionPanel.setVisibility(View.VISIBLE); + } else { + correctSuggestionPanel.setVisibility(View.GONE); + } + } + @Override public void handleNextItems(final ListExtractor.InfoItemsPage result) { showListFooter(false); diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 651229f10..ca6a2eaf8 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -6,13 +6,34 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + tools:listitem="@layout/list_stream_item" /> @@ -68,7 +90,7 @@ android:layout_height="match_parent" android:scrollbars="vertical" app:layoutManager="LinearLayoutManager" - tools:listitem="@layout/item_search_suggestion"/> + tools:listitem="@layout/item_search_suggestion" /> diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml index e097fb035..b152fb1ae 100644 --- a/app/src/main/res/values-land/dimens.xml +++ b/app/src/main/res/values-land/dimens.xml @@ -51,4 +51,6 @@ 16sp + + 14sp diff --git a/app/src/main/res/values-sw600dp/dimens.xml b/app/src/main/res/values-sw600dp/dimens.xml index 15b6d214e..89bc53111 100644 --- a/app/src/main/res/values-sw600dp/dimens.xml +++ b/app/src/main/res/values-sw600dp/dimens.xml @@ -21,4 +21,5 @@ 10dp + 14sp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 5f58f4c90..d3feb0ea8 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -115,4 +115,5 @@ 2dp 4dp + 16sp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 79624032b..654f2ef9a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,6 +16,7 @@ Search Settings Did you mean: %1$s? + Showing results for: %s Share with Choose browser rotation