mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-07-22 03:42:58 +00:00
Merge pull request #12258 from Profpatsch/show-service-name-in-search
This commit is contained in:
commit
4e94b2602d
@ -219,6 +219,15 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
|
||||
searchBinding = FragmentSearchBinding.bind(rootView);
|
||||
super.onViewCreated(rootView, savedInstanceState);
|
||||
|
||||
updateService();
|
||||
// Add the service name to search string hint
|
||||
// to make it more obvious which platform is being searched.
|
||||
if (service != null) {
|
||||
searchEditText.setHint(
|
||||
getString(R.string.search_with_service_name,
|
||||
service.getServiceInfo().getName()));
|
||||
}
|
||||
showSearchOnStart();
|
||||
initSearchListeners();
|
||||
}
|
||||
@ -936,6 +945,20 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
|
||||
filterItemCheckedId = item.getItemId();
|
||||
item.setChecked(true);
|
||||
|
||||
if (service != null) {
|
||||
final boolean isNotFiltered = theContentFilter.isEmpty()
|
||||
|| "all".equals(theContentFilter.get(0));
|
||||
if (isNotFiltered) {
|
||||
searchEditText.setHint(
|
||||
getString(R.string.search_with_service_name,
|
||||
service.getServiceInfo().getName()));
|
||||
} else {
|
||||
searchEditText.setHint(getString(R.string.search_with_service_name_and_filter,
|
||||
service.getServiceInfo().getName(),
|
||||
item.getTitle()));
|
||||
}
|
||||
}
|
||||
|
||||
contentFilter = theContentFilter.toArray(new String[0]);
|
||||
|
||||
if (!TextUtils.isEmpty(searchString)) {
|
||||
|
@ -17,6 +17,8 @@
|
||||
<string name="download">Download</string>
|
||||
<string name="controls_download_desc">Download stream file</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="search_with_service_name">Search %1$s</string>
|
||||
<string name="search_with_service_name_and_filter">Search %1$s (%2$s)</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="did_you_mean">Did you mean \"%1$s\"?</string>
|
||||
<string name="search_showing_result_for">Showing results for: %s</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user