diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-11-07 17:48:18 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-11-07 17:48:18 +0100 |
commit | e66b35409cff37433af11693673145406029356f (patch) | |
tree | ba30da82879aae8e5ad82c56f6deb65969504ae0 | |
parent | 0c74ea4a9cbb3b854d75745120e7c868d0e1dcec (diff) |
I think the hacks that were needed for earlier Android version should not be needed anymore. Don’t show them in the General settings menu.
-rw-r--r-- | .hgignore | 2 | ||||
-rw-r--r-- | res/xml/general_settings.xml | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/core/OpenVpnService.java | 4 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/GeneralSettings.java | 22 |
4 files changed, 25 insertions, 5 deletions
@@ -71,4 +71,4 @@ proguard-project.txt build.xml cache.properties .gradle -.idea
\ No newline at end of file +.idea diff --git a/res/xml/general_settings.xml b/res/xml/general_settings.xml index ec016aa9..d43ab6a3 100644 --- a/res/xml/general_settings.xml +++ b/res/xml/general_settings.xml @@ -40,7 +40,7 @@ </PreferenceCategory> - <PreferenceCategory android:title="@string/device_specific"> + <PreferenceCategory android:title="@string/device_specific" android:key="device_hacks"> <CheckBoxPreference android:defaultValue="false" android:key="useCM9Fix" diff --git a/src/de/blinkt/openvpn/core/OpenVpnService.java b/src/de/blinkt/openvpn/core/OpenVpnService.java index 92e44e53..e4437d2c 100644 --- a/src/de/blinkt/openvpn/core/OpenVpnService.java +++ b/src/de/blinkt/openvpn/core/OpenVpnService.java @@ -480,7 +480,9 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac } catch (Exception e) { VpnStatus.logError(R.string.tun_open_error); VpnStatus.logError(getString(R.string.error) + e.getLocalizedMessage()); - VpnStatus.logError(R.string.tun_error_helpful); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) { + VpnStatus.logError(R.string.tun_error_helpful); + } return null; } diff --git a/src/de/blinkt/openvpn/fragments/GeneralSettings.java b/src/de/blinkt/openvpn/fragments/GeneralSettings.java index a78c31f6..2e486dfe 100644 --- a/src/de/blinkt/openvpn/fragments/GeneralSettings.java +++ b/src/de/blinkt/openvpn/fragments/GeneralSettings.java @@ -9,9 +9,12 @@ import android.content.DialogInterface.OnClickListener; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Build; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; +import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import de.blinkt.openvpn.R; import de.blinkt.openvpn.api.ExternalAppDatabase; @@ -28,14 +31,29 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC // Load the preferences from an XML resource addPreferencesFromResource(R.xml.general_settings); - Preference loadtun = findPreference("loadTunModule"); - if(!isTunModuleAvailable()) + + PreferenceCategory devHacks = (PreferenceCategory) findPreference("device_hacks"); + + + Preference loadtun = findPreference("loadTunModule"); + if(!isTunModuleAvailable()) { loadtun.setEnabled(false); + devHacks.removePreference(loadtun); + } + + CheckBoxPreference cm9hack = (CheckBoxPreference) findPreference("useCM9Fix"); + if (!cm9hack.isChecked() && (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1)) { + devHacks.removePreference(cm9hack); + } mExtapp = new ExternalAppDatabase(getActivity()); Preference clearapi = findPreference("clearapi"); clearapi.setOnPreferenceClickListener(this); + + if(devHacks.getPreferenceCount()==0) + getPreferenceScreen().removePreference(devHacks); + setClearApiSummary(); } |