summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-11-16 00:12:38 +0100
committercyBerta <cyberta@riseup.net>2021-11-16 00:12:38 +0100
commit7436008db89d4ddf4f918fc220dc813b3289d0d7 (patch)
treec1db4a2d9287e5a5ea7225137270b8347f2666a2 /app/src/main
parent3fc8ce49531d475886b27921155c94fc3cabd177 (diff)
add bridge indicator to bottom panel
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java11
-rw-r--r--app/src/main/res/layout/v_location_button.xml44
-rw-r--r--app/src/main/res/layout/v_location_status_indicator.xml2
5 files changed, 59 insertions, 8 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
index a8fed675..4fa5a7b6 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/VpnStatus.java
@@ -541,4 +541,8 @@ public class VpnStatus {
public static boolean isAlwaysOn() {
return isAlwaysOnBooting.get();
}
+
+ public static boolean isUsingBridges() {
+ return lastConnectedProfile != null && lastConnectedProfile.mUsePluggableTransports;
+ }
}
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);
+ }
}
diff --git a/app/src/main/res/layout/v_location_button.xml b/app/src/main/res/layout/v_location_button.xml
index 6bc8637f..6a7214c8 100644
--- a/app/src/main/res/layout/v_location_button.xml
+++ b/app/src/main/res/layout/v_location_button.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
@@ -9,8 +9,12 @@
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
+ android:id="@+id/world_icn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_alignTop="@+id/text_location"
+ android:layout_alignBottom="@+id/text_location"
+ android:scaleType="fitXY"
android:src="@drawable/ic_web"
android:layout_gravity="center"
/>
@@ -20,26 +24,54 @@
android:paddingLeft="@dimen/stdpadding"
android:paddingEnd="@dimen/stdpadding"
android:paddingRight="@dimen/stdpadding"
- android:layout_weight="1"
- android:layout_width="0dp"
android:maxLines="1"
android:ellipsize="end"
android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_toEndOf="@id/world_icn"
+ android:layout_toRightOf="@+id/world_icn"
+ android:layout_toLeftOf="@+id/bridge_icn"
+ android:layout_toStartOf="@+id/bridge_icn"
android:layout_gravity="center_vertical"
+ android:layout_centerInParent="true"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textStyle="bold"
android:textColor="@color/white"
- tools:text="Seattle"
+ tools:text="Seattle along message"
+ />
+
+ <androidx.appcompat.widget.AppCompatImageView
+ android:id="@+id/bridge_icn"
+ android:paddingRight="@dimen/stdpadding"
+ android:paddingEnd="@dimen/stdpadding"
+ android:paddingStart="@dimen/stdpadding"
+ android:paddingLeft="@dimen/stdpadding"
+ android:layout_marginBottom="-5dp"
+ android:layout_marginTop="-5dp"
+ android:scaleType="fitXY"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignTop="@id/text_location"
+ android:layout_alignBottom="@+id/text_location"
+ android:layout_toStartOf="@id/load_indicator"
+ android:layout_toLeftOf="@id/load_indicator"
+ android:src="@drawable/ic_bridge_36"
+ android:visibility="gone"
/>
<se.leap.bitmaskclient.base.views.LocationIndicator
android:id="@+id/load_indicator"
+ android:layout_marginBottom="4dp"
android:layout_width="48dp"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignTop="@id/text_location"
+ android:layout_alignBottom="@id/text_location"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
android:visibility="visible"
android:layout_gravity="center_vertical"
/>
-</androidx.appcompat.widget.LinearLayoutCompat> \ No newline at end of file
+</RelativeLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/v_location_status_indicator.xml b/app/src/main/res/layout/v_location_status_indicator.xml
index 22453167..548a965f 100644
--- a/app/src/main/res/layout/v_location_status_indicator.xml
+++ b/app/src/main/res/layout/v_location_status_indicator.xml
@@ -5,7 +5,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="8dp">
+ >
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_vertical_first"