diff options
author | Sean Leonard <meanderingcode@aetherislands.net> | 2013-07-12 14:28:46 -0600 |
---|---|---|
committer | Sean Leonard <meanderingcode@aetherislands.net> | 2013-07-12 14:28:46 -0600 |
commit | 1d1b3a18da29a17ffb983aa5439659970fe0ab83 (patch) | |
tree | 336d9904bafdd66db350401090b12a6cde5ed885 /src/se | |
parent | 8bd4d61319b1418e5fef2d9f932044b07bfc1f20 (diff) | |
parent | 652d0e84785b89ac13c0fc03663ce0e2811aea6b (diff) |
Merge branch 'feature/login-logout-options-shown-when-applicable' into develop
Diffstat (limited to 'src/se')
-rw-r--r-- | src/se/leap/leapclient/Dashboard.java | 16 | ||||
-rw-r--r-- | src/se/leap/leapclient/ProviderDetailFragment.java | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/se/leap/leapclient/Dashboard.java b/src/se/leap/leapclient/Dashboard.java index a330f9e0..a429d3b3 100644 --- a/src/se/leap/leapclient/Dashboard.java +++ b/src/se/leap/leapclient/Dashboard.java @@ -57,6 +57,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf private TextView eipStatus; private boolean mEipWait = false; + private boolean authed = false; public ProviderAPIResultReceiver providerAPI_result_receiver; private EIPReceiver mEIPReceiver; @@ -234,8 +235,13 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf provider_json = ConfigHelper.getJsonFromSharedPref(ConfigHelper.PROVIDER_KEY); JSONObject service_description = provider_json.getJSONObject(ConfigHelper.SERVICE_KEY); if(service_description.getBoolean(ConfigHelper.ALLOW_REGISTRATION_KEY)) { - menu.findItem(R.id.login_button).setVisible(true); - menu.findItem(R.id.logout_button).setVisible(true); + if(authed) { + menu.findItem(R.id.login_button).setVisible(false); + menu.findItem(R.id.logout_button).setVisible(true); + } else { + menu.findItem(R.id.login_button).setVisible(true); + menu.findItem(R.id.logout_button).setVisible(false); + } } } catch (JSONException e) { // TODO Auto-generated catch block @@ -384,14 +390,16 @@ 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); - mProgressDialog.dismiss(); + authed = true; + invalidateOptionsMenu(); Cookie session_id = new BasicClientCookie(session_id_cookie_key, session_id_string); downloadAuthedUserCertificate(session_id); } else if(resultCode == ConfigHelper.SRP_AUTHENTICATION_FAILED) { logInDialog(getCurrentFocus(), resultData.getString(getResources().getString(R.string.user_message))); - mProgressDialog.dismiss(); } else if(resultCode == ConfigHelper.LOGOUT_SUCCESSFUL) { + authed = false; + invalidateOptionsMenu(); setResult(RESULT_OK); mProgressDialog.dismiss(); } else if(resultCode == ConfigHelper.LOGOUT_FAILED) { diff --git a/src/se/leap/leapclient/ProviderDetailFragment.java b/src/se/leap/leapclient/ProviderDetailFragment.java index a788594f..600be58f 100644 --- a/src/se/leap/leapclient/ProviderDetailFragment.java +++ b/src/se/leap/leapclient/ProviderDetailFragment.java @@ -43,7 +43,6 @@ public class ProviderDetailFragment extends DialogFragment { }
if(registration_allowed(provider_json)) {
-
builder.setNegativeButton(R.string.login_button, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
interface_with_configuration_wizard.login();
|