summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2011-07-15 11:05:46 -0700
committerChia-chi Yeh <chiachi@android.com>2011-07-15 11:35:54 -0700
commitd501b5c963c0cbcc9c666f502229599464eaf3fd (patch)
tree7db756e6f9669d9997a24fdc356f7d1bde66770a
parent42a7a7112f7d56d587b2dc73a7e3677b1140b839 (diff)
downloadpackages_apps_settings-d501b5c963c0cbcc9c666f502229599464eaf3fd.zip
packages_apps_settings-d501b5c963c0cbcc9c666f502229599464eaf3fd.tar.gz
packages_apps_settings-d501b5c963c0cbcc9c666f502229599464eaf3fd.tar.bz2
VpnSettings: bind OnPreferenceClickListener later.
Bug: 4999108 Change-Id: Idab3029a30943d1118584e6a1b01db96340858ed
-rw-r--r--src/com/android/settings/vpn2/VpnSettings.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 082b95f..4dbb6bd 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -73,9 +73,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
addPreferencesFromResource(R.xml.vpn_settings2);
- PreferenceGroup group = getPreferenceScreen();
- group.setOrderingAsAdded(false);
- group.findPreference("add_network").setOnPreferenceClickListener(this);
+ getPreferenceScreen().setOrderingAsAdded(false);
if (savedState != null) {
VpnProfile profile = VpnProfile.decode(savedState.getString("VpnKey"),
@@ -124,6 +122,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements
// safely cache profiles in the memory.
if (mPreferences == null) {
mPreferences = new HashMap<String, VpnPreference>();
+ PreferenceGroup group = getPreferenceScreen();
String[] keys = mKeyStore.saw(Credentials.VPN);
if (keys != null && keys.length > 0) {
@@ -138,13 +137,11 @@ public class VpnSettings extends SettingsPreferenceFragment implements
} else {
VpnPreference preference = new VpnPreference(context, profile);
mPreferences.put(key, preference);
+ group.addPreference(preference);
}
}
}
- }
- PreferenceGroup group = getPreferenceScreen();
- for (VpnPreference preference : mPreferences.values()) {
- group.addPreference(preference);
+ group.findPreference("add_network").setOnPreferenceClickListener(this);
}
// Show the dialog if there is one.