- TommyDawkins
- Posts: 4
- Joined:
Unity Android Textbox Autofill / Autocomplete | Need to disable AutoFill for textbox (Android project)
Hello People,
Right now, I need to use the android keyboard when I press a textbox to enter text. It open the android keyboard. The thing is, I want to disable autocomplete/Autofill so the text I just entered will not be save a autocomplete possibility on a next textbox. Is there a way to do it? I tried InputScope="Password" but everything I typed in this textbox is still save in autocomplete possibility.
Thanks,
Tommy
Right now, I need to use the android keyboard when I press a textbox to enter text. It open the android keyboard. The thing is, I want to disable autocomplete/Autofill so the text I just entered will not be save a autocomplete possibility on a next textbox. Is there a way to do it? I tried InputScope="Password" but everything I typed in this textbox is still save in autocomplete possibility.
Thanks,
Tommy
Re: Unity Android Textbox Autofill / Autocomplete | Need to disable AutoFill for textbox (Android project)
We are using Unity TouchScreenKeyboard.Open for opening the keyboard. How would achieve what you want with that API?
If you find a way, you can modify NoesisUnity.cs (line 509)
If your solution works we can officially apply this change.
If you find a way, you can modify NoesisUnity.cs (line 509)
Code: Select all
#if UNITY_2018_1_OR_NEWER
keyboard_ = TouchScreenKeyboard.Open(text, keyboardType, true, multiline, secure, false, "", characterLimit);
#else
keyboard_ = TouchScreenKeyboard.Open(text, keyboardType, true, multiline, secure, false, "");
#endif
- TommyDawkins
- Posts: 4
- Joined:
Re: Unity Android Textbox Autofill / Autocomplete | Need to disable AutoFill for textbox (Android project)
Here's what I'll update and test but need to embedded noesis package so my code isn't overwrite. Don't know if you could test it from you side faster than me.
Code: Select all
public static void Open(UIElement focused_)
{
string text = "";
TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default;
bool multiline = false;
bool autoCorrection = true;
bool secure = false;
int characterLimit = 0;
FrameworkElement focusedInputScopeElement = null;
if (focused_ is FrameworkElement)
{
focusedInputScopeElement = (FrameworkElement)focused_;
switch (focusedInputScopeElement.InputScope)
{
case InputScope.Url:
keyboardType = TouchScreenKeyboardType.URL;
break;
case InputScope.Digits:
case InputScope.Number:
case InputScope.NumberFullWidth:
keyboardType = TouchScreenKeyboardType.NumbersAndPunctuation;
break;
case InputScope.TelephoneNumber:
case InputScope.TelephoneLocalNumber:
keyboardType = TouchScreenKeyboardType.PhonePad;
break;
case InputScope.AlphanumericFullWidth:
case InputScope.AlphanumericHalfWidth:
keyboardType = TouchScreenKeyboardType.NamePhonePad;
break;
case InputScope.EmailSmtpAddress:
keyboardType = TouchScreenKeyboardType.EmailAddress;
break;
case InputScope.RegularExpression:
keyboardType = TouchScreenKeyboardType.Search;
break;
default:
keyboardType = TouchScreenKeyboardType.Default;
break;
}
}
TextBox textBox = focused_ as TextBox;
PasswordBox passwordBox = focused_ as PasswordBox;
if (textBox != null)
{
text = textBox.Text;
multiline = textBox.TextWrapping == TextWrapping.Wrap && textBox.AcceptsReturn;
characterLimit = textBox.MaxLength;
// Use Password Input Scope with textbox to show or not Autocomplete
if (focusedInputScopeElement != null)
{
autoCorrection = focusedInputScopeElement.InputScope != InputScope.Password;
}
}
else if (passwordBox != null)
{
text = passwordBox.Password;
secure = true;
}
TouchScreenKeyboard keyboard_;
#if UNITY_2018_1_OR_NEWER
keyboard_ = TouchScreenKeyboard.Open(text, keyboardType, autoCorrection, multiline, secure, false, "", characterLimit);
#else
keyboard_ = TouchScreenKeyboard.Open(text, keyboardType, autoCorrection, multiline, secure, false, "");
#endif
if (keyboard_.status == TouchScreenKeyboard.Status.Visible)
{
if (textBox != null)
{
textBox.HideCaret();
}
else if (passwordBox != null)
{
passwordBox.HideCaret();
}
keyboard = keyboard_;
focused = focused_;
undoString = text;
}
}
- TommyDawkins
- Posts: 4
- Joined:
Re: Unity Android Textbox Autofill / Autocomplete | Need to disable AutoFill for textbox (Android project)
Update: Just tested what I posted and setting Autocorrection to false when opening android soft keyboard on textbox click don't seems to hide the suggestion bar.
Update No2: It look like the suggestion bar is still there BUT, it don't save word that we enter in textbox so good for me.
Question: Is it possible for you to add a property about autoComplete On textbox so we can manage it?
Update No2: It look like the suggestion bar is still there BUT, it don't save word that we enter in textbox so good for me.
Question: Is it possible for you to add a property about autoComplete On textbox so we can manage it?
Re: Unity Android Textbox Autofill / Autocomplete | Need to disable AutoFill for textbox (Android project)
We could also use one of the InputScopes for this (like Private). Would this a valid solution for you?
Could you please create a ticket for this?
Could you please create a ticket for this?
- TommyDawkins
- Posts: 4
- Joined:
Who is online
Users browsing this forum: No registered users and 2 guests