summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2013-02-25 02:00:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-25 02:00:10 +0000
commit1022e801bac5bbb17c6aeccf1384a5a21fdeb836 (patch)
treefd507bba35b25aa93271806fd57246d39339ce68
parent8fe4a3f76b42bad972f2da77be8fcd3d3996d507 (diff)
parent265dfd22e3681edfff14f068c1a113a28b4cd45c (diff)
downloadpackages_apps_Settings-1022e801bac5bbb17c6aeccf1384a5a21fdeb836.zip
packages_apps_Settings-1022e801bac5bbb17c6aeccf1384a5a21fdeb836.tar.gz
packages_apps_Settings-1022e801bac5bbb17c6aeccf1384a5a21fdeb836.tar.bz2
Merge "Apply the show_password checkbox on the text field on orientation changes"
-rw-r--r--src/com/android/settings/wifi/WifiConfigController.java35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 60ab1ca..497bce9 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -49,9 +49,11 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import com.android.settings.ProxySelector;
import com.android.settings.R;
@@ -76,6 +78,7 @@ public class WifiConfigController implements TextWatcher,
// e.g. AccessPoint.SECURITY_NONE
private int mAccessPointSecurity;
private TextView mPasswordView;
+ private CheckBox mShowPassword;
private String unspecifiedCert = "unspecified";
private static final int unspecifiedCertIndex = 0;
@@ -555,8 +558,13 @@ public class WifiConfigController implements TextWatcher,
if (mPasswordView == null) {
mPasswordView = (TextView) mView.findViewById(R.id.password);
mPasswordView.addTextChangedListener(this);
- ((CheckBox) mView.findViewById(R.id.show_password)).setOnClickListener(this);
-
+ mShowPassword = (CheckBox) mView.findViewById(R.id.show_password);
+ mShowPassword.setOnClickListener(this);
+ mShowPassword.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ updatePasswordVisibility(isChecked);
+ }
+ });
if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) {
mPasswordView.setHint(R.string.wifi_unchanged);
}
@@ -866,14 +874,7 @@ public class WifiConfigController implements TextWatcher,
@Override
public void onClick(View view) {
if (view.getId() == R.id.show_password) {
- int pos = mPasswordView.getSelectionEnd();
- mPasswordView.setInputType(
- InputType.TYPE_CLASS_TEXT | (((CheckBox) view).isChecked() ?
- InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
- InputType.TYPE_TEXT_VARIATION_PASSWORD));
- if (pos >= 0) {
- ((EditText)mPasswordView).setSelection(pos);
- }
+ updatePasswordVisibility(((CheckBox) view).isChecked());
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
if (((CheckBox) view).isChecked()) {
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
@@ -902,4 +903,18 @@ public class WifiConfigController implements TextWatcher,
public void onNothingSelected(AdapterView<?> parent) {
//
}
+
+ /**
+ * Make the characters of the password visible if show_password is checked.
+ */
+ private void updatePasswordVisibility(boolean checked) {
+ int pos = mPasswordView.getSelectionEnd();
+ mPasswordView.setInputType(
+ InputType.TYPE_CLASS_TEXT | (checked ?
+ InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
+ InputType.TYPE_TEXT_VARIATION_PASSWORD));
+ if (pos >= 0) {
+ ((EditText)mPasswordView).setSelection(pos);
+ }
+ }
}