Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGrou
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()));
Comment thread
HatakeKakashri marked this conversation as resolved.
}
showSearchOnStart();
initSearchListeners();
}
Expand Down Expand Up @@ -936,6 +945,20 @@ private void changeContentFilter(final MenuItem item, final List<String> theCont
filterItemCheckedId = item.getItemId();
item.setChecked(true);

if (service != null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this assumes the service is nonnull, because if it is null it won't show anything... But anyway, it doesn't make sense for the service to be null sooo...

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)) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down