summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/userstatus
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2017-12-19 15:09:40 +0100
committerFup Duck <fupduck@sacknagel.com>2017-12-19 15:09:40 +0100
commit7cd685e486e735c3994d59c01df98ac2f82dc0b2 (patch)
tree8897ba0a06502363c5e7bc9b8599581dcd26a443 /app/src/main/java/se/leap/bitmaskclient/userstatus
parent67ff3447f10c43770dc9ee4dccf358321063d131 (diff)
refactor dashboard
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/userstatus')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java17
1 files changed, 7 insertions, 10 deletions
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 14323f8e..f4be3ea1 100644
--- a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
@@ -28,7 +28,6 @@ import se.leap.bitmaskclient.R;
public class UserStatusFragment extends Fragment implements Observer, SessionDialog.SessionDialogInterface {
public static String TAG = UserStatusFragment.class.getSimpleName();
- private static Dashboard dashboard;
private ProviderAPIResultReceiver providerAPI_result_receiver;
@InjectView(R.id.user_status_username)
@@ -74,16 +73,14 @@ public class UserStatusFragment extends Fragment implements Observer, SessionDia
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
- dashboard = (Dashboard) activity;
-
- providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), dashboard);
+ providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), Dashboard.dashboardReceiver);
}
public void restoreSessionStatus(Bundle savedInstanceState) {
if (savedInstanceState != null)
if (savedInstanceState.containsKey(UserStatus.TAG)) {
UserStatus.SessionStatus status = (UserStatus.SessionStatus) savedInstanceState.getSerializable(UserStatus.TAG);
- this.status.updateStatus(status, getResources());
+ UserStatus.updateStatus(status, getResources());
}
}
@@ -93,7 +90,7 @@ public class UserStatusFragment extends Fragment implements Observer, SessionDia
if(status.isLoggedIn())
logOut();
else if(status.isLoggedOut())
- dashboard.sessionDialog(Bundle.EMPTY);
+ Dashboard.sessionDialog(Bundle.EMPTY);
else if(status.inProgress())
cancelLoginOrSignup();
}
@@ -102,7 +99,7 @@ public class UserStatusFragment extends Fragment implements Observer, SessionDia
public void update(Observable observable, Object data) {
if (observable instanceof UserStatus) {
final UserStatus status = (UserStatus) observable;
- dashboard.runOnUiThread(new Runnable() {
+ getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
handleNewStatus(status);
@@ -138,12 +135,12 @@ public class UserStatusFragment extends Fragment implements Observer, SessionDia
private void updateButton() {
if(status.isLoggedIn() || status.didntLogOut())
- button.setText(dashboard.getString(R.string.logout_button));
+ button.setText(getActivity().getString(R.string.logout_button));
else if(allows_registration) {
if (status.isLoggedOut() || status.notLoggedIn())
- button.setText(dashboard.getString(R.string.login_button));
+ button.setText(getActivity().getString(R.string.login_button));
else if (status.inProgress())
- button.setText(dashboard.getString(android.R.string.cancel));
+ button.setText(getActivity().getString(android.R.string.cancel));
}
}