diff options
author | Andrew Gaul <andrew@gaul.org> | 2013-05-25 16:59:06 -0700 |
---|---|---|
committer | Andrew Gaul <andrew@gaul.org> | 2013-06-29 12:38:56 -0700 |
commit | ab9d499ca043b135a6cb44940ad2b20aa84d391b (patch) | |
tree | 9189b4f519baa0be7b29b86df9ed13d04d05360b /src/de/danoeh/antennapod/activity | |
parent | 62961d6594687eb34e36adaeba55a90c99e2dd4e (diff) | |
download | AntennaPod-ab9d499ca043b135a6cb44940ad2b20aa84d391b.zip |
Promote DownloadError to enum for type-safety
Diffstat (limited to 'src/de/danoeh/antennapod/activity')
-rw-r--r-- | src/de/danoeh/antennapod/activity/AddFeedActivity.java | 6 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java | 11 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/de/danoeh/antennapod/activity/AddFeedActivity.java b/src/de/danoeh/antennapod/activity/AddFeedActivity.java index 7e702f28b..545b53494 100644 --- a/src/de/danoeh/antennapod/activity/AddFeedActivity.java +++ b/src/de/danoeh/antennapod/activity/AddFeedActivity.java @@ -161,7 +161,7 @@ public class AddFeedActivity extends SherlockActivity { } @Override - public void onConnectionFailure(int reason) { + public void onConnectionFailure(DownloadError reason) { handleDownloadError(reason); } }); @@ -177,11 +177,11 @@ public class AddFeedActivity extends SherlockActivity { progDialog.setMessage(getString(R.string.loading_label)); } - private void handleDownloadError(int reason) { + private void handleDownloadError(DownloadError reason) { final AlertDialog errorDialog = new AlertDialog.Builder(this).create(); errorDialog.setTitle(R.string.error_label); errorDialog.setMessage(getString(R.string.error_msg_prefix) + " " - + DownloadError.getErrorString(this, reason)); + + reason.getErrorString(this)); errorDialog.setButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index d6ff537a3..612c45e64 100644 --- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -88,9 +88,8 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity { if (status.isSuccessful()) { parseFeed(); } else { - String errorMsg = DownloadError.getErrorString( - OnlineFeedViewActivity.this, - status.getReason()); + String errorMsg = status.getReason().getErrorString( + OnlineFeedViewActivity.this); if (errorMsg != null && status.getReasonDetailed() != null) { errorMsg += " (" @@ -187,9 +186,9 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity { } }); } else { - final String errorMsg = DownloadError.getErrorString( - OnlineFeedViewActivity.this, - DownloadError.ERROR_PARSER_EXCEPTION) + final String errorMsg = + DownloadError.ERROR_PARSER_EXCEPTION.getErrorString( + OnlineFeedViewActivity.this) + " (" + reasonDetailed + ")"; runOnUiThread(new Runnable() { |