Skip to content

Commit d2dc20c

Browse files
committed
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.
1 parent 48e826e commit d2dc20c

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGrou
219219
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
220220
searchBinding = FragmentSearchBinding.bind(rootView);
221221
super.onViewCreated(rootView, savedInstanceState);
222+
223+
updateService();
224+
// Add the service name to search string hint
225+
// to make it more obvious which platform is being searched.
226+
if (service != null) {
227+
searchEditText.setHint(
228+
getString(R.string.search_with_service_name,
229+
service.getServiceInfo().getName()));
230+
}
222231
showSearchOnStart();
223232
initSearchListeners();
224233
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<string name="download">Download</string>
1818
<string name="controls_download_desc">Download stream file</string>
1919
<string name="search">Search</string>
20+
<string name="search_with_service_name">Search %1$s</string>
2021
<string name="settings">Settings</string>
2122
<string name="did_you_mean">Did you mean \"%1$s\"?</string>
2223
<string name="search_showing_result_for">Showing results for: %s</string>

0 commit comments

Comments
 (0)