mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 962606 - Suggestions are present for password field, switch to use text transforms to reveal text. r=nalexander
This commit is contained in:
parent
02dbe5998e
commit
bd2b95251d
@ -28,6 +28,8 @@ import android.content.Intent;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.text.method.SingleLineTransformationMethod;
|
||||
import android.util.Patterns;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@ -64,21 +66,24 @@ abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractAc
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean isShown = 0 == (passwordEdit.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
boolean isShown = passwordEdit.getTransformationMethod() instanceof SingleLineTransformationMethod;
|
||||
|
||||
// Changing input type loses position in edit text; let's try to maintain it.
|
||||
int start = passwordEdit.getSelectionStart();
|
||||
int stop = passwordEdit.getSelectionEnd();
|
||||
passwordEdit.setInputType(passwordEdit.getInputType() ^ InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
passwordEdit.setSelection(start, stop);
|
||||
|
||||
if (isShown) {
|
||||
passwordEdit.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
showPasswordButton.setText(R.string.fxaccount_password_show);
|
||||
showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_show_background));
|
||||
showPasswordButton.setTextColor(getResources().getColor(R.color.fxaccount_password_show_textcolor));
|
||||
} else {
|
||||
passwordEdit.setTransformationMethod(SingleLineTransformationMethod.getInstance());
|
||||
showPasswordButton.setText(R.string.fxaccount_password_hide);
|
||||
showPasswordButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.fxaccount_password_button_hide_background));
|
||||
showPasswordButton.setTextColor(getResources().getColor(R.color.fxaccount_password_hide_textcolor));
|
||||
}
|
||||
passwordEdit.setSelection(start, stop);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"
|
||||
android:targetSdkVersion="16" />
|
||||
android:targetSdkVersion="14" />
|
||||
|
||||
<uses-permission android:name="@ANDROID_BACKGROUND_TARGET_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
|
||||
<uses-permission android:name="@ANDROID_BACKGROUND_TARGET_PACKAGE_NAME@.permissions.FORMHISTORY_PROVIDER"/>
|
||||
|
Loading…
Reference in New Issue
Block a user