Fix Pin cannot be hidden after showing it #1025 (#1027)

This commit is contained in:
Chad Scharf 2020-07-30 13:46:06 -04:00 committed by GitHub
parent 4f37c2cb73
commit c5a71c4304
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,19 +40,23 @@ namespace Bit.Droid.Renderers
{ {
// Check if field type is text, otherwise ignore (numeric passwords, etc.) // Check if field type is text, otherwise ignore (numeric passwords, etc.)
EditText.InputType = Element.Keyboard.ToInputType(); EditText.InputType = Element.Keyboard.ToInputType();
if ((EditText.InputType & InputTypes.ClassText) == InputTypes.ClassText) bool isText = (EditText.InputType & InputTypes.ClassText) == InputTypes.ClassText,
isNumber = (EditText.InputType & InputTypes.ClassNumber) == InputTypes.ClassNumber;
if (isText || isNumber)
{ {
if (Element.IsPassword) if (Element.IsPassword)
{ {
// Element is a password field, set inputType to TextVariationPassword which disables // Element is a password field, set inputType to TextVariationPassword which disables
// predictive text by default // predictive text by default
EditText.InputType = EditText.InputType | InputTypes.TextVariationPassword; EditText.InputType = EditText.InputType |
(isText ? InputTypes.TextVariationPassword : InputTypes.NumberVariationPassword);
} }
else else
{ {
// Element is not a password field, set inputType to TextVariationVisiblePassword to // Element is not a password field, set inputType to TextVariationVisiblePassword to
// disable predictive text while still displaying the content. // disable predictive text while still displaying the content.
EditText.InputType = EditText.InputType | InputTypes.TextVariationVisiblePassword; EditText.InputType = EditText.InputType |
(isText ? InputTypes.TextVariationVisiblePassword : InputTypes.NumberVariationNormal);
} }
// The workaround above forces a reset of the style properties, so we need to re-apply the font. // The workaround above forces a reset of the style properties, so we need to re-apply the font.