diff options
author | cyBerta <cyberta@riseup.net> | 2021-11-26 10:58:56 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-11-26 10:58:56 +0100 |
commit | f557975d72b64d7ed13c53c153b40c0fb5522757 (patch) | |
tree | 3dbe03aad0b01ffcc52bc20d309452166b070c3e /app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java | |
parent | c8fba40687516c2e93b6ba691af96f6fb6838df2 (diff) |
disable location entries that are not supporting current transport, show hint in GatewaySelectionFragment and an option to disable bridges
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java b/app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java index 2a082579..3d4f93ff 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/SelectLocationEntry.java @@ -65,14 +65,19 @@ public class SelectLocationEntry extends LinearLayout { title.setText(text); title.setVisibility(text != null ? VISIBLE : GONE); } + public void setLocation(Location location, Connection.TransportType transportType) { - boolean valid = location.hasLocationInfo(); - locationText.setVisibility(valid ? VISIBLE : GONE); - locationIndicator.setVisibility(valid ? VISIBLE : GONE); - bridgesView.setVisibility(transportType == OBFS4 && location.supportsTransport(OBFS4) ? VISIBLE : GONE); + boolean hasData = location.hasLocationInfo(); + boolean supportsSelectedTransport = location.supportsTransport(transportType); + locationText.setVisibility(hasData ? VISIBLE : GONE); + locationIndicator.setVisibility(hasData ? VISIBLE : GONE); + bridgesView.setVisibility(transportType == OBFS4 && supportsSelectedTransport ? VISIBLE : GONE); locationText.setText(location.getName()); locationIndicator.setLoad(Load.getLoadByValue(location.getAverageLoad(transportType))); selectedView.setChecked(location.selected); + locationText.setEnabled(supportsSelectedTransport); + selectedView.setEnabled(supportsSelectedTransport); + setEnabled(!hasData || supportsSelectedTransport); } public void showDivider(boolean show) { |