diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java index 9244f531..8182cab9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java @@ -73,14 +73,13 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { @Override public void updateState(final String state, final String logmessage, final int localizedResId, final ConnectionStatus level) { - ConnectionStatus tmp = currentStatus.getLevel(); - currentStatus = getInstance(); - currentStatus.setState(state); - currentStatus.setLogMessage(logmessage); - currentStatus.setLocalizedResId(localizedResId); - currentStatus.setLevel(level); - currentStatus.setEipLevel(level); - if (tmp != currentStatus.getLevel() || "RECONNECTING".equals(state) || "UI_CONNECTING".equals(state)) { + ConnectionStatus tmp = getInstance().getLevel(); + getInstance().setState(state); + getInstance().setLogMessage(logmessage); + getInstance().setLocalizedResId(localizedResId); + getInstance().setLevel(level); + getInstance().setEipLevel(level); + if (tmp != getInstance().getLevel() || "RECONNECTING".equals(state) || "UI_CONNECTING".equals(state)) { refresh(); } } @@ -90,13 +89,13 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { } public boolean isReconnecting() { - Log.d(TAG, "eip currentVPNStatus : " + currentStatus.getState() ); - return "RECONNECTING".equals(currentStatus.getState()); + Log.d(TAG, "eip currentVPNStatus : " + getInstance().getState() ); + return "RECONNECTING".equals(getInstance().getState()); } public boolean isVPNRunningWithoutNetwork() { - return currentStatus.getLevel() == LEVEL_NONETWORK && - !"NO_PROCESS".equals(currentStatus.getState()); + return getInstance().getLevel() == LEVEL_NONETWORK && + !"NO_PROCESS".equals(getInstance().getState()); } private void setEipLevel(ConnectionStatus level) { @@ -147,7 +146,7 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { * @param futureLevel */ private void setEipLevelWithDelay(ConnectionStatus futureLevel) { - new DelayTask(currentStatus.getLevel(), futureLevel).execute(); + new DelayTask(getInstance().getLevel(), futureLevel).execute(); } private static class DelayTask extends AsyncTask<Void, Void, Void> { @@ -169,7 +168,7 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { } protected void onPostExecute(Void result) { - if (currentLevel == currentStatus.getLevel()) { + if (currentLevel == getInstance().getLevel()) { switch (futureLevel) { case LEVEL_NONETWORK: currentEipLevel = EipLevel.DISCONNECTED; @@ -301,8 +300,8 @@ public class EipStatus extends Observable implements VpnStatus.StateListener { } public static void refresh() { - currentStatus.setChanged(); - currentStatus.notifyObservers(); + getInstance().setChanged(); + getInstance().notifyObservers(); } } |