summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-06-01 11:15:40 +0200
committerParménides GV <parmegv@sdf.org>2015-06-01 11:15:40 +0200
commit47e0180aaaaa5ba2cd921ebd28221ab27fd51b65 (patch)
treed35a6fbab710e286eb35e7b6f16b62c3e9a79d53 /app/src/main/java
parent21aa11e5e04ffef3111010140cd7336fe181de39 (diff)
Update user session button correctly on failure
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatus.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java4
2 files changed, 10 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatus.java b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatus.java
index edfed8d6..90ad0ffd 100644
--- a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatus.java
+++ b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatus.java
@@ -92,6 +92,14 @@ public class UserStatus extends Observable {
return session_status == SessionStatus.LOGGED_OUT;
}
+ public boolean notLoggedIn() {
+ return session_status == SessionStatus.NOT_LOGGED_IN;
+ }
+
+ public boolean didntLogOut() {
+ return session_status == SessionStatus.DIDNT_LOG_OUT;
+ }
+
public static void updateStatus(SessionStatus session_status, Resources resources) {
current_status = getInstance(resources);
current_status.sessionStatus(session_status);
diff --git a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
index f670553f..20189904 100644
--- a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
@@ -138,10 +138,10 @@ public class UserStatusFragment extends Fragment implements Observer, SessionDia
}
private void updateButton() {
- if(status.isLoggedIn())
+ if(status.isLoggedIn() || status.didntLogOut())
button.setText(dashboard.getString(R.string.logout_button));
else if(allows_registration) {
- if (status.isLoggedOut())
+ if (status.isLoggedOut() || status.notLoggedIn())
button.setText(dashboard.getString(R.string.login_button));
else if (status.inProgress())
button.setText(dashboard.getString(android.R.string.cancel));