summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/blinkt/openvpn/LaunchVPN.java')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/LaunchVPN.java72
1 files changed, 3 insertions, 69 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java b/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java
index cfd0efb0..6b4addb3 100644
--- a/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java
+++ b/app/src/main/java/de/blinkt/openvpn/LaunchVPN.java
@@ -2,6 +2,8 @@ package de.blinkt.openvpn;
import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.R;
+
import java.io.IOException;
import android.app.Activity;
@@ -108,75 +110,7 @@ public class LaunchVPN extends Activity {
}
}
-
- private void askForPW(final int type) {
-
- final EditText entry = new EditText(this);
- final View userpwlayout = getLayoutInflater().inflate(R.layout.userpass, null);
-
- entry.setSingleLine();
- entry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
- entry.setTransformationMethod(new PasswordTransformationMethod());
-
- AlertDialog.Builder dialog = new AlertDialog.Builder(this);
- dialog.setTitle("Need " + getString(type));
- dialog.setMessage("Enter the password for profile " + mSelectedProfile.mName);
-
- if (type == R.string.password) {
- ((EditText)userpwlayout.findViewById(R.id.username)).setText(mSelectedProfile.mUsername);
- ((EditText)userpwlayout.findViewById(R.id.password)).setText(mSelectedProfile.mPassword);
- ((CheckBox)userpwlayout.findViewById(R.id.save_password)).setChecked(!TextUtils.isEmpty(mSelectedProfile.mPassword));
- ((CheckBox)userpwlayout.findViewById(R.id.show_password)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if (isChecked)
- ((EditText)userpwlayout.findViewById(R.id.password)).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
- else
- ((EditText)userpwlayout.findViewById(R.id.password)).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
- }
- });
-
- dialog.setView(userpwlayout);
- } else {
- dialog.setView(entry);
- }
-
- AlertDialog.Builder builder = dialog.setPositiveButton(android.R.string.ok,
- new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
-
- if (type == R.string.password) {
- mSelectedProfile.mUsername = ((EditText) userpwlayout.findViewById(R.id.username)).getText().toString();
-
- String pw = ((EditText) userpwlayout.findViewById(R.id.password)).getText().toString();
- if (((CheckBox) userpwlayout.findViewById(R.id.save_password)).isChecked()) {
- mSelectedProfile.mPassword=pw;
- } else {
- mSelectedProfile.mPassword=null;
- mSelectedProfile.mTransientPW = pw;
- }
- } else {
- mSelectedProfile.mTransientPCKS12PW = entry.getText().toString();
- }
- onActivityResult(START_VPN_PROFILE, Activity.RESULT_OK, null);
-
- }
-
- });
- dialog.setNegativeButton(android.R.string.cancel,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- VpnStatus.updateStateString("USER_VPN_PASSWORD_CANCELLED", "", R.string.state_user_vpn_password_cancelled,
- ConnectionStatus.LEVEL_NOTCONNECTED);
- finish();
- }
- });
-
- dialog.create().show();
-
- }
+
@Override
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);