summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml5
-rw-r--r--src/de/podfetcher/adapter/DownloadLogAdapter.java2
-rw-r--r--src/de/podfetcher/util/DownloadError.java28
3 files changed, 35 insertions, 0 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cfa69d9bd..ab50d19ef 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -43,4 +43,9 @@
<string name="other_pref">Other</string>
<string name="about_pref">About</string>
<string name="show_download_log">Show Log</string>
+ <string name="download_error_device_not_found">Storage device not found</string>
+ <string name="download_error_insufficient_space">Insufficient space</string>
+ <string name="download_error_file_error">File error</string>
+ <string name="download_error_http_data_error">HTTP Data Error</string>
+ <string name="download_error_error_unknown">Unknown Error</string>
</resources>
diff --git a/src/de/podfetcher/adapter/DownloadLogAdapter.java b/src/de/podfetcher/adapter/DownloadLogAdapter.java
index 96a5a1688..56ab00a44 100644
--- a/src/de/podfetcher/adapter/DownloadLogAdapter.java
+++ b/src/de/podfetcher/adapter/DownloadLogAdapter.java
@@ -17,6 +17,7 @@ import de.podfetcher.feed.FeedFile;
import de.podfetcher.feed.FeedImage;
import de.podfetcher.feed.FeedMedia;
import de.podfetcher.service.DownloadStatus;
+import de.podfetcher.util.DownloadError;
/** Displays a list of DownloadStatus entries. */
public class DownloadLogAdapter extends ArrayAdapter<DownloadStatus> {
@@ -65,6 +66,7 @@ public class DownloadLogAdapter extends ArrayAdapter<DownloadStatus> {
} else {
holder.successful.setTextColor(Color.parseColor("red"));
holder.successful.setText("Download failed");
+ holder.reason.setText(DownloadError.getErrorString(getContext(), status.getReason()));
}
} else {
holder = (Holder) convertView.getTag();
diff --git a/src/de/podfetcher/util/DownloadError.java b/src/de/podfetcher/util/DownloadError.java
new file mode 100644
index 000000000..d808d2ac2
--- /dev/null
+++ b/src/de/podfetcher/util/DownloadError.java
@@ -0,0 +1,28 @@
+package de.podfetcher.util;
+
+import de.podfetcher.R;
+import android.app.DownloadManager;
+import android.content.Context;
+
+/** Utility class for Download Errors. */
+public class DownloadError {
+ /** Get a human-readable string for a specific error code. */
+ public static String getErrorString(Context context, int code) {
+ int resId;
+ switch(code) {
+ case DownloadManager.ERROR_DEVICE_NOT_FOUND:
+ resId = R.string.download_error_insufficient_space;
+ break;
+ case DownloadManager.ERROR_FILE_ERROR:
+ resId = R.string.download_error_file_error;
+ break;
+ case DownloadManager.ERROR_HTTP_DATA_ERROR:
+ resId = R.string.download_error_http_data_error;
+ break;
+ default:
+ resId = R.string.download_error_error_unknown;
+ }
+ return context.getString(resId);
+ }
+
+}