summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-06-01 10:46:53 +0200
committerParménides GV <parmegv@sdf.org>2015-06-01 10:46:53 +0200
commit03973cf7f9b0f8635b6835c548b192eb53a2be35 (patch)
tree6af11a281ce9fd4c8e70863d10093d910751bf66
parentff679b7f20700cec2c08cb8026c585b47df3612f (diff)
parent4560bda1f5c6e5974973f0f3f815e7d6fcf9afb2 (diff)
Merge branch 'feature/simplify-user-session-layout-and-update-dependencies' into feature/Look-for-a-better-solution-to-the-VPN-slider-#6863
-rw-r--r--app/build.gradle13
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java2
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java14
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java2
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderManager.java26
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java30
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/userstatus/FabButton.java34
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java32
-rw-r--r--app/src/main/res/drawable-hdpi/ic_account_circle.pngbin0 -> 1028 bytes
-rw-r--r--app/src/main/res/drawable-mdpi/ic_account_circle.pngbin0 -> 669 bytes
-rw-r--r--app/src/main/res/drawable-xhdpi/ic_account_circle.pngbin0 -> 1447 bytes
-rw-r--r--app/src/main/res/drawable-xxhdpi/ic_account_circle.pngbin0 -> 2339 bytes
-rw-r--r--app/src/main/res/drawable-xxxhdpi/ic_account_circle.pngbin0 -> 3663 bytes
-rw-r--r--app/src/main/res/layout-xlarge/user_session_fragment.xml (renamed from app/src/main/res/layout-xlarge/fragment_user_session.xml)0
-rw-r--r--app/src/main/res/layout/fragment_user_session.xml52
-rw-r--r--app/src/main/res/layout/user_session_fragment.xml43
-rw-r--r--build.gradle4
18 files changed, 150 insertions, 112 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 06af82c8..1d942584 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -39,15 +39,14 @@ android {
}
dependencies {
- androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1'
- compile 'com.jakewharton:butterknife:6.0.0+'
- provided 'com.squareup.dagger:dagger-compiler:1.2.2+'
- compile 'com.github.pedrovgs:renderers:1.3+'
+ androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.4.1'
+ compile 'com.jakewharton:butterknife:6.1.0'
+ provided 'com.squareup.dagger:dagger-compiler:1.2.2'
+ compile 'com.github.pedrovgs:renderers:1.5'
compile 'com.intellij:annotations:12.0'
- compile 'com.google.code.gson:gson:2+'
+ compile 'com.google.code.gson:gson:2.3.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
- compile 'mbanje.kurt:fabbutton:1.0.9'
- compile "com.wefika:flowlayout:0.3.0"
+ compile 'mbanje.kurt:fabbutton:1.1.1'
}
def processFileInplace(file, Closure processText) {
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
index fae44d1c..9a9131fd 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
@@ -50,7 +50,7 @@ public abstract class BaseTestDashboard extends ActivityInstrumentationTestCase2
private void clickAndWaitForDashboard(String click_text) {
solo.clickOnText(click_text);
- assertTrue(solo.waitForActivity(Dashboard.class, 5000));
+ assertTrue(solo.waitForActivity(Dashboard.class, 80 * 1000));
}
static boolean isShownWithinConfinesOfVisibleScreen(View view) {
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
index 40a9f656..25d81da1 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
@@ -52,20 +52,16 @@ public class VpnTestController {
}
protected FabButton getVpnWholeIcon() {
- try {
- View view = solo.getView(R.id.vpn_Status_Image);
- if (view != null)
- return (FabButton) view;
- else
- return null;
- } catch (AssertionFailedError e) {
+ View view = solo.getView(R.id.vpn_Status_Image);
+ if (view != null)
+ return (FabButton) view;
+ else
return null;
- }
}
protected void turningEipOn() {
assertInProgress();
- int max_seconds_until_connected = 30;
+ int max_seconds_until_connected = 120;
Condition condition = new Condition() {
@Override
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java
index 6d267e6e..931457ee 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java
@@ -72,7 +72,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co
private void waitForProviderDetails() {
String text = solo.getString(R.string.provider_details_fragment_title);
- assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 40*1000));
+ assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 60*1000));
}
public void testAddNewProvider() {
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
index 2f3d2614..106d5cf2 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
@@ -1,9 +1,5 @@
package se.leap.bitmaskclient.test;
-import java.util.Locale;
-
-import de.blinkt.openvpn.activities.LogWindow;
-
public class testVpnFragment extends BaseTestDashboard {
@Override
@@ -49,10 +45,12 @@ public class testVpnFragment extends BaseTestDashboard {
* You must pay attention to the screen, because you need to cancel de dialog twice (block vpn and normal vpn)
*/
public void testOnFailed() {
+ /* TODO Do not rely on the Android's vpn trust dialog
vpn_controller.clickVpnButton();
- assertTrue(solo.waitForActivity(LogWindow.class));
+ assertTrue("Have you checked the trust vpn dialog?", solo.waitForActivity(LogWindow.class));
solo.goBack();
- vpn_controller.iconShowsDisconnected();
+ assertTrue(vpn_controller.iconShowsDisconnected());
+ */
}
public void testVpnEveryProvider() {
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java
index 220a71c8..13ef9b80 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderManager.java
@@ -28,7 +28,8 @@ public class ProviderManager implements AdapteeCollection<Provider> {
if (instance == null)
instance = new ProviderManager(assets_manager);
- instance.addCustomProviders(external_files_dir);
+ if(external_files_dir != null)
+ instance.addCustomProviders(external_files_dir);
return instance;
}
@@ -120,7 +121,8 @@ public class ProviderManager implements AdapteeCollection<Provider> {
public Set<Provider> providers() {
Set<Provider> all_providers = new HashSet<Provider>();
all_providers.addAll(default_providers);
- all_providers.addAll(custom_providers);
+ if(custom_providers != null)
+ all_providers.addAll(custom_providers);
return all_providers;
}
@@ -140,25 +142,27 @@ public class ProviderManager implements AdapteeCollection<Provider> {
}
@Override
- public void add(Provider element) {
+ public boolean add(Provider element) {
if (!default_providers.contains(element))
- custom_providers.add(element);
+ return custom_providers.add(element);
+ else return true;
}
@Override
- public void remove(Provider element) {
- custom_providers.remove(element);
+ public boolean remove(Object element) {
+ return custom_providers.remove(element);
}
@Override
- public void addAll(Collection<Provider> elements) {
- custom_providers.addAll(elements);
+ public boolean addAll(Collection<? extends Provider> elements) {
+ return custom_providers.addAll(elements);
}
@Override
- public void removeAll(Collection<Provider> elements) {
- custom_providers.removeAll(elements);
- default_providers.removeAll(elements);
+ public boolean removeAll(Collection<?> elements) {
+ if(!elements.getClass().equals(Provider.class))
+ return false;
+ return default_providers.removeAll(elements) || custom_providers.removeAll(elements);
}
@Override
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 171035d1..f41049c5 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -16,20 +16,27 @@
*/
package se.leap.bitmaskclient.eip;
-import android.content.*;
+import android.content.Context;
+import android.content.SharedPreferences;
-import com.google.gson.*;
-import com.google.gson.reflect.*;
-import com.google.gson.stream.JsonWriter;
+import com.google.gson.Gson;
+import com.google.gson.JsonSyntaxException;
+import com.google.gson.reflect.TypeToken;
-import org.json.*;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
-import de.blinkt.openvpn.*;
-import de.blinkt.openvpn.core.*;
-import se.leap.bitmaskclient.*;
+import de.blinkt.openvpn.VpnProfile;
+import de.blinkt.openvpn.core.Connection;
+import de.blinkt.openvpn.core.ProfileManager;
+import se.leap.bitmaskclient.Provider;
/**
* @author parmegv
@@ -66,7 +73,7 @@ public class GatewaysManager {
}
public void addFromString(String gateways) {
- List<Gateway> gateways_list = new ArrayList<Gateway>();
+ List<Gateway> gateways_list = new ArrayList<>();
try {
gateways_list = new Gson().fromJson(gateways, list_type);
} catch (JsonSyntaxException e) {
@@ -76,7 +83,6 @@ public class GatewaysManager {
if (gateways_list != null) {
for (Gateway gateway : gateways_list)
addGateway(gateway);
- this.gateways.addAll(gateways_list);
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/userstatus/FabButton.java b/app/src/main/java/se/leap/bitmaskclient/userstatus/FabButton.java
new file mode 100644
index 00000000..1bf1847c
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/userstatus/FabButton.java
@@ -0,0 +1,34 @@
+package se.leap.bitmaskclient.userstatus;
+
+
+import android.content.Context;
+import android.util.AttributeSet;
+
+import mbanje.kurt.fabbutton.CircleImageView;
+import se.leap.bitmaskclient.R;
+
+public class FabButton extends mbanje.kurt.fabbutton.FabButton {
+
+
+ public FabButton(Context context) {
+ super(context);
+ }
+
+ public FabButton(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public FabButton(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected void init(Context context, AttributeSet attrs, int defStyle) {
+ super.init(context, attrs, defStyle);
+ super.init(context, attrs, defStyle);
+ }
+
+ private CircleImageView getImage() {
+ return (CircleImageView) findViewById(R.id.fabbutton_circle);
+ }
+}
diff --git a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
index f0f4a8fa..f670553f 100644
--- a/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/userstatus/UserStatusFragment.java
@@ -1,17 +1,29 @@
package se.leap.bitmaskclient.userstatus;
-import android.app.*;
-import android.os.*;
-import android.view.*;
-import android.widget.*;
+import android.app.Activity;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
-import java.util.*;
-
-import butterknife.*;
-import mbanje.kurt.fabbutton.FabButton;
-import se.leap.bitmaskclient.*;
+import java.util.Observable;
+import java.util.Observer;
+
+import butterknife.ButterKnife;
+import butterknife.InjectView;
+import butterknife.OnClick;
+import se.leap.bitmaskclient.Dashboard;
+import se.leap.bitmaskclient.Provider;
+import se.leap.bitmaskclient.ProviderAPI;
+import se.leap.bitmaskclient.ProviderAPICommand;
+import se.leap.bitmaskclient.ProviderAPIResultReceiver;
+import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.eip.EipStatus;
public class UserStatusFragment extends Fragment implements Observer, SessionDialog.SessionDialogInterface {
@@ -50,7 +62,7 @@ public class UserStatusFragment extends Fragment implements Observer, SessionDia
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.fragment_user_session, container, false);
+ View view = inflater.inflate(R.layout.user_session_fragment, container, false);
ButterKnife.inject(this, view);
Bundle arguments = getArguments();
diff --git a/app/src/main/res/drawable-hdpi/ic_account_circle.png b/app/src/main/res/drawable-hdpi/ic_account_circle.png
new file mode 100644
index 00000000..60e50a03
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_account_circle.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_account_circle.png b/app/src/main/res/drawable-mdpi/ic_account_circle.png
new file mode 100644
index 00000000..9cc9f0b5
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_account_circle.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_account_circle.png b/app/src/main/res/drawable-xhdpi/ic_account_circle.png
new file mode 100644
index 00000000..8af55604
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_account_circle.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_account_circle.png b/app/src/main/res/drawable-xxhdpi/ic_account_circle.png
new file mode 100644
index 00000000..6e81a76b
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_account_circle.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_account_circle.png b/app/src/main/res/drawable-xxxhdpi/ic_account_circle.png
new file mode 100644
index 00000000..9511ae3a
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_account_circle.png
Binary files differ
diff --git a/app/src/main/res/layout-xlarge/fragment_user_session.xml b/app/src/main/res/layout-xlarge/user_session_fragment.xml
index 30969219..30969219 100644
--- a/app/src/main/res/layout-xlarge/fragment_user_session.xml
+++ b/app/src/main/res/layout-xlarge/user_session_fragment.xml
diff --git a/app/src/main/res/layout/fragment_user_session.xml b/app/src/main/res/layout/fragment_user_session.xml
deleted file mode 100644
index 5194e495..00000000
--- a/app/src/main/res/layout/fragment_user_session.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:layout_marginLeft="20dp"
- android:layout_marginStart="20dp"
- tools:context="se.leap.bitmaskclient.userstatus.UserStatusFragment">
-
- <TextView
- android:id="@+id/user.status.username"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="10dp"
- android:layout_marginRight="20dp"
- android:layout_marginEnd="20dp"
- android:textSize="20sp"
- android:text="@string/default_username"
- android:textAppearance="?android:attr/textAppearanceMedium"/>
-
- <LinearLayout
- android:id="@+id/user.status.buttonAndIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
-
- <Button
- android:id="@+id/user.status.button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="14sp"
- />
-
- <view
- android:id="@+id/user.status.icon"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:layout_marginLeft="9dp"
- android:layout_marginStart="9dp"
- android:background="@android:color/transparent"
- android:color="@android:color/holo_blue_dark"
- class="mbanje.kurt.fabbutton.FabButton"
- android:layout_gravity="center"
- android:visibility="visible"
- android:indeterminate="true"
- android:max="100"
- fbb_autoStart="true"
- fbb_progressColor="#ff170aff"
- fbb_progressWidthRatio="0.1"
- />
-
- </LinearLayout>
-</LinearLayout>
diff --git a/app/src/main/res/layout/user_session_fragment.xml b/app/src/main/res/layout/user_session_fragment.xml
new file mode 100644
index 00000000..30068381
--- /dev/null
+++ b/app/src/main/res/layout/user_session_fragment.xml
@@ -0,0 +1,43 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:layout_marginLeft="20dp"
+ android:layout_marginStart="20dp"
+ tools:context="se.leap.bitmaskclient.userstatus.UserStatusFragment">
+
+ <TextView
+ android:id="@+id/user.status.username"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="10dp"
+ android:layout_marginRight="15dp"
+ android:layout_marginEnd="20dp"
+ android:textSize="20sp"
+ android:text="@string/default_username"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+
+ <Button
+ android:id="@+id/user.status.button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="14sp"
+ />
+
+ <view
+ android:id="@+id/user.status.icon"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_marginLeft="9dp"
+ android:layout_marginStart="9dp"
+ android:shadowRadius="0"
+ android:src="@drawable/ic_account_circle"
+ android:color="@android:color/transparent"
+ class="se.leap.bitmaskclient.userstatus.FabButton"
+ android:indeterminate="true"
+ fbb_progressColor="@android:color/holo_blue_dark"
+ fbb_progressWidthRatio="0.1"
+ />
+
+</LinearLayout>
diff --git a/build.gradle b/build.gradle
index be0bf72a..a27276d0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,12 +1,10 @@
-import org.apache.tools.ant.filters.ReplaceTokens
-
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.3'
+ classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'org.ajoberstar:gradle-git:0.10+'
}
}