diff options
Diffstat (limited to 'app/src')
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 Binary files differnew file mode 100644 index 00000000..c80feeb7 --- /dev/null +++ b/app/src/main/res/drawable/on_off_btn_an1.png diff --git a/app/src/main/res/drawable/on_off_btn_an2.png b/app/src/main/res/drawable/on_off_btn_an2.png Binary files differnew file mode 100644 index 00000000..73f4cb7e --- /dev/null +++ b/app/src/main/res/drawable/on_off_btn_an2.png diff --git a/app/src/main/res/drawable/on_off_btn_an3.png b/app/src/main/res/drawable/on_off_btn_an3.png Binary files differnew file mode 100644 index 00000000..98ad0220 --- /dev/null +++ b/app/src/main/res/drawable/on_off_btn_an3.png diff --git a/app/src/main/res/drawable/on_off_btn_an4.png b/app/src/main/res/drawable/on_off_btn_an4.png Binary files differnew file mode 100644 index 00000000..49070e5f --- /dev/null +++ b/app/src/main/res/drawable/on_off_btn_an4.png 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 Binary files differdeleted file mode 100644 index f9d18488..00000000 --- a/app/src/main/res/drawable/on_off_btn_start_animation1.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 33b600c9..00000000 --- a/app/src/main/res/drawable/on_off_btn_start_animation2.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 2172107a..00000000 --- a/app/src/main/res/drawable/on_off_btn_start_animation3.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 8b744462..00000000 --- a/app/src/main/res/drawable/on_off_btn_start_animation4.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 11bb16cd..00000000 --- a/app/src/main/res/drawable/on_off_btn_start_animation5.png +++ /dev/null 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)); } |