diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-14 23:06:36 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-14 23:06:36 +0200 |
commit | 39e94d54313cf140929339a9f2613d79cbf734b0 (patch) | |
tree | b925a150868fb635ab928a2e5e618f5e0bd46f85 /src/de/blinkt/openvpn/Settings_Basic.java | |
parent | 297eca20821d5c3616543e38e7652eb956b61394 (diff) |
- Rework saving state of preferences fragment
- fix state of nobind not loaded (hopefully closes issue #19)
Version 0.5.4
Diffstat (limited to 'src/de/blinkt/openvpn/Settings_Basic.java')
-rw-r--r-- | src/de/blinkt/openvpn/Settings_Basic.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/de/blinkt/openvpn/Settings_Basic.java b/src/de/blinkt/openvpn/Settings_Basic.java index 3234d0df..3eb484cb 100644 --- a/src/de/blinkt/openvpn/Settings_Basic.java +++ b/src/de/blinkt/openvpn/Settings_Basic.java @@ -93,9 +93,9 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); String profileuuid =getArguments().getString(getActivity().getPackageName() + ".profileUUID"); mProfile=ProfileManager.get(profileuuid); - super.onCreate(savedInstanceState); } @Override @@ -129,8 +129,7 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On addFileSelectLayout(mpkcs12); mpkcs12.setNoline(); - loadPreferences(); - + mType.setOnItemSelectedListener(this); mView.findViewById(R.id.select_keystore_button).setOnClickListener(this); @@ -143,6 +142,15 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On return mView; } + + @Override + public void onStart() { + super.onStart(); + String profileuuid =getArguments().getString(getActivity().getPackageName() + ".profileUUID"); + mProfile=ProfileManager.get(profileuuid); + loadPreferences(); + + } @Override public void onActivityResult(int request, int result, Intent data) { @@ -158,7 +166,6 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - ((VPNPreferences) getActivity()).setmBS(this); } @Override @@ -167,6 +174,11 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On changeType(position); } } + @Override + public void onPause() { + super.onPause(); + savePreferences(); + } @@ -298,7 +310,9 @@ public class Settings_Basic extends Fragment implements View.OnClickListener, On public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); savePreferences(); - outState.putString(getActivity().getPackageName() + "profileUUID", mProfile.getUUID().toString()); + if(mProfile!=null) { + outState.putString(getActivity().getPackageName() + "profileUUID", mProfile.getUUID().toString()); + } } @Override |