diff options
author | Arne Schwabe <arne@rfc2549.org> | 2023-07-11 16:59:30 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2023-07-13 16:11:23 +0200 |
commit | 40eb1a83cdcde7c0178428ecb0ad880a363a97a3 (patch) | |
tree | e203766ff955d264e795c06f6d1f9478f13c70b5 /main/src/ui/java | |
parent | 959cb04640e90c35fe424d30f45867ac6626981b (diff) |
Fix some ANRs
Diffstat (limited to 'main/src/ui/java')
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java | 1 | ||||
-rw-r--r-- | main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.kt | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java b/main/src/ui/java/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java index a3c19955..802e0b49 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/OpenVpnPreferencesFragment.java @@ -46,7 +46,6 @@ public abstract class OpenVpnPreferencesFragment extends PreferenceFragmentCompa String profileUUID = savedInstanceState.getString(VpnProfile.EXTRA_PROFILEUUID); mProfile = ProfileManager.get(getActivity(), profileUUID); loadSettings(); - } } diff --git a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.kt b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.kt index 27e6854f..fa7e6f55 100644 --- a/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.kt +++ b/main/src/ui/java/de/blinkt/openvpn/fragments/Settings_IP.kt @@ -5,6 +5,7 @@ package de.blinkt.openvpn.fragments import android.os.Bundle +import android.view.View import androidx.preference.* import de.blinkt.openvpn.R import de.blinkt.openvpn.fragments.OpenVpnPreferencesFragment @@ -33,6 +34,19 @@ class Settings_IP : OpenVpnPreferencesFragment(), Preference.OnPreferenceChangeL // Load the preferences from an XML resource addPreferencesFromResource(R.xml.vpn_ipsettings) + bindPreferences() + loadSettings() + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + /* Bind the preferences early to avoid loadingSetting which is called + * from the superclass to access an uninitialised earlyinit property + */ + bindPreferences() + super.onViewCreated(view, savedInstanceState) + } + + private fun bindPreferences() { mIPv4 = findPreference("ipv4_address")!! mIPv6 = findPreference("ipv6_address")!! mUsePull = findPreference("usePull")!! @@ -45,7 +59,6 @@ class Settings_IP : OpenVpnPreferencesFragment(), Preference.OnPreferenceChangeL mNobind = findPreference("nobind")!! mUsePull.onPreferenceChangeListener = this mOverrideDNS.onPreferenceChangeListener = this - loadSettings() } |