summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/Dashboard.java
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-06-08 22:27:25 -0600
committerSean Leonard <meanderingcode@aetherislands.net>2013-06-08 22:27:25 -0600
commit769344327d5cb16adbdc04db224ff6902b4a4771 (patch)
treedf878d7b93ee8c6ef2ad6b62990e375293c46a33 /src/se/leap/leapclient/Dashboard.java
parent626b32fba7b6b45bead3b79fb7e7aa6cddc5c535 (diff)
Better config/partial config handling in Dashboard
Diffstat (limited to 'src/se/leap/leapclient/Dashboard.java')
-rw-r--r--src/se/leap/leapclient/Dashboard.java30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java
index de7946e9..6bdd74d2 100644
--- a/src/se/leap/leapclient/Dashboard.java
+++ b/src/se/leap/leapclient/Dashboard.java
@@ -13,10 +13,12 @@ import se.leap.leapclient.R.menu;
import se.leap.openvpn.AboutFragment;
import se.leap.openvpn.MainActivity;
import android.app.Activity;
+import android.app.AlertDialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
@@ -58,10 +60,10 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
// Check if we have preferences, run configuration wizard if not
// TODO We should do a better check for config that this!
- if (!preferences.contains("provider") )
- startActivityForResult(new Intent(this,ConfigurationWizard.class),CONFIGURE_LEAP);
- else
+ if (preferences.contains("provider") && preferences.getString(ConfigHelper.PROVIDER_KEY, null) != null)
buildDashboard();
+ else
+ startActivityForResult(new Intent(this,ConfigurationWizard.class),CONFIGURE_LEAP);
}
@Override
@@ -73,8 +75,26 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
buildDashboard();
} else {
- // Something went wrong... TODO figure out what
- // TODO Error dialog
+ // Something went wrong in configuration
+ AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getAppContext());
+ alertBuilder.setTitle(getResources().getString(R.string.setup_error_title));
+ alertBuilder
+ .setMessage(getResources().getString(R.string.setup_error_text))
+ .setCancelable(false)
+ .setPositiveButton(getResources().getString(R.string.setup_error_configure_button), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ startActivityForResult(new Intent(getAppContext(),ConfigurationWizard.class),CONFIGURE_LEAP);
+ }
+ })
+ .setNegativeButton(getResources().getString(R.string.setup_error_close_button), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ SharedPreferences.Editor prefsEdit = getSharedPreferences(ConfigHelper.PREFERENCES_KEY, MODE_PRIVATE).edit();
+ prefsEdit.remove(ConfigHelper.PROVIDER_KEY).commit();
+ finish();
+ }
+ });
}
}
}