diff options
author | flofriday <flohacksfriday@gmail.com> | 2024-06-07 10:54:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 10:54:37 +0200 |
commit | e2ff09bd344e4c53ef40381f533fe26914604492 (patch) | |
tree | 251e453fdf63773dc063080dde59eb427a7b9522 | |
parent | 38f56d6d9b72a020448cf9648fe13acc9ad08b8b (diff) | |
download | AntennaPod-e2ff09bd344e4c53ef40381f533fe26914604492.zip |
Fix redundant hints on search screen (#7219)
On the search screen there was always the message "no results found"
even before anything was ever searched and the message was repeated
beneath it if really nothing was found by the app.
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java | 9 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/view/EmptyViewHandler.java | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java index ec782001a..98d308d76 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java @@ -176,8 +176,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O emptyViewHandler = new EmptyViewHandler(getContext()); emptyViewHandler.attachToRecyclerView(recyclerView); emptyViewHandler.setIcon(R.drawable.ic_search); - emptyViewHandler.setTitle(R.string.search_status_no_results); - emptyViewHandler.setMessage(R.string.type_to_search); + emptyViewHandler.setTitle(R.string.type_to_search); EventBus.getDefault().register(this); chip = layout.findViewById(R.id.feed_title_chip); @@ -376,7 +375,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O String query = searchView.getQuery().toString(); if (query.isEmpty()) { - emptyViewHandler.setMessage(R.string.type_to_search); + emptyViewHandler.setTitle(R.string.type_to_search); return; } if (feed != 0) { @@ -389,7 +388,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O .subscribe(results -> { progressBar.setVisibility(View.GONE); adapterFeeds.updateData(results); - emptyViewHandler.setMessage(getString(R.string.no_results_for_query, query)); + emptyViewHandler.setTitle(getString(R.string.no_results_for_query, query)); }, error -> Log.e(TAG, Log.getStackTraceString(error))); } disposableEpisodes = Observable.fromCallable(() -> DBReader.searchFeedItems(feed, query)) @@ -399,7 +398,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O progressBar.setVisibility(View.GONE); this.results = results; adapter.updateItems(results); - emptyViewHandler.setMessage(getString(R.string.no_results_for_query, searchView.getQuery())); + emptyViewHandler.setTitle(getString(R.string.no_results_for_query, searchView.getQuery())); }, error -> Log.e(TAG, Log.getStackTraceString(error))); } diff --git a/app/src/main/java/de/danoeh/antennapod/ui/view/EmptyViewHandler.java b/app/src/main/java/de/danoeh/antennapod/ui/view/EmptyViewHandler.java index b467f6f0e..406465053 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/view/EmptyViewHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/view/EmptyViewHandler.java @@ -38,6 +38,10 @@ public class EmptyViewHandler { tvTitle.setText(title);
}
+ public void setTitle(String title) {
+ tvTitle.setText(title);
+ }
+
public void setMessage(int message) {
tvMessage.setText(message);
}
|