summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java3
-rw-r--r--app/src/main/res/drawable/main_btn_glow.xml21
-rw-r--r--app/src/main/res/drawable/on_off_btn_an1.pngbin0 -> 16186 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_an2.pngbin0 -> 12771 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_an3.pngbin0 -> 10006 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_an4.pngbin0 -> 9308 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_start_animation1.pngbin32481 -> 0 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_start_animation2.pngbin36701 -> 0 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_start_animation3.pngbin39980 -> 0 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_start_animation4.pngbin41982 -> 0 bytes
-rw-r--r--app/src/main/res/drawable/on_off_btn_start_animation5.pngbin43093 -> 0 bytes
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java8
13 files changed, 25 insertions, 17 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 07057d6e..dfa45614 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
@@ -416,14 +416,14 @@ public class EipFragment extends Fragment implements Observer {
}
Log.d(TAG, "eip fragment eipStatus state: " + eipStatus.getState() + " - level: " + eipStatus.getLevel() + " - is reconnecting: " + eipStatus.isReconnecting());
- if (eipStatus.isConnecting() ) {
+ if (eipStatus.isConnecting()) {
setMainButtonEnabled(true);
showConnectionTransitionLayout(true);
locationButton.setText(getString(R.string.eip_status_start_pending));
locationButton.setLocationLoad(UNKNOWN);
locationButton.showBridgeIndicator(false);
locationButton.showRecommendedIndicator(false);
- mainDescription.setText(R.string.eip_state_insecure);
+ mainDescription.setText(null);
subDescription.setText(null);
} else if (eipStatus.isConnected()) {
setMainButtonEnabled(true);
@@ -436,7 +436,7 @@ public class EipFragment extends Fragment implements Observer {
mainDescription.setText(R.string.eip_state_connected);
subDescription.setText(null);
colorBackground();
- } else if(isOpenVpnRunningWithoutNetwork()){
+ } else if(isOpenVpnRunningWithoutNetwork()) {
Log.d(TAG, "eip fragment eipStatus - isOpenVpnRunningWithoutNetwork");
setMainButtonEnabled(true);
mainButton.updateState(true, false, true);
@@ -454,7 +454,7 @@ public class EipFragment extends Fragment implements Observer {
locationButton.setLocationLoad(UNKNOWN);
locationButton.showBridgeIndicator(false);
locationButton.showRecommendedIndicator(false);
- mainDescription.setText(R.string.eip_state_insecure);
+ mainDescription.setText(null);
subDescription.setText(R.string.reconnecting);
} else if (eipStatus.isDisconnecting()) {
setMainButtonEnabled(false);
@@ -515,7 +515,7 @@ public class EipFragment extends Fragment implements Observer {
}
private void showConnectionTransitionLayout(boolean isConnecting) {
- mainButton.updateState(true, true, false);
+ mainButton.updateState(true, isConnecting, false);
if (isConnecting) {
colorBackgroundALittle();
} else {
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index 060e69f2..0dd4c26c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -211,6 +211,9 @@ public class GatewaysManager {
public Load getLoadForLocation(@Nullable String name, TransportType transportType) {
Location location = getLocation(name);
+ if (location == null) {
+ return Load.UNKNOWN;
+ }
return Load.getLoadByValue(location.getAverageLoad(transportType));
}
diff --git a/app/src/main/res/drawable/main_btn_glow.xml b/app/src/main/res/drawable/main_btn_glow.xml
index 76b2268a..5ed57dd5 100644
--- a/app/src/main/res/drawable/main_btn_glow.xml
+++ b/app/src/main/res/drawable/main_btn_glow.xml
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
+
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
- <item android:drawable="@drawable/on_off_btn_start_animation1" android:duration="100" />
- <item android:drawable="@drawable/on_off_btn_start_animation2" android:duration="125" />
- <item android:drawable="@drawable/on_off_btn_start_animation3" android:duration="150" />
- <item android:drawable="@drawable/on_off_btn_start_animation4" android:duration="175" />
- <item android:drawable="@drawable/on_off_btn_start_animation3" android:duration="150" />
- <item android:drawable="@drawable/on_off_btn_start_animation2" android:duration="120" />
- <item android:drawable="@drawable/on_off_btn_start_animation3" android:duration="150" />
- <item android:drawable="@drawable/on_off_btn_start_animation4" android:duration="200" />
- <item android:drawable="@drawable/on_off_btn_start_animation5" android:duration="250" />
- <item android:drawable="@drawable/on_off_btn_start_animation4" android:duration="200" />
- <item android:drawable="@drawable/on_off_btn_start_animation3" android:duration="150" />
- <item android:drawable="@drawable/on_off_btn_start_animation2" android:duration="125" />
+ <item android:drawable="@drawable/on_off_btn_start_2_enabled" android:duration="150" />
+ <item android:drawable="@drawable/on_off_btn_an4" android:duration="75" />
+ <item android:drawable="@drawable/on_off_btn_an3" android:duration="100" />
+ <item android:drawable="@drawable/on_off_btn_an2" android:duration="125" />
+ <item android:drawable="@drawable/on_off_btn_an1" android:duration="400" />
+ <item android:drawable="@drawable/on_off_btn_an2" android:duration="125" />
+ <item android:drawable="@drawable/on_off_btn_an3" android:duration="100" />
+ <item android:drawable="@drawable/on_off_btn_an4" android:duration="75" />
</animation-list> \ No newline at end of file
diff --git a/app/src/main/res/drawable/on_off_btn_an1.png b/app/src/main/res/drawable/on_off_btn_an1.png
new file mode 100644
index 00000000..c80feeb7
--- /dev/null
+++ b/app/src/main/res/drawable/on_off_btn_an1.png
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_an2.png b/app/src/main/res/drawable/on_off_btn_an2.png
new file mode 100644
index 00000000..73f4cb7e
--- /dev/null
+++ b/app/src/main/res/drawable/on_off_btn_an2.png
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_an3.png b/app/src/main/res/drawable/on_off_btn_an3.png
new file mode 100644
index 00000000..98ad0220
--- /dev/null
+++ b/app/src/main/res/drawable/on_off_btn_an3.png
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_an4.png b/app/src/main/res/drawable/on_off_btn_an4.png
new file mode 100644
index 00000000..49070e5f
--- /dev/null
+++ b/app/src/main/res/drawable/on_off_btn_an4.png
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_start_animation1.png b/app/src/main/res/drawable/on_off_btn_start_animation1.png
deleted file mode 100644
index f9d18488..00000000
--- a/app/src/main/res/drawable/on_off_btn_start_animation1.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_start_animation2.png b/app/src/main/res/drawable/on_off_btn_start_animation2.png
deleted file mode 100644
index 33b600c9..00000000
--- a/app/src/main/res/drawable/on_off_btn_start_animation2.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_start_animation3.png b/app/src/main/res/drawable/on_off_btn_start_animation3.png
deleted file mode 100644
index 2172107a..00000000
--- a/app/src/main/res/drawable/on_off_btn_start_animation3.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_start_animation4.png b/app/src/main/res/drawable/on_off_btn_start_animation4.png
deleted file mode 100644
index 8b744462..00000000
--- a/app/src/main/res/drawable/on_off_btn_start_animation4.png
+++ /dev/null
Binary files differ
diff --git a/app/src/main/res/drawable/on_off_btn_start_animation5.png b/app/src/main/res/drawable/on_off_btn_start_animation5.png
deleted file mode 100644
index 11bb16cd..00000000
--- a/app/src/main/res/drawable/on_off_btn_start_animation5.png
+++ /dev/null
Binary files differ
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
index a3cde58b..729abcdf 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
@@ -20,6 +20,7 @@ import java.util.List;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
+import de.blinkt.openvpn.core.connection.Connection;
import se.leap.bitmaskclient.base.models.Location;
import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.base.models.ProviderObservable;
@@ -508,6 +509,13 @@ public class GatewaysManagerTest {
assertEquals("Amsterdam", locations.get(2).getName());
}
+ @Test
+ public void testGetLoadForLocation_() {
+ MockHelper.mockProviderObservable(null);
+ GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
+ assertEquals(GatewaysManager.Load.UNKNOWN, gatewaysManager.getLoadForLocation("unknown city", OPENVPN));
+ }
+
private String getJsonStringFor(String filename) throws IOException {
return TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream(filename));
}