Merge "Restore password visibility on screen rotation in Hotspot/Wifi setup." into m-wireless-dev

This commit is contained in:
Sanket Padawe
2015-03-20 20:35:07 +00:00
committed by Android Partner Code Review
3 changed files with 21 additions and 9 deletions

View File

@@ -184,6 +184,15 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
validate(); validate();
} }
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mPassword.setInputType(
InputType.TYPE_CLASS_TEXT |
(((CheckBox) mView.findViewById(R.id.show_password)).isChecked() ?
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
InputType.TYPE_TEXT_VARIATION_PASSWORD));
}
private void validate() { private void validate() {
if ((mSsid != null && mSsid.length() == 0) || if ((mSsid != null && mSsid.length() == 0) ||
((mSecurityTypeIndex == WPA2_INDEX)&& ((mSecurityTypeIndex == WPA2_INDEX)&&

View File

@@ -999,14 +999,12 @@ public class WifiConfigController implements TextWatcher,
/** /**
* Make the characters of the password visible if show_password is checked. * Make the characters of the password visible if show_password is checked.
*/ */
private void updatePasswordVisibility(boolean checked) { public void updatePassword() {
int pos = mPasswordView.getSelectionEnd(); TextView passwdView = (TextView) mView.findViewById(R.id.password);
mPasswordView.setInputType( passwdView.setInputType(
InputType.TYPE_CLASS_TEXT | (checked ? InputType.TYPE_CLASS_TEXT |
(((CheckBox) mView.findViewById(R.id.show_password)).isChecked() ?
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD : InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
InputType.TYPE_TEXT_VARIATION_PASSWORD)); InputType.TYPE_TEXT_VARIATION_PASSWORD));
if (pos >= 0) {
((EditText)mPasswordView).setSelection(pos);
}
} }
} }

View File

@@ -74,6 +74,11 @@ class WifiDialog extends AlertDialog implements WifiConfigUiBase {
} }
} }
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mController.updatePassword();
}
@Override @Override
public boolean isEdit() { public boolean isEdit() {
return mEdit; return mEdit;