Display message when search returned no hits

This commit is contained in:
Eoin Mcloughlin 2014-07-13 20:05:42 +01:00 committed by daniel oeh
parent c1fbc59f1c
commit 89a5c6b879
1 changed files with 7 additions and 2 deletions

View File

@ -126,7 +126,7 @@ public abstract class PodcastListFragment extends Fragment {
protected void onPostExecute(List<GpodnetPodcast> gpodnetPodcasts) {
super.onPostExecute(gpodnetPodcasts);
final Context context = getActivity();
if (context != null && gpodnetPodcasts != null) {
if (context != null && gpodnetPodcasts != null && gpodnetPodcasts.size() > 0) {
PodcastListAdapter listAdapter = new PodcastListAdapter(context, 0, gpodnetPodcasts);
gridView.setAdapter(listAdapter);
listAdapter.notifyDataSetChanged();
@ -135,13 +135,18 @@ public abstract class PodcastListFragment extends Fragment {
gridView.setVisibility(View.VISIBLE);
txtvError.setVisibility(View.GONE);
butRetry.setVisibility(View.GONE);
} else if (context != null && gpodnetPodcasts != null) {
gridView.setVisibility(View.GONE);
progressBar.setVisibility(View.GONE);
txtvError.setText(getString(R.string.search_status_no_results));
txtvError.setVisibility(View.VISIBLE);
butRetry.setVisibility(View.GONE);
} else if (context != null) {
gridView.setVisibility(View.GONE);
progressBar.setVisibility(View.GONE);
txtvError.setText(getString(R.string.error_msg_prefix) + exception.getMessage());
txtvError.setVisibility(View.VISIBLE);
butRetry.setVisibility(View.VISIBLE);
}
}