2
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-08-22 10:09:39 +00:00

SearchFragment: show service name in search hint

The only hint (haha) which service one is searching in is currently
the color of the background. This is super confusing, yesterday a
friend tried to search for a video on youtube and the app was set to
Bandcamp, and they were super confused why nothing turned up.

So let’s put the name of the service in the hint!

The `updateService()` thing is a little confused, but I didn’t want
to refactor to improve the logic. It’s not doing anything
computationally intensive anyway.

For PeerTube, the sidebar calls it FramaTube but the service name is
PeerTube, I’m not sure why that is the case. Looks like the string
depends on the name of the instance? Hm, can be improved later I
think.
This commit is contained in:
Profpatsch 2025-05-07 10:09:02 +02:00
parent 48e826e912
commit d2dc20c551
2 changed files with 10 additions and 0 deletions

View File

@ -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();
}

View File

@ -17,6 +17,7 @@
<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="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>