Fixed: BadTokenException in OnlineFeedView

This commit is contained in:
daniel oeh 2014-06-14 10:51:56 +02:00
parent b261de232f
commit 1e28ad36df

View File

@ -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());
@ -96,6 +98,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);
@ -126,9 +140,11 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
if (status.isSuccessful()) {
parseFeed();
} else if (status.getReason() == DownloadError.ERROR_UNAUTHORIZED) {
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,6 +292,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
}
private void showErrorDialog(String errorMsg) {
if (!isFinishing() && !isPaused) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.error_label);
if (errorMsg != null) {
@ -299,9 +316,6 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
finish();
}
});
if (!isFinishing()) {
builder.show();
}
}