Skip to content

Commit 16e32df

Browse files
committed
SearchFragment: show filter in brackets behind service name
This is still not perfect, but it will show the selected search filter in addition to the service name, like: “Search YouTube (Playlists)”. It will not distinguish between a YouTube Music and Youtube filter, so it will display the same thing. Could be improved, but then the text gets too long! :(
1 parent 769e98a commit 16e32df

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -945,13 +945,18 @@ private void changeContentFilter(final MenuItem item, final List<String> theCont
945945
filterItemCheckedId = item.getItemId();
946946
item.setChecked(true);
947947

948-
if ((theContentFilter.isEmpty() || "all".equals(theContentFilter.get(0)))
949-
&& service != null) {
950-
searchEditText.setHint(
951-
getString(R.string.search_with_service_name,
952-
service.getServiceInfo().getName()));
953-
} else {
954-
searchEditText.setHint(getString(R.string.search_with_service_name, item.getTitle()));
948+
if (service != null) {
949+
final boolean isNotFiltered = theContentFilter.isEmpty()
950+
|| "all".equals(theContentFilter.get(0));
951+
if (isNotFiltered) {
952+
searchEditText.setHint(
953+
getString(R.string.search_with_service_name,
954+
service.getServiceInfo().getName()));
955+
} else {
956+
searchEditText.setHint(getString(R.string.search_with_service_name_and_filter,
957+
service.getServiceInfo().getName(),
958+
item.getTitle()));
959+
}
955960
}
956961

957962
contentFilter = theContentFilter.toArray(new String[0]);

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<string name="controls_download_desc">Download stream file</string>
1919
<string name="search">Search</string>
2020
<string name="search_with_service_name">Search %1$s</string>
21+
<string name="search_with_service_name_and_filter">Search %1$s (%2$s)</string>
2122
<string name="settings">Settings</string>
2223
<string name="did_you_mean">Did you mean \"%1$s\"?</string>
2324
<string name="search_showing_result_for">Showing results for: %s</string>

0 commit comments

Comments
 (0)