diff options
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java | 6 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index 18e97411..b2e91fd5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -426,11 +426,13 @@ public class EipFragment extends Fragment implements Observer { mainDescription.setText(R.string.eip_state_insecure); locationButton.setVisibility(VISIBLE); locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); } else if (eipStatus.isConnected()) { setMainButtonEnabled(true); mainButton.updateState(true, false, false); locationButton.setLocationLoad(gatewaysManager.getLoadForLocation(VpnStatus.getLastConnectedVpnName())); locationButton.setText(VpnStatus.getLastConnectedVpnName()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); locationButton.setVisibility(VISIBLE); colorBackground(); mainDescription.setText(R.string.eip_state_connected); @@ -443,6 +445,7 @@ public class EipFragment extends Fragment implements Observer { mainButton.updateState(true, false, true); locationButton.setVisibility(VISIBLE); locationButton.setText(VpnStatus.getCurrentlyConnectingVpnName()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); colorBackgroundALittle(); mainDescription.setText(R.string.eip_state_insecure); subDescription.setText(R.string.eip_state_no_network); @@ -452,6 +455,7 @@ public class EipFragment extends Fragment implements Observer { locationButton.setText(getString(R.string.finding_best_connection)); locationButton.setVisibility(VISIBLE); locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); mainDescription.setText(R.string.eip_state_insecure); subDescription.setText(R.string.reconnecting); } else if (eipStatus.isDisconnecting()) { @@ -466,6 +470,7 @@ public class EipFragment extends Fragment implements Observer { locationButton.setText(getString(R.string.finding_best_connection)); locationButton.setVisibility(VISIBLE); locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); mainDescription.setText(R.string.eip_state_connected); subDescription.setText(R.string.eip_state_blocking); } else { @@ -474,6 +479,7 @@ public class EipFragment extends Fragment implements Observer { mainButton.updateState(false, false, false); greyscaleBackground(); locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); locationButton.setVisibility(INVISIBLE); mainDescription.setText(R.string.eip_state_insecure); subDescription.setText(R.string.connection_not_connected); diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java b/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java index 1d7f0d18..11ea198c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java @@ -4,18 +4,22 @@ import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; +import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.AppCompatTextView; import androidx.appcompat.widget.LinearLayoutCompat; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.eip.GatewaysManager; -public class LocationButton extends LinearLayoutCompat { +public class LocationButton extends RelativeLayout { private LocationIndicator locationIndicator; private AppCompatTextView textView; + private AppCompatImageView bridgeView; + public LocationButton(@NonNull Context context) { super(context); initLayout(context); @@ -32,6 +36,7 @@ public class LocationButton extends LinearLayoutCompat { View rootview = inflater.inflate(R.layout.v_location_button, this, true); locationIndicator = rootview.findViewById(R.id.load_indicator); textView = rootview.findViewById(R.id.text_location); + bridgeView = rootview.findViewById(R.id.bridge_icn); } public void setLocationLoad(GatewaysManager.Load load) { @@ -41,4 +46,8 @@ public class LocationButton extends LinearLayoutCompat { public void setText(CharSequence text) { textView.setText(text); } + + public void showBridgeIndicator(boolean show) { + bridgeView.setVisibility(show ? VISIBLE : GONE); + } } |