summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-10-07 16:40:55 +0200
committerArne Schwabe <arne@rfc2549.org>2013-10-07 16:40:55 +0200
commit7997868109c0831f2c6d97f342a7e6c6226bf54d (patch)
tree106e658ecc981ce8ba093a19a6b11c7f9d560fee
parent9ce9913250cb1122f879cb4a59227c02b42075f7 (diff)
Add "show password" to popup password dialog
-rw-r--r--icsopenvpn.iml2
-rw-r--r--res/layout/userpass.xml12
-rwxr-xr-xres/values/strings.xml1
-rw-r--r--src/de/blinkt/openvpn/LaunchVPN.java16
4 files changed, 23 insertions, 8 deletions
diff --git a/icsopenvpn.iml b/icsopenvpn.iml
index cdd93af4..21dfc067 100644
--- a/icsopenvpn.iml
+++ b/icsopenvpn.iml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
diff --git a/res/layout/userpass.xml b/res/layout/userpass.xml
index d13953c6..f67f998e 100644
--- a/res/layout/userpass.xml
+++ b/res/layout/userpass.xml
@@ -10,7 +10,7 @@
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
+ android:layout_marginTop="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
@@ -25,6 +25,15 @@
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:hint="@string/password"/>
+ <CheckBox
+ android:id="@+id/show_password"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="4dp"
+ android:layout_marginLeft="4dp"
+ android:text="@string/show_password"
+ android:layout_marginRight="4dp"
+ />
<CheckBox
android:id="@+id/save_password"
@@ -36,4 +45,5 @@
android:layout_marginRight="4dp"
android:layout_marginBottom="16dp"/>
+
</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 643da3a2..a7f0b07a 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -297,4 +297,5 @@
<string name="donatePlayStore">Alternatively you can send me a donation with the Play Store:</string>
<string name="thanks_for_donation">Thanks for donating %s!</string>
<string name="logCleared">Log cleared.</string>
+ <string name="show_password">Show password</string>
</resources>
diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java
index 336de255..75c88300 100644
--- a/src/de/blinkt/openvpn/LaunchVPN.java
+++ b/src/de/blinkt/openvpn/LaunchVPN.java
@@ -20,13 +20,8 @@ import android.text.InputType;
import android.text.TextUtils;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
-import android.widget.AdapterView;
+import android.widget.*;
import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.TextView;
import de.blinkt.openvpn.core.VpnStatus;
import de.blinkt.openvpn.core.VpnStatus.ConnectionStatus;
import de.blinkt.openvpn.core.ProfileManager;
@@ -219,6 +214,15 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
((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 {