summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/BasicSettings.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-04-27 23:24:49 +0200
committerArne Schwabe <arne@rfc2549.org>2012-04-27 23:24:49 +0200
commit6f74ca80d395542ae92e7e9eb97af11aa4c706bd (patch)
tree8506351e5a3e9904c70c881b1d13b2a1d1030383 /src/de/blinkt/openvpn/BasicSettings.java
parenta9bd49391b200d24515f8da54d2e69d589da721a (diff)
it is not getIntent() nor savedState nor other fancy stuff, getArgument() is what I want
Diffstat (limited to 'src/de/blinkt/openvpn/BasicSettings.java')
-rw-r--r--src/de/blinkt/openvpn/BasicSettings.java38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/de/blinkt/openvpn/BasicSettings.java b/src/de/blinkt/openvpn/BasicSettings.java
index 8f4fc770..e80651e5 100644
--- a/src/de/blinkt/openvpn/BasicSettings.java
+++ b/src/de/blinkt/openvpn/BasicSettings.java
@@ -40,18 +40,10 @@ import android.widget.ToggleButton;
import de.blinkt.openvpn.R.id;
public class BasicSettings extends Fragment implements View.OnClickListener, OnItemSelectedListener, Callback, OnCheckedChangeListener {
- private static final String TAG = "OpenVpnClient";
-
-
- private static final int START_OPENVPN = 0;
private static final int CHOOSE_FILE_OFFSET = 1000;
private static final int UPDATE_ALIAS = 20;
- private static final String PREFS_NAME = "OVPN_SERVER";
-
- private static final String OVPNCONFIGFILE = "android.conf";
- private static final String OVPNCONFIGPKCS12 = "android.pkcs12";
-
+
private TextView mServerAddress;
private TextView mServerPort;
@@ -92,6 +84,7 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
private VpnProfile mProfile;
+ private EditText mProfileName;
@@ -100,17 +93,22 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
fileselects.put(i, fsl);
fsl.setActivity(getActivity(),i);
}
-
+
+
public void onCreate(Bundle savedInstanceState) {
+ Bundle foo = getArguments();
+ String profileuuid =getArguments().getString(getActivity().getPackageName() + ".profileUUID");
+ mProfile=ProfileManager.get(profileuuid);
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+
mView = inflater.inflate(R.layout.basic_settings,container,false);
-
-
+
+ mProfileName = (EditText) mView.findViewById(R.id.profilename);
mServerAddress = (TextView) mView.findViewById(R.id.address);
mServerPort = (TextView) mView.findViewById(R.id.port);
mClientCert = (FileSelectLayout) mView.findViewById(R.id.certselect);
@@ -130,6 +128,8 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
mUserName = (EditText) mView.findViewById(R.id.auth_username);
mPassword = (EditText) mView.findViewById(R.id.auth_password);
+
+
addFileSelectLayout(mCaCert);
addFileSelectLayout(mClientCert);
@@ -152,9 +152,15 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
if (mHandler == null) {
mHandler = new Handler(this);
}
+
return mView;
}
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ ((VPNPreferences) getActivity()).setmBS(this);
+ }
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
@@ -194,8 +200,7 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
}
private void loadPreferences() {
- mProfile = ((VPNPreferences)getActivity()).getVPNProfile();
-
+ mProfileName.setText(mProfile.mName);
mClientCert.setData(mProfile.mClientCertFilename);
mClientKey.setData(mProfile.mClientKeyFilename);
mCaCert.setData(mProfile.mCaFilename);
@@ -217,11 +222,11 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
}
- private void savePreferences() {
+ void savePreferences() {
// We need an Editor object to make preference changes.
// All objects are from android.context.Context
-
+ mProfile.mName = mProfileName.getText().toString();
mProfile.mCaFilename = mCaCert.getData();
mProfile.mClientCertFilename = mClientCert.getData();
mProfile.mClientKeyFilename = mClientKey.getData();
@@ -303,5 +308,6 @@ public class BasicSettings extends Fragment implements View.OnClickListener, OnI
} else if (buttonView == mUseTlsAuth) {
mView.findViewById(R.id.tlsauth_options).setVisibility(visibility);
}
+
}
}