Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Advanced Input Field

Discussion in 'Assets and Asset Store' started by fennecx_development, Jul 29, 2017.

  1. LoBuWin

    LoBuWin

    Joined:
    Dec 29, 2016
    Posts:
    1
    Hello,

    when using the keyboard scroller on multiple scenes the ScrollView won´t be scrolled on iOS, because the OnKeyboardHeightChanged event does not get unregistered. It can be fixed by adding


    Code (CSharp):
    1.         void OnDestroy()
    2.         {
    3.             NativeKeyboardManager.RemoveKeyboardHeightChangedListener(OnKeyboardHeightChanged);
    4.         }
    to KeyboardScroller.cs. It would be good if you include this in future updates.
     
  2. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thank you for the report and the fix ;)
     
  3. perevezentsev

    perevezentsev

    Joined:
    Nov 5, 2014
    Posts:
    10
    Hello. Thanks for the great asset. Although there's a misleading part in the API. I used TextMesh Pro input fields in our project before migrating to Advanced Input Field. Automatic asset update didn't work for whatever reason (but that's not the problem). The update of code was straightforward - renamed all the properties to start with uppercase letter (although you could have saved the backward compatibility). The misleading point is that it looks the same, but in some cases it doesn't act the same, specifically, changing ContentType doesn't go into effect unless I call UpdateContentType(). What? It's the property anyways. Please fix this. Thanks!
     
  4. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thank you for the report, I'll include a fix in next version
     
  5. gauravjain-zibtek

    gauravjain-zibtek

    Joined:
    Mar 12, 2019
    Posts:
    3
    Any updates on the issue
     
  6. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I didn't have really have much development time lately, but I tried to reproduce this on multiple test devices yesterday evening. Based on your description this issue should also happen on the "Form" sample scene, right? Select first inputfield, type something and then go to next inputfield by either pressing it of by pressing submit on the keyboard. This seems to result in the second inputfield being selected properly (and caret is visible) on my test devices. The only way I could get into the state that "keyboard is visible, but nothing is selected (caret not visible)" is to really quickly press the second inputfield after the first one gets selected. Which is still difficult to do.

    I guess I need to order one of the devices you mentioned that has this issue.
    Just to be sure: you do have devices that work normally and don't have this issue, right?
     
  7. perevezentsev

    perevezentsev

    Joined:
    Nov 5, 2014
    Posts:
    10
    @jpienbro Thanks for your effort regarding the previous bug. I found another one:
    inputField.SetText(text, invokeTextChangeEvent: true);

    produces this error when the GameObject is disabled:
    Code (csharp):
    1. Coroutine couldn't be started because the the game object 'Input field' is inactive!
    2. UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    3. AdvancedInputFieldPlugin.AdvancedInputField:SetText(String, Boolean) (at Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:1121)
    4. ...(my code)
    I guess it can be fixed by starting the coroutine from another GameObject which is always active.
     
  8. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Yes, maybe I can start the coroutines from the NativeKeyboardManager, that GameObject should always be active.
     
  9. thanhlmyasha

    thanhlmyasha

    Joined:
    Jul 15, 2016
    Posts:
    1
    Useful but when working with Xiaomi Phone with API Version 23 . The navigation bar bottom can't display just see a black image below the keyboard and when click on that the keyboard will hide =.=. (Just see the bar when scroll up) If possible please fix the above issue :D. Thanks

    information: -
    The specific device model (I don't know if it will happen on all Xiaomi Phones) - Xiaomi Mi A2
    The Unity version - Unity 2018.3.5f1.
    A screenshot of the bug XiaomiA2.png
     
  10. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thank you for the bug report ;)
     
  11. feynman2nd

    feynman2nd

    Joined:
    Dec 14, 2018
    Posts:
    3
    Hello, we use Advanced Input Field (ver 1.8.1) in our project, but the plugin throws the following exception time to time.

    [Log]: Reporting error with subject Exception - NullReferenceException: Object reference not set to an instance of an object
    [Exception]: NullReferenceException: Object reference not set to an instance of an object
    AdvancedInputFieldPlugin.MobileTextNavigator.ShowActionBar () (at C:/Users/Internal/Documents/Projekty/client/Assets/Plugins/Advanced Input Field/Scripts/InputField/MobileTextNavigator.cs:395)
    AdvancedInputFieldPlugin.MobileTextInputHandler.OnHold (Vector2 position) (at C:/Users/Internal/Documents/Projekty/client/Assets/Plugins/Advanced Input Field/Scripts/InputField/MobileTextInputHandler.cs:425)
    AdvancedInputFieldPlugin.TextInputHandler.Process () (at C:/Users/Internal/Documents/Projekty/client/Assets/Plugins/Advanced Input Field/Scripts/InputField/TextInputHandler.cs:78)
    AdvancedInputFieldPlugin.MobileTextInputHandler.Process () (at C:/Users/Internal/Documents/Projekty/client/Assets/Plugins/Advanced Input Field/Scripts/InputField/MobileTextInputHandler.cs:112)
    AdvancedInputFieldPlugin.AdvancedInputField.OnUpdateSelected (UnityEngine.EventSystems.BaseEventData eventData) (at C:/Users/Internal/Documents/Projekty/client/Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:2012)
    UnityEngine.EventSystems.ExecuteEvents.Execute (IUpdateSelectedHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:99)
    UnityEngine.EventSystems.ExecuteEvents.Execute[IUpdateSelectedHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
    UnityEngine.EventSystems.EventSystem:Update()

    The workaround is to enable Action Bar.
     
  12. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I could reproduce it on an empty inputfield while holding it for a second.
    This should fix it:
    In the file "MobileTextInputHandler.cs" change the "OnHold" method to this:
    Code (CSharp):
    1. internal override void OnHold(Vector2 position)
    2. {
    3.      base.OnHold(position);
    4.      if(InputField.Text.Length > 0)
    5.      {
    6.           TextNavigator.SelectCurrentWord();
    7.      }
    8.      else if(InputField.ActionBarEnabled)
    9.      {
    10.           mobileTextNavigator.ShowActionBar();
    11.      }
    12. }
     
  13. yudizArjun

    yudizArjun

    Joined:
    May 21, 2018
    Posts:
    3
    Hello, I was wondering If there is any way for getting Unicode of emojis from the native keyboard or its manager. I do not want to use Text Mesh Pro for showing the emojis because it just puts the limitation on the use of emoji.

    Actually, I did some research on this and found, This is a GitHub project which converts the Unicode/UTF-8 values to emoji and it can display emojis in UnityUI text by creating a separate RawImage under the text file. From the project, I can get all the emojis through Unicode/UTF-8. Even, the ones with different colors emojis. All I need now is just Unicode of an emoji from the keyboard somehow.

    So, Is there any way to get the Unicode of emojis using your plugin or any callback or something?
     
  14. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Not really, the plugin currently uses TextMeshPro to determine which character ranges represent an emoji. It checks the character data of the TextMeshPro text after it gets rendered. You probably would need to analyze the text string that gets returned by the OnTextChanged event if you don't want to use TextMeshPro.
     
  15. yudizArjun

    yudizArjun

    Joined:
    May 21, 2018
    Posts:
    3
    Hello, I used OnTextChanged event which returns only the characters which are typed in the keyboard. When I try to add emoji nothing is getting added in the string. I tried different conversion methods to get the value of emojis that also does not work. Can you check if there is any string sent to callback when we try to insect emoji via keyboard?

    I did more digging on native android side, I found we can use emoji directly in the plain text field. I guess, there must be a way in your plugin to support emoji directly from the native. Since you are opening native keyboard and getting the callbacks from the native side. If we can get even UTF-32 value from UTF-16(which is default) that could work in texmesh pro if you have sprite asset. if You try this "\U0001F60B" in text mesh pro UI text result will be straight away, which is already included in the example of "emojione" sprite asset.

    This would result in just adding the sprite asset with Unicode, which will be displayed directly from the input field. I would appreciate some help on this from your end.

    Thanks
     
  16. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Check your PM, we'll continue this conversation there.
     
  17. Rodiaz89

    Rodiaz89

    Joined:
    Apr 11, 2014
    Posts:
    136
    Hello,
    I'm wondering if there is a way to remove the predictive/suggestions of the keyboard? I see that we don't get those when the content type is set to password but I would like to remove them for other Inputfields.

    Thanks!
     
  18. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    By default the flags to disable suggestions are set on Android Keyboards, but some keyboards just ignore these flags anyways. (If you change the ContentType to Custom and set the InputType to AutoCorrect or Password these flags won't be set) A workaround I could find on the internet is to set the flag VISIBLE_PASSWORD, but this is considered a hack, since it disables other features too and has some problems in certain languages.
     
  19. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
  20. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I've tested the plugin in Unity 2017.1.1 with target sdk 28 running on a device with Android 9 installed and I didn't notice any issues with the keyboard input.
     
  21. sophieannebusog3

    sophieannebusog3

    Joined:
    Mar 18, 2019
    Posts:
    5
    Hi, interested in buying this asset, but I have some questions

    1. In getting the keyboard height, does it include height of the suggested texts and the input field above keyboard in Android?
    2. in iPad, does it consider the hide keyboard button as cancel or done?
     
  22. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    1. Yes, the keyboard height includes the suggestion bar on Android. Unlike the official Unity inputfield the keyboard on Android doesn't include a separate inputfield attached to the keyboard. If you want to try it out on an Android device. You can find the links to prebuild Android apk files of the sample scenes of the plugin in the first post of this thread.

    2. Not sure if understand your question correctly. Pressing the done key on the keyboard or pressing somewhere outside the inputfield/keyboard will result in a keyboard hide. By listening to the OnEndEdit event you can find out the reason that the keyboard got hidden.
     
  23. sophieannebusog3

    sophieannebusog3

    Joined:
    Mar 18, 2019
    Posts:
    5


    Hi,
    Thanks for the quick reply. Sorry for the confusion, I meant to say that in iPad, there is a hide keyboard button on the bottom right, whenever it's clicked it is considered as a Submit and EndEdit rather than cancel, so i was asking if your tool have a solution for this bug.

    -Sophie
     

    Attached Files:

  24. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Just tested this on an iPad.
    In the OnEndEdit(string result, EndEditReason reason) event callback you get these results:
    1. Keyboard hide button will give KEYBOARD_CANCEL as reason
    2. Keyboard done button will give KEYBOARD_DONE as reason
    3. Keyboard next button will give KEYBOARD_NEXT as reason
    4. Tap outside the inputfield or keyboard area will give USER_DESELECT as reason

    Based on that reason parameter you can execute custom code to handle a cancel (KEYBOARD_CANCEL) or a confirm (KEYBOARD_DONE or KEYBOARD_NEXT)
     
  25. FerdieKucheza

    FerdieKucheza

    Joined:
    Apr 4, 2017
    Posts:
    5
    Hi! First of all, this package looks amazing. I do have one question though. We're looking for an InputField that doesn't popup the native Android keyboard (i.e. the 'Hide Mobile Input', which only works on iOS). Instead, we want to use our own custom keyboard, made with Unity UI components. Unfortunately, the regular Unity InputField always triggers the native Android keyboard to show. Does your custom inputfield package provide a way to do this? Does it block the native Android keyboard for showing up?
     
  26. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    You should be able to do this by modifying the NativeKeyboardManager and changing the NativeKeyboard subclass that is being used by Android in Awake(). See the SimulatorKeyboard class for an example on how to handle the methods and callbacks needed by the plugin in C# code. Your custom keyboard class should inherit from the NativeKeyboard base class too.
     
  27. perevezentsev

    perevezentsev

    Joined:
    Nov 5, 2014
    Posts:
    10
    Hi again jpienbro. The asset is great and worked well for us, but there's one rough corner because of which our boss decided to replace it with another library. This is non-native text selection UI (markers and select all/copy/paste buttons). He thinks it looks as a "cheap knockoff" (although I personally don't care much). The other library is actually open source on Github, you could borrow the code from them. I would prefer your library as it supports useful content types etc. Is there a chance you could add this feature?
     
  28. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Is that Github library a Unity plugin? Could you share the url to that project?
    The reason these controls are implemented in the Unity side of the plugin is because all text rendering is done in Unity too. So for things like positioning and the rendering order this was easier.
    If your boss doesn't like the style of the ActionBar (for a specific platform), that can be modified (background color, text color, font,...).
    In the TopBar: "AdvancedInputField => Global Settings" you can change the prefabs being used by the plugin. Just duplicate the prefab you want to change and reassign the custom one in the Global Settings.
     
  29. perevezentsev

    perevezentsev

    Joined:
    Nov 5, 2014
    Posts:
    10
    Oops, sorry, forgot the main thing - the URL: https://github.com/mopsicus/UnityMobileInput
    Not sure that changing prefab properties will do the job, unfortunately. Yeah, the native field adds complexity and doesn't integrate too well with UGUI, but for our case - mobile app with elements of a game - it works. If there was an option in your plugin to use this approach, it would be great.
     
  30. sophieannebusog3

    sophieannebusog3

    Joined:
    Mar 18, 2019
    Posts:
    5


    Thanks! Waiting for unity's reply for my purchase, there seems to be a problem with my card. By the way, in this plugin, this issue (link below) will be resolved? because in Android every time i click outside keyboard, keyboard gets closed.
    https://issuetracker.unity3d.com/is...es-wascanceled-state-is-false?page=1#comments
     
  31. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Not sure if I understand correctly, but a tap outside keyboard area and inputfield area will result in a deselect, hiding the keyboard and reporting USER_DESELECT as the reason in the OnEndEdit event.
     
  32. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    It tested that GitHub project, the demo scene does to work, but when I tried to use a ScrollRect things started to behave weirdly. Also, changing the font doesn't seem to work, it defaults to the system font on Android devices, I think. Might find some more issues with this approach if I test this further. In general I think it would be difficult to get all current functionality of the AdvancedInputField plugin working correctly when using a native view. I'll put it on my TODO list for now (low priority, though).
    It would be easier to modify the ActionBar prefab, other users have done the same thing to make the controls fit the color scheme of their specific apps.
     
  33. unity_0ctDyqWhSh0DIw

    unity_0ctDyqWhSh0DIw

    Joined:
    Dec 11, 2018
    Posts:
    1
    Hi jpienbro,
    We are trying to use your asset, the newest version, for UWP in Unity 2018.3.7 and it doesn't seem to be working. Even if we try and build one of your sample scenes, it gets null references when the input field becomes active. The error is coming from NativeUWP.NativeKeyboard.EnableUpdates. I've included the error below.

    in <00000000000000000000000000000000>:0 at Windows.UI.Core.DispatchedHandler.Invoke () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 at System.Reflection.TargetParameterCountException..ctor (System.String message) [0x00000] in <00000000000000000000000000000000>:0 at NativeUWP.Util+<RunOnUIThread>d__0.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.Assertions.Assert.AreEqual[T] (T expected, T actual, System.String message, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00000] in <00000000000000000000000000000000>:0 at NativeUWP.Util.RunOnUIThread (Windows.UI.Core.DispatchedHandler action) [0x00000] in <00000000000000000000000000000000>:0 at NativeUWP.NativeKeyboard.EnableUpdates () [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.UWPKeyboard.EnableUpdates () [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.NativeKeyboard.UpdateActiveState () [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.NativeKeyboardManager.UpdateKeyboardActiveState () [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.AdvancedInputField.set_Selected (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.AdvancedInputField.EnableSelection () [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.AdvancedInputField.CheckClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 at AdvancedInputFieldPlugin.AdvancedInputField.OnPointerUp (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerUpHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessMousePress (UnityEngine.EventSystems.PointerInputModule+MouseButtonEventData data) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent (System.Int32 id) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.EventSystems.EventSystem.Update () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0 at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.SendOrPostCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.WaitForSeconds..ctor (System.Single seconds) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.UnitySynchronizationContext.ExecuteTasks () [0x00000] in <00000000000000000000000000000000>:0 "]
     
    Last edited: May 2, 2019
  34. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I could reproduce it, but not in each build for some reason. I think Il2Cpp is stripping some classes or breaking references sometimes. Strangely enough if I added some debug lines to debug the values of some local variables in the first method that gave an error, it seems to work each time.

    Replacing attached files in the plugin scripts folders (Scripts/InputField en Scripts/NativeKeyboard) should fix it.
     

    Attached Files:

  35. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    GENERAL NOTE: I'm on holiday from 6th - 10th of May so responses might be delayed.
     
  36. feynman2nd

    feynman2nd

    Joined:
    Dec 14, 2018
    Posts:
    3
    Hello, is the plugin tested with unity 2019.1? It looks like there is a problem with keyboard which does not show when input is selected.
     
  37. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hadn't tested it before in 2019.1, but tested it today and could reproduce the issue. Seems like Unity 2019.1 isn't properly including the NativeKeyboard.aar library file in Android builds.
    I found a workaround (for now) that if you export the project first to an Android Studio project, then open that exported project and confirm the "fix Gradle Settings" option and then build it. Then it properly includes the native library file, but if you just build the apk directly from the Unity Editor it won't work for some reason.
     
  38. feynman2nd

    feynman2nd

    Joined:
    Dec 14, 2018
    Posts:
    3
    Thanks jpienbro, is there some ETA for fixing this without the workaround?
     
  39. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    For some reason Unity suddenly includes the Android binding properly now after fixing a reported bug in the Android binding, rebuilding it, upgrading the project to Unity 2019.1.2 and using the "reimport all" option.
    I think I will publish a new version this week. I'll verify building for Android in Unity 2019.1 then before submitting that package to that Asset Store. Normally I do this for all major versions of Unity from Unity 2017.1 - 2018.3, but starting this release I'll do this for Unity 2019.1 too.
     
  40. MohHeader

    MohHeader

    Joined:
    Aug 12, 2015
    Posts:
    41
    Hi :) ,,,

    Not sure if this is a new bug introduced in the last asset update
    Now on Android when I click the ( Go / Submit ) button, id doesn't trigger ( OnEndEdit )
    although if clicked outside the keyboard,( OnEndEdit ) will be triggered with reason USER_DESELECT

    but it is working on iOS

    any thoughts about it ?

    ------
    EDIT :
    Not sure yet about the reason behind the issue, tried to revert back using GIT to the older version, still the same issue.

    But I can confirm two things,
    1. Next button is working, and moves next to the following input field
    2. After I click GO, the keyboard disappear, but then later once I click anywhere, on the screen it trigger OnEndEdit, with the reason : USER_DESELECT
     
    Last edited: May 19, 2019
  41. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Found the source of the problem. In one of the latest versions I added a switch to show done/next key based on the "NextInputField" field being set. On Android it was using the "Go" key flag instead of the "Done" key flag.

    This should fix it: Replace the NativeKeyboard.aar file in Assets/Plugins/Android with the one in attached rar file.
     

    Attached Files:

    andrefjdesign likes this.
  42. MohHeader

    MohHeader

    Joined:
    Aug 12, 2015
    Posts:
    41
    Thanks for the update, and it is working

    But I got this today (Randomly) , and thought to share it with you.


    Code (CSharp):
    1. java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Handler.post(java.lang.Runnable)' on a null object reference
    2. com.jeroenvanpienbroek.nativekeyboard.NativeKeyboard.enableUpdates(NativeKeyboard.java:763)
    3. com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    4. com.unity3d.player.UnityPlayer.c(Unknown Source)
    5. com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
    6. android.os.MessageQueue.next(MessageQueue.java:397)
    7. android.os.Looper.loop(Looper.java:151)
    8. com.unity3d.player.UnityPlayer$e.run(Unknown Source)
    9. UnityEngine.AndroidJNISafe.CheckException () (at <00000000000000000000000000000000>:0)
    10. UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
    11. AdvancedInputFieldPlugin.NativeKeyboard.UpdateActiveState () (at <00000000000000000000000000000000>:0)
    12. AdvancedInputFieldPlugin.AdvancedInputField.set_Selected (System.Boolean value) (at <00000000000000000000000000000000>:0)
    13. AdvancedInputFieldPlugin.AdvancedInputField.ManualSelect (AdvancedInputFieldPlugin.BeginEditReason beginEditReason) (at <00000000000000000000000000000000>:0)
    14. UnityEngine.Events.UnityEvent.Invoke () (at <00000000000000000000000000000000>:0)
    15. UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <00000000000000000000000000000000>:0)
    16. UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) (at <00000000000000000000000000000000>:0)
    17. UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () (at <00000000000000000000000000000000>:0)
    18. UnityEngine.EventSystems.StandaloneInputModule.Process () (at <00000000000000000000000000000000>:0)
    19. UnityEngine.EventSystems.StandaloneInputModule:Process()
     
  43. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Did this happen on the first inputfield you selected after boot? Then it might be that the native initialization wasn't ready on the other (native) thread.
     
  44. MohHeader

    MohHeader

    Joined:
    Aug 12, 2015
    Posts:
    41
    Did this happen on the first inputfield you selected after boot?
    Yes it was indeed.

    Does that mean there is no solution for that, hmmm any way to known once it is ready ? so I can show some sort of Loading or at block it in a user friendly way ?

    Note : it took few seconds before I selected the input field, splash screen + Loading screen.

    Thanks
     
  45. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    The NativeKeyboard binding gets created when you first try to access the keyboard (select a inputfield).
    I've added multiple initialization checks to make sure to wait until it's ready. Although I can't really test this myself, since I haven't seen this issue on my test devices. See if you still can "randomly" get this error with the attached file.
     

    Attached Files:

    andrefjdesign likes this.
  46. andrefjdesign

    andrefjdesign

    Joined:
    Nov 29, 2016
    Posts:
    1
    Hi!
    I am loving the asset, but after this last update I'm having problems with it. I use an immersive mode that displays the status bar and the native Android bar in my app, and every time I select an input text the screen rattles and seems to ignore the immersive mode.
    This is possible to test using an empty project with only one input text and inserting the line of code in void Start ():

    Code (CSharp):
    1. srcImmersiveMode.SetupAndroidTheme(srcImmersiveMode.ToARGB(new Color(1.0f, 1.0f, 1.0f)),
    2.             srcImmersiveMode.ToARGB(settings.cor_padrao_app));

    srcImmersiveMode.cs:


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class srcImmersiveMode : MonoBehaviour
    6. {
    7.     public static void SetupAndroidTheme(int primaryARGB, int darkARGB, string label = null)
    8.     {
    9. #if UNITY_ANDROID && !UNITY_EDITOR
    10.             label = label??Application.productName;
    11.             Screen.fullScreen = false;
    12.             AndroidJavaObject activity = new AndroidJavaClass ("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject> ("currentActivity");
    13.             activity.Call ("runOnUiThread", new AndroidJavaRunnable (() => {
    14.                 AndroidJavaClass layoutParamsClass = new AndroidJavaClass ("android.view.WindowManager$LayoutParams");
    15.                 int flagFullscreen = layoutParamsClass.GetStatic<int> ("FLAG_FULLSCREEN");
    16.                 int flagNotFullscreen = layoutParamsClass.GetStatic<int> ("FLAG_FORCE_NOT_FULLSCREEN");
    17.                 int flagDrawsSystemBarBackgrounds = layoutParamsClass.GetStatic<int> ("FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS");
    18.                 AndroidJavaObject windowObject = activity.Call<AndroidJavaObject> ("getWindow");
    19.                 windowObject.Call ("clearFlags", flagFullscreen);
    20.                 windowObject.Call ("addFlags", flagNotFullscreen);
    21.                 windowObject.Call ("addFlags", flagDrawsSystemBarBackgrounds);
    22.                 int sdkInt = new AndroidJavaClass ("android.os.Build$VERSION").GetStatic<int> ("SDK_INT");
    23.                 int lollipop = 21;
    24.                 if (sdkInt > lollipop) {
    25.                     windowObject.Call ("setStatusBarColor", darkARGB);
    26.                     string myName = activity.Call<string> ("getPackageName");
    27.                     AndroidJavaObject packageManager = activity.Call<AndroidJavaObject> ("getPackageManager");
    28.                     AndroidJavaObject drawable = packageManager.Call<AndroidJavaObject> ("getApplicationIcon", myName);
    29.                     AndroidJavaObject taskDescription = new AndroidJavaObject ("android.app.ActivityManager$TaskDescription", label, drawable.Call<AndroidJavaObject> ("getBitmap"), primaryARGB);
    30.                     activity.Call ("setTaskDescription", taskDescription);
    31.                 }
    32.             }));
    33. #endif
    34.     }
    35.  
    36.     public static int ToARGB(Color color)
    37.     {
    38.         Color32 c = (Color32)color;
    39.         byte[] b = new byte[] { c.b, c.g, c.r, c.a };
    40.         return System.BitConverter.ToInt32(b, 0);
    41.     }
    42. }

    I use Unity 2018.4.0f1 and the last version of asset 1.8.3.

    Is there a patch for this?

    The previous version I had (1.8.2) was working normally, however some cell phones the status bar overlaid the layout as shown below (Moto G 7 Plus, API 28 Android 9, for example):






    After I select an option to display another screen that has the input text component, the aspect ratio is corrected on time. As shown below:




    And it's strange because it always returns to normal when there is input text on the screen.
     
    Last edited: May 28, 2019
  47. ccaviere

    ccaviere

    Joined:
    Mar 15, 2013
    Posts:
    2
    Hi,

    We've been running into an issue on iPads when using the "dismiss keyboard" on the bottom right. Dismissing the keyboard should normally end edit mode and let us click on the field again to re-open the keyboard, but if we open and close the keyboard too quickly, the text field will be stuck in edit mode (with the blinking cursor).

    Attaching a video for reference, the problem happens after the third attempt (~9 seconds in)
    https://www.dropbox.com/s/bufxca6qgguk5am/IMG_0110.TRIM.MOV?dl=0

    I tried to do some debugging and it looks like the "Cancel" event isn't being fired.

    Thanks as always!
     
    Last edited: May 30, 2019
  48. TeamMEW

    TeamMEW

    Joined:
    Jan 8, 2016
    Posts:
    6
    I installed a sample apk. But Korean input is not possible. The letters are displayed as rectangles. Is Korean input possible?
     
  49. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I did fix a navigation bar buttons issue for Xiaomi phones in latest version, so it might be caused by that. I'll try reproducing it by adding that immersive mode code and fixing it. Also need to verify if it doesn't break that earlier fix for Xiaomi phones.
    I don't have all my test devices with me this week. So I'll need to verify the fix on a Xiaomi phone next week then.
     
  50. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Did you install the "Chat" sample scene? That's the one using TextMeshPro text renderers which doesn't seem to include Korean characters by default.
    I tested it with the "Form" sample scene too using Korean keyboard and that does seem to display the characters. (That scene uses Unity text renderers).