summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java4
2 files changed, 12 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
index b7d5831c..30a167fc 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
@@ -54,6 +54,7 @@ import static android.content.Context.MODE_PRIVATE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static se.leap.bitmaskclient.base.MainActivity.ACTION_SHOW_VPN_FRAGMENT;
+import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY;
import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.base.models.Constants.USE_PLUGGABLE_TRANSPORTS;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
@@ -133,6 +134,7 @@ public class GatewaySelectionFragment extends Fragment implements SharedPreferen
PreferenceHelper.setPreferredCity(getContext(), null);
locationListAdapter.resetSelection();
}
+ setVpnButtonState();
});
}
@@ -154,12 +156,18 @@ public class GatewaySelectionFragment extends Fragment implements SharedPreferen
} else {
vpnButton.setText(R.string.reconnect);
}
+ vpnButton.setEnabled(
+ (locationListAdapter.selectedLocation != null && locationListAdapter.selectedLocation.selected) ||
+ autoSelectionSwitch.isChecked());
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (USE_PLUGGABLE_TRANSPORTS.equals(key)) {
locationListAdapter.updateData(gatewaysManager.getGatewayLocations());
+ setVpnButtonState();
+ } else if (PREFERRED_CITY.equals(key)) {
+ setVpnButtonState();
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java
index 628b4c15..b6d72ab6 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/views/IconSwitchEntry.java
@@ -131,6 +131,10 @@ public class IconSwitchEntry extends LinearLayout {
switchView.setOnCheckedChangeListener(checkedChangeListener);
}
+ public boolean isChecked() {
+ return switchView.isChecked();
+ }
+
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);