mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
Merge pull request #172 from NativeScript/text-field-secure
Text field secure
This commit is contained in:
@ -13,16 +13,7 @@ export function getNativeHint(textField: textFieldModule.TextField): string {
|
||||
|
||||
export function getNativeSecure(textField: textFieldModule.TextField): boolean {
|
||||
var inputType = textField.android.getInputType();
|
||||
|
||||
if (inputType === (android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD)) {
|
||||
return true;
|
||||
}
|
||||
else if (inputType === (android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw new Error("Unsupported input type: " + inputType);
|
||||
}
|
||||
return (((inputType & android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD) === android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD) || ((inputType & android.text.InputType.TYPE_NUMBER_VARIATION_PASSWORD) === android.text.InputType.TYPE_NUMBER_VARIATION_PASSWORD));
|
||||
}
|
||||
|
||||
export function getNativeFontSize(textField: textFieldModule.TextField): number {
|
||||
|
@ -33,6 +33,9 @@ function onSecurePropertyChanged(data: dependencyObservable.PropertyChangeData)
|
||||
else if (currentClass === android.text.InputType.TYPE_CLASS_NUMBER) {
|
||||
newInputType = currentClass | currentFlags | android.text.InputType.TYPE_NUMBER_VARIATION_PASSWORD;
|
||||
}
|
||||
|
||||
// Lower all autocapitalization bits, because password bits don't like them and we will receive "Unsupported input type: 16513" error for example.
|
||||
newInputType = newInputType & ~28762; //28762 (0x00007000) 13,14,15bits
|
||||
}
|
||||
else {
|
||||
if (currentClass === android.text.InputType.TYPE_CLASS_TEXT) {
|
||||
|
Reference in New Issue
Block a user