summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/menu/client_dashboard.xml1
-rwxr-xr-xres/values/strings.xml5
-rw-r--r--src/se/leap/leapclient/Dashboard.java22
3 files changed, 23 insertions, 5 deletions
diff --git a/res/menu/client_dashboard.xml b/res/menu/client_dashboard.xml
index a8eaf79..55ad91b 100644
--- a/res/menu/client_dashboard.xml
+++ b/res/menu/client_dashboard.xml
@@ -7,6 +7,7 @@
android:title="@string/menu_settings"/>
<item android:id="@+id/about_leap" android:title="@string/about" android:orderInCategory="110" />
<item android:id="@+id/legacy_interface" android:title="ICS OpenVPN Interface" android:orderInCategory="500" />
+ <item android:id="@+id/switch_provider" android:title="@string/switch_provider_menu_option" android:orderInCategory="501"/>
<item android:id="@+id/login_button" android:title="@string/login_button" android:visible="false"></item>
<item android:id="@+id/logout_button" android:title="@string/logout_button" android:visible="false"></item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6f06ab6..83f614f 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -20,6 +20,7 @@
<string name="copyright_guicode">Source code and issue tracker available at https://github.com/leapcode/leap_android/</string>
<string name="copyright_others">This program uses the following components; see the source code for full details on the licenses</string>
<string name="about">About</string>
+ <string name="switch_provider_menu_option">Switch provider</string>
<string name="about_summary">About LEAP for Android</string>
<string name="vpn_list_summary">List of all configured VPNs</string>
<string name="vpn_list_title">VPN Profiles</string>
@@ -295,6 +296,10 @@
<string name="malformed_url">It doesn\'t seem to be a LEAP provider.</string>
<string name="certificate_error">This is not a trusted LEAP provider.</string>
<string name="not_valid_password_message">Your password is not well-formed: it should have at least 8 characters.</string>
+ <string name="authenticating_title">Authenticating</string>
+ <string name="authenticating_message">Authenticating with entered login and password.</string>
+ <string name="logout_title">Log out</string>
+ <string name="logout_message">Logging out from this session.</string>
<string name="succesful_authentication_message">Authentication succeeded.</string>
<string name="authentication_failed_message">Authentication failed.</string>
<string name="successful_log_out_message">Logged out.</string>
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java
index f63649d..59c0f18 100644
--- a/src/se/leap/leapclient/Dashboard.java
+++ b/src/se/leap/leapclient/Dashboard.java
@@ -16,6 +16,7 @@ import android.app.AlertDialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
+import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -43,7 +44,8 @@ import android.widget.Toast;
public class Dashboard extends Activity implements LogInDialog.LogInDialogInterface,Receiver,StateListener {
protected static final int CONFIGURE_LEAP = 0;
-
+
+ private ProgressDialog mProgressDialog;
private static Context app;
private static SharedPreferences preferences;
private static Provider provider;
@@ -167,7 +169,9 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
intent.putExtra(ConfigHelper.RECEIVER_TAG, mEIPReceiver);
startService(intent);
- ((ViewStub) findViewById(R.id.eipOverviewStub)).inflate();
+ ViewStub eip_overview_stub = ((ViewStub) findViewById(R.id.eipOverviewStub));
+ if(eip_overview_stub != null)
+ eip_overview_stub.inflate();
eipTypeTV = (TextView) findViewById(R.id.eipType);
eipTypeTV.setText(provider.getEIPType());
@@ -261,6 +265,9 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
intent = new Intent(this,MainActivity.class);
startActivity(intent);
return true;
+ case R.id.switch_provider:
+ startActivityForResult(new Intent(this,ConfigurationWizard.class),CONFIGURE_LEAP);
+ return true;
case R.id.login_button:
View view = ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0);
logInDialog(view);
@@ -297,6 +304,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
provider_API_command.putExtra(ConfigHelper.SRP_AUTH, method_and_parameters);
provider_API_command.putExtra(ConfigHelper.RECEIVER_KEY, providerAPI_result_receiver);
+ if(mProgressDialog != null) mProgressDialog.dismiss();
+ mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.authenticating_title), getResources().getString(R.string.authenticating_message), true);
startService(provider_API_command);
}
@@ -322,6 +331,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
provider_API_command.putExtra(ConfigHelper.LOG_OUT, method_and_parameters);
provider_API_command.putExtra(ConfigHelper.RECEIVER_KEY, providerAPI_result_receiver);
+ if(mProgressDialog != null) mProgressDialog.dismiss();
+ mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.logout_title), getResources().getString(R.string.logout_message), true);
startService(provider_API_command);
}
@@ -368,18 +379,19 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
String session_id_cookie_key = resultData.getString(ConfigHelper.SESSION_ID_COOKIE_KEY);
String session_id_string = resultData.getString(ConfigHelper.SESSION_ID_KEY);
setResult(RESULT_OK);
- Toast.makeText(getApplicationContext(), R.string.succesful_authentication_message, Toast.LENGTH_LONG).show();
+ mProgressDialog.dismiss();
Cookie session_id = new BasicClientCookie(session_id_cookie_key, session_id_string);
downloadAuthedUserCertificate(session_id);
} else if(resultCode == ConfigHelper.SRP_AUTHENTICATION_FAILED) {
logInDialog(getCurrentFocus());
- Toast.makeText(getApplicationContext(), R.string.authentication_failed_message, Toast.LENGTH_LONG).show();
+ mProgressDialog.dismiss();
} else if(resultCode == ConfigHelper.LOGOUT_SUCCESSFUL) {
setResult(RESULT_OK);
- Toast.makeText(getApplicationContext(), R.string.successful_log_out_message, Toast.LENGTH_LONG).show();
+ mProgressDialog.dismiss();
} else if(resultCode == ConfigHelper.LOGOUT_FAILED) {
setResult(RESULT_CANCELED);
+ mProgressDialog.dismiss();
Toast.makeText(getApplicationContext(), R.string.log_out_failed_message, Toast.LENGTH_LONG).show();
} else if(resultCode == ConfigHelper.CORRECTLY_DOWNLOADED_CERTIFICATE) {
setResult(RESULT_CANCELED);