diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-04-23 00:07:02 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-04-23 00:07:02 +0200 |
commit | 58e2574f6a27930679f976278ad9c3dbc8d4ef2a (patch) | |
tree | ed66e30a6d1acf1fcb68672cb636507e0bd89d2a /src/de/blinkt/openvpn/VPNPreferences.java | |
parent | 488a41cc60636298581c2b44b4706b259fc98a36 (diff) |
Doing progress on the Preference dialog chaos
Diffstat (limited to 'src/de/blinkt/openvpn/VPNPreferences.java')
-rw-r--r-- | src/de/blinkt/openvpn/VPNPreferences.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/de/blinkt/openvpn/VPNPreferences.java b/src/de/blinkt/openvpn/VPNPreferences.java index 69485ef..6c68e44 100644 --- a/src/de/blinkt/openvpn/VPNPreferences.java +++ b/src/de/blinkt/openvpn/VPNPreferences.java @@ -2,7 +2,9 @@ package de.blinkt.openvpn; import java.util.List; +import android.content.Intent; import android.os.Bundle; +import android.os.Parcelable; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.Preference; @@ -16,6 +18,7 @@ import android.widget.Button; public class VPNPreferences extends PreferenceActivity { + private VpnProfile mProfile; public VPNPreferences() { super(); } @@ -23,6 +26,8 @@ public class VPNPreferences extends PreferenceActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + mProfile = getIntent().getParcelableExtra("VpnProfile"); + if (hasHeaders()) { Button button = new Button(this); button.setText("Some action"); @@ -47,12 +52,13 @@ public class VPNPreferences extends PreferenceActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // Make sure default values are applied. In a real app, you would // want this in a shared function that is used to retrieve the // SharedPreferences wherever they are needed. PreferenceManager.setDefaultValues(getActivity(), R.xml.vpn_ipsettings, false); - + // Load the preferences from an XML resource addPreferencesFromResource(R.xml.vpn_ipsettings); mIPv4 = (EditTextPreference) findPreference("ipv4_address"); @@ -69,8 +75,14 @@ public class VPNPreferences extends PreferenceActivity { mDNS2.setOnPreferenceChangeListener(this); mUsePull.setOnPreferenceChangeListener(this); mOverrideDNS.setOnPreferenceChangeListener(this); + + + VpnProfile vp = ((VPNPreferences) getActivity()).getVPNProfile(); + + setDNSState(); + } @Override @@ -134,5 +146,8 @@ public class VPNPreferences extends PreferenceActivity { addPreferencesFromResource(R.xml.vpn_obscure); } } + public VpnProfile getVPNProfile() { + return mProfile; + } } |