aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-05-30 14:57:15 -0600
committerdaneren2005 <daneren2005@gmail.com>2013-05-30 14:57:15 -0600
commit78998ef733936bc3382b9637b0d03691383f9829 (patch)
tree8caee8d443b961811a36ff3fdb37a0412055160d /subsonic-android/src/github/daneren2005
parent3cf0694d2c83a1574f2e365cd89418bc8baaaa02 (diff)
downloaddsub-78998ef733936bc3382b9637b0d03691383f9829.tar.gz
dsub-78998ef733936bc3382b9637b0d03691383f9829.tar.bz2
dsub-78998ef733936bc3382b9637b0d03691383f9829.zip
Return to front of the app on network exception instead of exiting all the way
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java b/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java
index 2928e93f..ab9b4fa3 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java
@@ -21,6 +21,8 @@ package github.daneren2005.dsub.util;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.Intent;
+import github.daneren2005.dsub.activity.MainActivity;
import github.daneren2005.dsub.R;
/**
@@ -43,7 +45,7 @@ public class ErrorDialog {
@Override
public void onCancel(DialogInterface dialogInterface) {
if (finishActivityOnClose) {
- activity.finish();
+ restart(activity);
}
}
});
@@ -51,11 +53,17 @@ public class ErrorDialog {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (finishActivityOnClose) {
- activity.finish();
+ restart(activity);
}
}
});
builder.create().show();
}
+
+ private void restart(Activity context) {
+ Intent intent = new Intent(context, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ Util.startActivityWithoutTransition(context, intent);
+ }
}