diff options
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java | 15 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/Settings_Behaviour.java | 82 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/Settings_Connections.java | 6 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java | 68 | ||||
-rw-r--r-- | main/src/main/res/layout-v21/tabs.xml | 4 | ||||
-rw-r--r-- | main/src/main/res/layout/allowed_vpn_apps.xml | 19 | ||||
-rw-r--r-- | main/src/main/res/layout/connections.xml | 39 | ||||
-rw-r--r-- | main/src/main/res/values/colours.xml | 3 | ||||
-rwxr-xr-x | main/src/main/res/values/strings.xml | 3 | ||||
-rw-r--r-- | main/src/main/res/xml/vpn_authentification.xml | 37 | ||||
-rw-r--r-- | main/src/main/res/xml/vpn_behaviour.xml | 29 | ||||
-rw-r--r-- | main/src/main/res/xml/vpn_obscure.xml | 28 |
12 files changed, 164 insertions, 169 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java b/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java index 4eee5eea..2ef0dcce 100644 --- a/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java +++ b/main/src/main/java/de/blinkt/openvpn/activities/VPNPreferences.java @@ -21,15 +21,9 @@ import android.view.MenuItem; import de.blinkt.openvpn.R; import de.blinkt.openvpn.VpnProfile; import de.blinkt.openvpn.core.ProfileManager; -import de.blinkt.openvpn.fragments.AboutFragment; -import de.blinkt.openvpn.fragments.FaqFragment; -import de.blinkt.openvpn.fragments.GeneralSettings; -import de.blinkt.openvpn.fragments.LogFragment; -import de.blinkt.openvpn.fragments.SendDumpFragment; import de.blinkt.openvpn.fragments.Settings_Allowed_Apps; import de.blinkt.openvpn.fragments.Settings_Authentication; import de.blinkt.openvpn.fragments.Settings_Basic; -import de.blinkt.openvpn.fragments.Settings_Behaviour; import de.blinkt.openvpn.fragments.Settings_Connections; import de.blinkt.openvpn.fragments.Settings_IP; import de.blinkt.openvpn.fragments.Settings_Obscure; @@ -45,7 +39,7 @@ public class VPNPreferences extends Activity { static final Class validFragments[] = new Class[] { Settings_Authentication.class, Settings_Basic.class, Settings_IP.class, Settings_Obscure.class, Settings_Routing.class, ShowConfigFragment.class, - Settings_Behaviour.class, Settings_Connections.class, Settings_Allowed_Apps.class + Settings_Connections.class, Settings_Allowed_Apps.class }; private String mProfileUUID; @@ -140,19 +134,16 @@ public class VPNPreferences extends Activity { fragmentArguments.putString(getPackageName() + ".profileUUID",mProfileUUID); mPagerAdapter.setFragmentArgs(fragmentArguments); - mPagerAdapter.addTab(R.string.client_behaviour, Settings_Behaviour.class); - - mPagerAdapter.addTab(R.string.server_list, Settings_Connections.class); - mPagerAdapter.addTab(R.string.basic, Settings_Basic.class); + mPagerAdapter.addTab(R.string.server_list, Settings_Connections.class); mPagerAdapter.addTab(R.string.ipdns, Settings_IP.class); mPagerAdapter.addTab(R.string.routing, Settings_Routing.class); mPagerAdapter.addTab(R.string.settings_auth, Settings_Authentication.class); + mPagerAdapter.addTab(R.string.advanced, Settings_Obscure.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) mPagerAdapter.addTab(R.string.vpn_allowed_apps, Settings_Allowed_Apps.class); - mPagerAdapter.addTab(R.string.advanced, Settings_Obscure.class); mPagerAdapter.addTab(R.string.generated_config, ShowConfigFragment.class); diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Behaviour.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Behaviour.java deleted file mode 100644 index 8563fc8f..00000000 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Behaviour.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2012-2014 Arne Schwabe - * Distributed under the GNU GPL v2. For full terms see the file doc/LICENSE.txt - */ - -package de.blinkt.openvpn.fragments; - -import android.os.Bundle; -import android.preference.CheckBoxPreference; -import android.preference.EditTextPreference; -import android.preference.ListPreference; -import android.preference.Preference; -import android.preference.Preference.OnPreferenceChangeListener; - -import de.blinkt.openvpn.R; - -public class Settings_Behaviour extends OpenVpnPreferencesFragment implements OnPreferenceChangeListener { - private CheckBoxPreference mPersistent; - private ListPreference mConnectretrymax; - private EditTextPreference mConnectretry; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // Load the preferences from an XML resource - addPreferencesFromResource(R.xml.vpn_behaviour); - - mPersistent = (CheckBoxPreference) findPreference("usePersistTun"); - mConnectretrymax = (ListPreference) findPreference("connectretrymax"); - mConnectretry = (EditTextPreference) findPreference("connectretry"); - - mConnectretrymax.setOnPreferenceChangeListener(this); - mConnectretrymax.setSummary("%s"); - - mConnectretry.setOnPreferenceChangeListener(this); - - - loadSettings(); - - } - - protected void loadSettings() { - mPersistent.setChecked(mProfile.mPersistTun); - - mConnectretrymax.setValue(mProfile.mConnectRetryMax); - onPreferenceChange(mConnectretrymax, mProfile.mConnectRetryMax); - - mConnectretry.setText(mProfile.mConnectRetry); - onPreferenceChange(mConnectretry, mProfile.mConnectRetry); - } - - - protected void saveSettings() { - mProfile.mConnectRetryMax = mConnectretrymax.getValue(); - mProfile.mPersistTun = mPersistent.isChecked(); - mProfile.mConnectRetry = mConnectretry.getText(); - } - - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mConnectretrymax) { - if(newValue==null) { - newValue="5"; - } - mConnectretrymax.setDefaultValue(newValue); - - for(int i=0;i<mConnectretrymax.getEntryValues().length;i++){ - if(mConnectretrymax.getEntryValues().equals(newValue)) - mConnectretrymax.setSummary(mConnectretrymax.getEntries()[i]); - } - - } else if (preference == mConnectretry) { - if(newValue==null || newValue=="") - newValue="5"; - mConnectretry.setSummary(String.format("%s s" , newValue)); - } - - return true; - } - -}
\ No newline at end of file diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Connections.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Connections.java index 67b49e87..eb77173c 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Connections.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Connections.java @@ -20,8 +20,10 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.CheckBox; +import android.widget.Checkable; import android.widget.GridView; import android.widget.ImageButton; +import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; @@ -35,7 +37,7 @@ public class Settings_Connections extends Fragment implements View.OnClickListen private VpnProfile mProfile; private ConnectionsAdapter mConnectionsAdapter; private TextView mWarning; - private CheckBox mUseRandomRemote; + private Checkable mUseRandomRemote; private RecyclerView mRecyclerView; @Override @@ -79,7 +81,7 @@ public class Settings_Connections extends Fragment implements View.OnClickListen if(fab_button!=null) fab_button.setOnClickListener(this); - mUseRandomRemote = (CheckBox) v.findViewById(R.id.remote_random); + mUseRandomRemote = (Checkable) v.findViewById(R.id.remote_random); mUseRandomRemote.setChecked(mProfile.mRemoteRandom); diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java index 8c3db416..98c39306 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java @@ -8,6 +8,7 @@ package de.blinkt.openvpn.fragments; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; +import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.widget.Toast; @@ -23,6 +24,66 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr private EditTextPreference mMssFixValue; private CheckBoxPreference mMssFixCheckBox; + private CheckBoxPreference mPersistent; + private ListPreference mConnectRetrymax; + private EditTextPreference mConnectRetry; + + public void onCreateBehaviour(Bundle savedInstanceState) { + + mPersistent = (CheckBoxPreference) findPreference("usePersistTun"); + mConnectRetrymax = (ListPreference) findPreference("connectretrymax"); + mConnectRetry = (EditTextPreference) findPreference("connectretry"); + + mConnectRetrymax.setOnPreferenceChangeListener(this); + mConnectRetrymax.setSummary("%s"); + + mConnectRetry.setOnPreferenceChangeListener(this); + + + + } + + protected void loadSettingsBehaviour() { + mPersistent.setChecked(mProfile.mPersistTun); + + mConnectRetrymax.setValue(mProfile.mConnectRetryMax); + onPreferenceChange(mConnectRetrymax, mProfile.mConnectRetryMax); + + mConnectRetry.setText(mProfile.mConnectRetry); + onPreferenceChange(mConnectRetry, mProfile.mConnectRetry); + } + + + protected void saveSettingsBehaviour() { + mProfile.mConnectRetryMax = mConnectRetrymax.getValue(); + mProfile.mPersistTun = mPersistent.isChecked(); + mProfile.mConnectRetry = mConnectRetry.getText(); + } + + + public boolean onPreferenceChangeBehaviour(Preference preference, Object newValue) { + if (preference == mConnectRetrymax) { + if(newValue==null) { + newValue="5"; + } + mConnectRetrymax.setDefaultValue(newValue); + + for(int i=0;i< mConnectRetrymax.getEntryValues().length;i++){ + if(mConnectRetrymax.getEntryValues().equals(newValue)) + mConnectRetrymax.setSummary(mConnectRetrymax.getEntries()[i]); + } + + } else if (preference == mConnectRetry) { + if(newValue==null || newValue=="") + newValue="5"; + mConnectRetry.setSummary(String.format("%s s", newValue)); + } + + return true; + } + + + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -36,7 +97,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr mMssFixCheckBox = (CheckBoxPreference) findPreference("mssFix"); mMssFixValue = (EditTextPreference) findPreference("mssFixValue"); mMssFixValue.setOnPreferenceChangeListener(this); - + onCreateBehaviour(savedInstanceState); loadSettings(); } @@ -56,6 +117,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr mMssFixCheckBox.setChecked(true); setMssSummary(mProfile.mMssFix); } + loadSettingsBehaviour(); } @@ -73,6 +135,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr else mProfile.mMssFix=0; + saveSettingsBehaviour(); } @@ -89,7 +152,8 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr Toast.makeText(getActivity(), R.string.mssfix_invalid_value, Toast.LENGTH_LONG).show(); return false; } - return true; + return onPreferenceChangeBehaviour(preference, newValue); + } }
\ No newline at end of file diff --git a/main/src/main/res/layout-v21/tabs.xml b/main/src/main/res/layout-v21/tabs.xml index be6ce9f1..66f55938 100644 --- a/main/src/main/res/layout-v21/tabs.xml +++ b/main/src/main/res/layout-v21/tabs.xml @@ -10,6 +10,6 @@ android:layout_height="?android:attr/actionBarSize" android:background="@drawable/bg_tabs" blinkt:pstsIndicatorColor="@color/accent" - blinkt:pstsIndicatorHeight="6dp" - android:elevation="4dp" /> + blinkt:pstsIndicatorHeight="3dp" + android:elevation="8dp" /> </merge>
\ 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 66665cb6..53c48fd8 100644 --- a/main/src/main/res/layout/allowed_vpn_apps.xml +++ b/main/src/main/res/layout/allowed_vpn_apps.xml @@ -7,29 +7,34 @@ xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" + tools:ignore="RtlCompat" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/actionBarSize" - android:background="@color/switchbar" + android:background="@drawable/bg_switchbar" android:paddingStart="@dimen/switchbar_pad" + android:elevation="1dp" android:paddingEnd="@dimen/switchbar_pad" tools:ignore="NewApi"> + + <Switch + android:id="@+id/default_allow" + android:layout_alignParentEnd="true" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + /> <TextView android:id="@+id/default_allow_text" style="@android:style/TextAppearance.Medium.Inverse" tools:text="@string/vpn_disallow_radio" + android:layout_toStartOf="@id/default_allow" 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 diff --git a/main/src/main/res/layout/connections.xml b/main/src/main/res/layout/connections.xml index 44980e44..ed812f6d 100644 --- a/main/src/main/res/layout/connections.xml +++ b/main/src/main/res/layout/connections.xml @@ -11,20 +11,41 @@ android:orientation="vertical"> + <RelativeLayout + android:id="@+id/switchBar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?android:attr/actionBarSize" + android:background="@drawable/bg_switchbar" + android:elevation="1dp" + android:paddingStart="@dimen/switchbar_pad" + android:paddingEnd="@dimen/switchbar_pad" + > + <Switch + android:id="@+id/remote_random" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + <TextView + android:id="@+id/default_allow_text" + style="@android:style/TextAppearance.Medium.Inverse" + android:text="@string/remote_random" + android:layout_toStartOf="@id/remote_random" + android:layout_toLeftOf="@id/remote_random" + android:layout_width="wrap_content" + android:layout_centerVertical="true" + android:layout_height="wrap_content" /> + + </RelativeLayout> - <CheckBox - android:layout_margin="@dimen/vpn_setting_padding" - android:text="@string/remote_random" - android:id="@+id/remote_random" - android:padding="@dimen/stdpadding" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> <android.support.v7.widget.RecyclerView android:layout_margin="@dimen/vpn_setting_padding" android:id="@+id/connection_recycler_view" - android:layout_below="@id/remote_random" + android:layout_below="@id/switchBar" android:layout_width="match_parent" android:layout_height="match_parent" android:verticalSpacing="@dimen/stdpadding" @@ -45,7 +66,7 @@ android:padding="@dimen/stdpadding" android:text="@string/remote_no_server_selected" android:visibility="visible" - tools:visibility="visible" /> + tools:visibility="gone" /> <include layout="@layout/connection_fab" /> diff --git a/main/src/main/res/values/colours.xml b/main/src/main/res/values/colours.xml index 3d8ce000..f27167f3 100644 --- a/main/src/main/res/values/colours.xml +++ b/main/src/main/res/values/colours.xml @@ -10,10 +10,11 @@ <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> + <color name="switchbar">@android:color/darker_gray</color> + <color name="background_tab_pressed">#1AFFFFFF</color> diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index 9c7ade61..aeb03712 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -342,5 +342,8 @@ <string name="remote_no_server_selected">You need to define and enable at least one remote server.</string> <string name="server_list">Server List</string> <string name="vpn_allowed_apps">Allowed Apps</string> + <string name="advanced_settings">Advanced Settings</string> + <string name="payload_options">Payload options</string> + <string name="tls_settings">TLS Settings</string> </resources> diff --git a/main/src/main/res/xml/vpn_authentification.xml b/main/src/main/res/xml/vpn_authentification.xml index cea54b8f..d2f6ad25 100644 --- a/main/src/main/res/xml/vpn_authentification.xml +++ b/main/src/main/res/xml/vpn_authentification.xml @@ -1,26 +1,25 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?><!-- ~ Copyright (c) 2012-2014 Arne Schwabe ~ Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt --> -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <PreferenceCategory android:title="@string/tls_settings"> + <CheckBoxPreference + android:key="remoteServerTLS" + android:summary="@string/check_remote_tlscert" + android:title="@string/check_remote_tlscert_title" /> + <CheckBoxPreference + android:key="checkRemoteCN" + android:summary="@string/remote_tlscn_check_summary" + android:title="@string/remote_tlscn_check_title" /> - <CheckBoxPreference - android:key="remoteServerTLS" - android:summary="@string/check_remote_tlscert" - android:title="@string/check_remote_tlscert_title" /> - <CheckBoxPreference - android:key="checkRemoteCN" - android:summary="@string/remote_tlscn_check_summary" - android:title="@string/remote_tlscn_check_title" /> - - <de.blinkt.openvpn.views.RemoteCNPreference - android:dependency="checkRemoteCN" - android:key="remotecn" - android:title="@string/enter_tlscn_title" /> - - <PreferenceCategory android:title="@string/tls_authentication" > + <de.blinkt.openvpn.views.RemoteCNPreference + android:dependency="checkRemoteCN" + android:key="remotecn" + android:title="@string/enter_tlscn_title" /> + </PreferenceCategory> + <PreferenceCategory android:title="@string/tls_authentication"> <SwitchPreference android:key="useTLSAuth" android:summary="@string/tls_key_auth" @@ -39,7 +38,7 @@ android:persistent="false" android:title="@string/tls_direction" /> </PreferenceCategory> - <PreferenceCategory android:title="@string/encryption" > + <PreferenceCategory android:title="@string/encryption"> <EditTextPreference android:dialogMessage="@string/chipher_dialog_message" android:dialogTitle="@string/cipher_dialog_title" diff --git a/main/src/main/res/xml/vpn_behaviour.xml b/main/src/main/res/xml/vpn_behaviour.xml deleted file mode 100644 index de27b676..00000000 --- a/main/src/main/res/xml/vpn_behaviour.xml +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - ~ Copyright (c) 2012-2014 Arne Schwabe - ~ Distributed under the GNU GPL v2. For full terms see the file doc/LICENSE.txt - --> - -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:title="@string/client_behaviour"> - - <CheckBoxPreference - android:key="usePersistTun" - android:summary="@string/persisttun_summary" - android:title="@string/persistent_tun_title" /> - - - <PreferenceCategory android:title="@string/reconnection_settings"> - <ListPreference - android:entries="@array/crm_entries" - android:entryValues="@array/crm_values" - android:key="connectretrymax" - android:persistent="false" - android:title="@string/connection_retries" /> - - <EditTextPreference - android:dialogMessage="@string/connectretrymessage" - android:key="connectretry" - android:persistent="false" - android:title="@string/connectretrywait" /> - </PreferenceCategory> -</PreferenceScreen>
\ No newline at end of file diff --git a/main/src/main/res/xml/vpn_obscure.xml b/main/src/main/res/xml/vpn_obscure.xml index 2d5269c5..288752aa 100644 --- a/main/src/main/res/xml/vpn_obscure.xml +++ b/main/src/main/res/xml/vpn_obscure.xml @@ -1,12 +1,32 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?><!-- ~ Copyright (c) 2012-2014 Arne Schwabe ~ Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:title="Obscure Settings"> + android:title="@string/advanced_settings"> + <PreferenceCategory android:title="@string/client_behaviour"> + <CheckBoxPreference + android:key="usePersistTun" + android:summary="@string/persisttun_summary" + android:title="@string/persistent_tun_title" /> + + </PreferenceCategory> + <PreferenceCategory android:title="@string/reconnection_settings"> + <ListPreference + android:entries="@array/crm_entries" + android:entryValues="@array/crm_values" + android:key="connectretrymax" + android:persistent="false" + android:title="@string/connection_retries" /> + + <EditTextPreference + android:dialogMessage="@string/connectretrymessage" + android:key="connectretry" + android:persistent="false" + android:title="@string/connectretrywait" /> + </PreferenceCategory> <CheckBoxPreference android:key="useRandomHostname" @@ -19,7 +39,7 @@ android:summary="@string/float_summary" android:title="@string/float_title" /> - <PreferenceCategory android:title="Payload options"> + <PreferenceCategory android:title="@string/payload_options"> <CheckBoxPreference android:key="mssFix" android:persistent="false" |