summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2013-09-15 13:19:24 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2013-09-15 13:19:24 +0200
commit4a2a25a551ab59d71e67c9a70997629d00450ff0 (patch)
treea579e12db85dfa20e1f92f320dafcc9c1ee36173
parenta716e4bbc0b79184de51883ec4b70e994436f9ab (diff)
downloadAntennaPod-4a2a25a551ab59d71e67c9a70997629d00450ff0.zip
Improved error handling in gpodder.net directory
-rw-r--r--res/layout/gpodnet_podcast_list.xml19
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java1
-rw-r--r--src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java20
-rw-r--r--src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java8
5 files changed, 36 insertions, 13 deletions
diff --git a/res/layout/gpodnet_podcast_list.xml b/res/layout/gpodnet_podcast_list.xml
index e69c2dbee..149b52033 100644
--- a/res/layout/gpodnet_podcast_list.xml
+++ b/res/layout/gpodnet_podcast_list.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -21,14 +21,25 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
- android:layout_gravity="center"
+ android:layout_centerInParent="true"
android:indeterminateOnly="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtvError"
- android:layout_gravity="center"
+ android:layout_centerInParent="true"
android:visibility="gone"
+ android:textAlignment="center"
+ android:layout_margin="16dp"
android:textSize="@dimen/text_size_small"/>
-</FrameLayout> \ No newline at end of file
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/butRetry"
+ android:text="@string/retry_label"
+ android:layout_margin="16dp"
+ android:visibility="gone"
+ android:layout_centerHorizontal="true"
+ android:layout_below="@id/txtvError"/>
+</RelativeLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 493122b1b..9778dd4fa 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -51,6 +51,7 @@
<string name="image_of_prefix">Image of:\u0020</string>
<string name="save_username_password_label">Save username and password</string>
<string name="close_label">Close</string>
+ <string name="retry_label">Retry</string>
<!-- 'Add Feed' Activity labels -->
diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
index 84aa2d26b..3af4bee7c 100644
--- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
+++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java
@@ -256,6 +256,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
finish();
}
});
+ builder.show();
}
}
diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java b/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java
index 32e11e0ce..3014d28cc 100644
--- a/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java
+++ b/src/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java
@@ -9,10 +9,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.GridView;
-import android.widget.ProgressBar;
-import android.widget.TextView;
+import android.widget.*;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity;
@@ -33,6 +30,7 @@ public abstract class PodcastListFragment extends Fragment {
private GridView gridView;
private ProgressBar progressBar;
private TextView txtvError;
+ private Button butRetry;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -42,6 +40,7 @@ public abstract class PodcastListFragment extends Fragment {
gridView = (GridView) root.findViewById(R.id.gridView);
progressBar = (ProgressBar) root.findViewById(R.id.progressBar);
txtvError = (TextView) root.findViewById(R.id.txtvError);
+ butRetry = (Button) root.findViewById(R.id.butRetry);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
@@ -49,6 +48,12 @@ public abstract class PodcastListFragment extends Fragment {
onPodcastSelected((GpodnetPodcast) gridView.getAdapter().getItem(position));
}
});
+ butRetry.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ loadData();
+ }
+ });
loadData();
return root;
@@ -96,10 +101,15 @@ public abstract class PodcastListFragment extends Fragment {
progressBar.setVisibility(View.GONE);
gridView.setVisibility(View.VISIBLE);
+ txtvError.setVisibility(View.GONE);
+ 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);
+
}
}
@@ -108,6 +118,8 @@ public abstract class PodcastListFragment extends Fragment {
super.onPreExecute();
gridView.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
+ txtvError.setVisibility(View.GONE);
+ butRetry.setVisibility(View.GONE);
}
};
diff --git a/src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java b/src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java
index 3d63f2e58..fcb9d01c5 100644
--- a/src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java
+++ b/src/de/danoeh/antennapod/fragment/gpodnet/TagListFragment.java
@@ -1,6 +1,5 @@
package de.danoeh.antennapod.fragment.gpodnet;
-import android.R;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
@@ -74,15 +73,14 @@ public class TagListFragment extends ListFragment {
for (GpodnetTag tag : gpodnetTags) {
tagNames.add(tag.getName());
}
- setListAdapter(new ArrayAdapter<String>(context, R.layout.simple_list_item_1, tagNames));
- setListShown(true);
+ setListAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, tagNames));
} else if (exception != null) {
TextView txtvError = new TextView(getActivity());
txtvError.setText(exception.getMessage());
getListView().setEmptyView(txtvError);
- } else {
- setListShown(true);
}
+ setListShown(true);
+
}
}
};