From 718b2233054c6bd7b88e5ddb9303696ee7e5646e Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 28 Oct 2019 14:47:11 +0100 Subject: Fix issue with setting static keys --- .../de/blinkt/openvpn/fragments/Settings_Basic.java | 4 ++++ .../java/de/blinkt/openvpn/fragments/Settings_IP.java | 19 +++++++++++++------ .../de/blinkt/openvpn/fragments/Settings_Routing.java | 1 - 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'main/src/ui/java') diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java index 81da76fe..294b33fb 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Basic.java @@ -128,6 +128,9 @@ public class Settings_Basic extends KeyChainSettingsFragment implements OnItemSe mView.findViewById(R.id.userpassword).setVisibility(View.GONE); mView.findViewById(R.id.key_password_layout).setVisibility(View.GONE); mView.findViewById(R.id.external_auth).setVisibility(View.GONE); + mView.findViewById(R.id.crlfile).setVisibility(View.VISIBLE); + + // Fall through are by design switch (type) { @@ -150,6 +153,7 @@ public class Settings_Basic extends KeyChainSettingsFragment implements OnItemSe case VpnProfile.TYPE_STATICKEYS: mView.findViewById(R.id.statickeys).setVisibility(View.VISIBLE); + mView.findViewById(R.id.crlfile).setVisibility(View.GONE); break; case VpnProfile.TYPE_USERPASS_KEYSTORE: diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java index daf407b8..bd2ad5f2 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.java @@ -25,8 +25,9 @@ public class Settings_IP extends OpenVpnPreferencesFragment implements OnPrefere private CheckBoxPreference mNobind; @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + public void onResume() + { + super.onResume(); // Make sure default values are applied. In a real app, you would @@ -60,7 +61,10 @@ public class Settings_IP extends OpenVpnPreferencesFragment implements OnPrefere @Override protected void loadSettings() { - mUsePull.setChecked(mProfile.mUsePull); + if (mProfile.mAuthenticationType == VpnProfile.TYPE_STATICKEYS) + mUsePull.setEnabled(false); + else + mUsePull.setChecked(mProfile.mUsePull); mIPv4.setText(mProfile.mIPv4Address); mIPv6.setText(mProfile.mIPv6Address); mDNS1.setText(mProfile.mDNS1); @@ -68,10 +72,13 @@ public class Settings_IP extends OpenVpnPreferencesFragment implements OnPrefere mOverrideDNS.setChecked(mProfile.mOverrideDNS); mSearchdomain.setText(mProfile.mSearchDomain); mNobind.setChecked(mProfile.mNobind); - if (mProfile.mAuthenticationType == VpnProfile.TYPE_STATICKEYS) - mUsePull.setChecked(false); - mUsePull.setEnabled(mProfile.mAuthenticationType != VpnProfile.TYPE_STATICKEYS); + + //mUsePull.setEnabled(mProfile.mAuthenticationType != VpnProfile.TYPE_STATICKEYS); + mUsePull.setEnabled(true); + + if (mProfile.mAuthenticationType == VpnProfile.TYPE_STATICKEYS) + mUsePull.setChecked(false); // Sets Summary onPreferenceChange(mIPv4, mIPv4.getText()); diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java index 53f88bbf..91a41ef3 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_Routing.java @@ -77,7 +77,6 @@ public class Settings_Routing extends OpenVpnPreferencesFragment implements OnPr onPreferenceChange(mExcludedRoutes, mExcludedRoutes.getText()); onPreferenceChange(mExcludedRoutesv6, mExcludedRoutesv6.getText()); - mRouteNoPull.setEnabled(mProfile.mUsePull); } -- cgit v1.2.3