summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java8
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/ConnectionsAdapter.java2
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java35
-rw-r--r--main/src/main/res/drawable/bg_switchbar.xml9
-rw-r--r--main/src/main/res/layout/allowed_vpn_apps.xml46
-rw-r--r--main/src/main/res/layout/connections.xml4
-rw-r--r--main/src/main/res/menu/connections.xml2
-rw-r--r--main/src/main/res/values-v21/styles.xml1
-rw-r--r--main/src/main/res/values/colours.xml10
-rw-r--r--main/src/main/res/values/dimens.xml1
-rwxr-xr-xmain/src/main/res/values/strings.xml5
-rw-r--r--main/src/main/res/values/styles.xml7
12 files changed, 82 insertions, 48 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
index f5e55504..b2246b8c 100644
--- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -802,6 +802,14 @@ public class VpnProfile implements Serializable {
if (!mUseDefaultRoute && (getCustomRoutes(mCustomRoutes) == null || getCustomRoutes(mExcludedRoutes) ==null))
return R.string.custom_route_format_error;
+ boolean noRemoteEnabled = true;
+ for (Connection c : mConnections)
+ if (c.mEnabled)
+ noRemoteEnabled = false;
+
+ if(noRemoteEnabled)
+ return R.string.remote_no_server_selected;
+
// Everything okay
return R.string.no_error_found;
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/ConnectionsAdapter.java b/main/src/main/java/de/blinkt/openvpn/fragments/ConnectionsAdapter.java
index 9fd7c04f..6d11c7d7 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/ConnectionsAdapter.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/ConnectionsAdapter.java
@@ -184,7 +184,7 @@ public class ConnectionsAdapter extends RecyclerView.Adapter<ConnectionsAdapter.
mConnections2[i-1]=mConnections[i];
}
mConnections = mConnections2;
- displayWarningifNoneEnabled();
+
}
@Override
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java
index 3da48f2b..451da07f 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Allowed_Apps.java
@@ -8,28 +8,21 @@ package de.blinkt.openvpn.fragments;
import android.app.Fragment;
import android.content.Context;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.TextUtils;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
-import android.widget.Filter;
import android.widget.ImageView;
import android.widget.ListView;
-import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextView;
-import android.widget.ToggleButton;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import de.blinkt.openvpn.R;
@@ -42,6 +35,7 @@ import de.blinkt.openvpn.core.ProfileManager;
public class Settings_Allowed_Apps extends Fragment {
private ListView mListView;
private VpnProfile mProfile;
+ private TextView mDefaultAllowTextView;
static class AppViewHolder {
public ApplicationInfo mInfo;
@@ -155,23 +149,19 @@ public class Settings_Allowed_Apps extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.allowed_vpn_apps, container, false);
- RadioGroup group = (RadioGroup) v.findViewById(R.id.allowed_vpn_radiogroup);
- group.check(mProfile.mAllowedAppsVpnAreDisallowed ? R.id.radio_vpn_disallow : R.id.radio_vpn_allow);
+ Switch vpnOnDefaultSwitch = (Switch) v.findViewById(R.id.default_allow);
+ vpnOnDefaultSwitch.setChecked(mProfile.mAllowedAppsVpnAreDisallowed);
- group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+ vpnOnDefaultSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- switch(checkedId){
- case R.id.radio_vpn_allow:
- mProfile.mAllowedAppsVpnAreDisallowed=false;
- break;
- case R.id.radio_vpn_disallow:
- mProfile.mAllowedAppsVpnAreDisallowed=true;
- break;
- }
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ changeDisallowText(isChecked);
}
});
+ mDefaultAllowTextView = (TextView) v.findViewById(R.id.default_allow_text);
+
+ changeDisallowText(mProfile.mAllowedAppsVpnAreDisallowed);
mListView = (ListView) v.findViewById(android.R.id.list);
@@ -179,4 +169,11 @@ public class Settings_Allowed_Apps extends Fragment {
return v;
}
+
+ private void changeDisallowText(boolean selectedAreDisallowed) {
+ if(selectedAreDisallowed)
+ mDefaultAllowTextView.setText(R.string.vpn_disallow_radio);
+ else
+ mDefaultAllowTextView.setText(R.string.vpn_allow_radio);
+ }
}
diff --git a/main/src/main/res/drawable/bg_switchbar.xml b/main/src/main/res/drawable/bg_switchbar.xml
new file mode 100644
index 00000000..1f6d3c92
--- /dev/null
+++ b/main/src/main/res/drawable/bg_switchbar.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2012-2014 Arne Schwabe
+ ~ Distributed under the GNU GPL v2. For full terms see the file doc/LICENSE.txt
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/switchbar" />
+</shape> \ No newline at end of file
diff --git a/main/src/main/res/layout/allowed_vpn_apps.xml b/main/src/main/res/layout/allowed_vpn_apps.xml
index e5228f8a..c4369885 100644
--- a/main/src/main/res/layout/allowed_vpn_apps.xml
+++ b/main/src/main/res/layout/allowed_vpn_apps.xml
@@ -4,31 +4,39 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:background="@color/rot"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <RadioGroup
- android:id="@+id/allowed_vpn_radiogroup"
+ <Button
+ android:background="@color/primary"
android:layout_width="match_parent"
- android:elevation="2dp"
- android:background="@drawable/white_rect"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content" />
- <RadioButton
- android:layout_margin="@dimen/stdpadding"
- android:id="@+id/radio_vpn_disallow"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/vpn_disallow_radio" />
-
- <RadioButton
- android:layout_margin="@dimen/stdpadding"
- android:id="@+id/radio_vpn_allow"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/vpn_allow_radio" />
- </RadioGroup>
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/actionBarSize"
+ android:background="@color/switchbar"
+ android:paddingStart="@dimen/switchbar_pad"
+ android:paddingEnd="@dimen/switchbar_pad"
+ tools:ignore="NewApi">
+ <TextView
+ android:id="@+id/default_allow_text"
+ style="@android:style/TextAppearance.Medium.Inverse"
+ tools:text="@string/vpn_disallow_radio"
+ android:layout_width="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_height="wrap_content" />
+ <Switch
+ android:id="@+id/default_allow"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ </RelativeLayout>
<ListView
android:id="@android:id/list"
diff --git a/main/src/main/res/layout/connections.xml b/main/src/main/res/layout/connections.xml
index 011d3472..12de24bc 100644
--- a/main/src/main/res/layout/connections.xml
+++ b/main/src/main/res/layout/connections.xml
@@ -14,7 +14,7 @@
<CheckBox
- android:text="Use connection entries in random order on connect"
+ android:text="@string/remote_random"
android:id="@+id/remote_random"
android:padding="@dimen/stdpadding"
android:layout_width="wrap_content"
@@ -41,7 +41,7 @@
android:elevation="2dp"
android:gravity="center_vertical"
android:padding="@dimen/stdpadding"
- android:text="You need to enable at least one server."
+ android:text="@string/remote_no_server_selected"
android:visibility="visible"
tools:visibility="visible" />
diff --git a/main/src/main/res/menu/connections.xml b/main/src/main/res/menu/connections.xml
index 7446746f..f7da6d54 100644
--- a/main/src/main/res/menu/connections.xml
+++ b/main/src/main/res/menu/connections.xml
@@ -7,7 +7,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:icon="@drawable/ic_menu_add"
- android:title="Add new remote"
+ android:title="@string/add_remote"
android:id="@+id/add_new_remote"
android:titleCondensed="@string/add"
android:showAsAction="ifRoom|withText"
diff --git a/main/src/main/res/values-v21/styles.xml b/main/src/main/res/values-v21/styles.xml
index 12926e79..754dbc9a 100644
--- a/main/src/main/res/values-v21/styles.xml
+++ b/main/src/main/res/values-v21/styles.xml
@@ -11,5 +11,6 @@
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
+ <item name="android:preferenceStyle">@style/BlinktPreferencePanel</item>
</style>
</resources>
diff --git a/main/src/main/res/values/colours.xml b/main/src/main/res/values/colours.xml
index 7028885a..7e67dacd 100644
--- a/main/src/main/res/values/colours.xml
+++ b/main/src/main/res/values/colours.xml
@@ -7,7 +7,11 @@
<resources>
<!-- Indigo -->
<!-- OpenVPN colours #203155, #C66D0D -->
- <color name="primary">#3F51B5</color>
- <color name="primary_dark">#303F9F</color>
- <color name="accent">#FFA726</color>
+ <color name="primary">#3F51B5</color> <!--500-->
+ <color name="primary_dark">#303F9F</color> <!--700-->
+ <color name="accent">#FFA726</color> <!-- Orange 400 -->
+ <color name="switchbar">#5C6BC0</color> <!-- 400-->
+ <color name="gelb">#ffff00</color>
+ <color name="rot">#ff0000</color>
+
</resources> \ No newline at end of file
diff --git a/main/src/main/res/values/dimens.xml b/main/src/main/res/values/dimens.xml
index d46cfa98..1abe1957 100644
--- a/main/src/main/res/values/dimens.xml
+++ b/main/src/main/res/values/dimens.xml
@@ -14,6 +14,7 @@
<dimen name="elevation_high">4dp</dimen>
<dimen name="add_button_margin">16dp</dimen>
<dimen name="round_button_diameter">56dp</dimen>
+ <dimen name="switchbar_pad">16dp</dimen>
</resources> \ No newline at end of file
diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml
index 648779fe..371466e3 100755
--- a/main/src/main/res/values/strings.xml
+++ b/main/src/main/res/values/strings.xml
@@ -329,8 +329,6 @@
<string name="client_behaviour">Client behaviour</string>
<string name="clear_external_apps">Clear allowed external apps</string>
<string name="loading">Loading…</string>
- <string name="vpn_allow_mode_is_allow">Allow only these applications to use the VPN. Other apps will use the normal connection.</string>
- <string name="vpn_allow_mode_is_disallow">Do not allow these applications to use the VPN. Other apps will use the VPN connection.</string>
<string name="allowed_vpn_apps_info">Allowed VPN apps: %1$s</string>
<string name="disallowed_vpn_apps_info">Disallowed VPN apps: %1$s</string>
<string name="app_no_longer_exists">Package %s is no longer installed, removing it from app allow/disallow list</string>
@@ -339,5 +337,8 @@
<string name="query_delete_remote">Remove remote server entry?</string>
<string name="keep">Keep</string>
<string name="delete">Delete</string>
+ <string name="add_remote">Add new remote</string>
+ <string name="remote_random">Use connection entries in random order on connect</string>
+ <string name="remote_no_server_selected">You need to define and enable at least one remote server.</string>
</resources>
diff --git a/main/src/main/res/values/styles.xml b/main/src/main/res/values/styles.xml
index 0c295df2..cb503aed 100644
--- a/main/src/main/res/values/styles.xml
+++ b/main/src/main/res/values/styles.xml
@@ -6,10 +6,15 @@
<resources>
<style name="appstyle" parent="android:Theme.DeviceDefault.Light">
-
+ <item name="android:preferenceStyle">@style/BlinktPreferencePanel</item>
</style>
+ <!-- No margins or background by default. Not different for x-large screens -->
+ <style name="BlinktPreferencePanel">
+ <item name="android:background">@color/gelb</item>
+ </style>
+
<style name="item">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>