diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-06-14 10:51:56 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-06-14 10:51:56 +0200 |
commit | 1e28ad36dfa37bb64e97aa8f9ae34fea81b26c4d (patch) | |
tree | f41eafd96bd272be84da0601af1ec8c9b6f217fd /src/de/danoeh | |
parent | b261de232fd64217f1d8032f171412c2e79392c4 (diff) | |
download | AntennaPod-1e28ad36dfa37bb64e97aa8f9ae34fea81b26c4d.zip |
Fixed: BadTokenException in OnlineFeedView
Diffstat (limited to 'src/de/danoeh')
-rw-r--r-- | src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 271cc19d5..e397ff2ca 100644 --- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -61,6 +61,8 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { private Map<String, String> alternateFeedUrls; private Downloader downloader; + private boolean isPaused; + @Override protected void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getTheme()); @@ -97,6 +99,18 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { } @Override + protected void onResume() { + super.onResume(); + isPaused = false; + } + + @Override + protected void onPause() { + super.onPause(); + isPaused = true; + } + + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (feed != null && feed.getPreferences() != null) { @@ -126,9 +140,11 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { if (status.isSuccessful()) { parseFeed(); } else if (status.getReason() == DownloadError.ERROR_UNAUTHORIZED) { - Dialog dialog = new FeedViewAuthenticationDialog(OnlineFeedViewActivity.this, - R.string.authentication_notification_title, downloader.getDownloadRequest().getSource()); - dialog.show(); + if (!isFinishing() && !isPaused) { + Dialog dialog = new FeedViewAuthenticationDialog(OnlineFeedViewActivity.this, + R.string.authentication_notification_title, downloader.getDownloadRequest().getSource()); + dialog.show(); + } } else { String errorMsg = status.getReason().getErrorString( OnlineFeedViewActivity.this); @@ -276,32 +292,30 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity { } private void showErrorDialog(String errorMsg) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.error_label); - if (errorMsg != null) { - builder.setMessage(getString(R.string.error_msg_prefix) + errorMsg); - } else { - builder.setMessage(R.string.error_msg_prefix); - } - builder.setNeutralButton(android.R.string.ok, - new DialogInterface.OnClickListener() { + if (!isFinishing() && !isPaused) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.error_label); + if (errorMsg != null) { + builder.setMessage(getString(R.string.error_msg_prefix) + errorMsg); + } else { + builder.setMessage(R.string.error_msg_prefix); + } + builder.setNeutralButton(android.R.string.ok, + new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.cancel(); + } } + ); + builder.setOnCancelListener(new OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + setResult(RESULT_ERROR); + finish(); } - ); - builder.setOnCancelListener(new OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - setResult(RESULT_ERROR); - finish(); - } - }); - - if (!isFinishing()) { - builder.show(); + }); } } |