Search Unity

Advanced Input Field

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

  1. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Hi, I am Alex, an user for this plugin.
    I'd like this field to automatically start with capital first letter in a sentence.
    Does this plugin support this feature?
    Looking forward to your reply.
    Best
    Alex
     
  2. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    You could (in theory) comment out the code that hides the keyboard when the inputfield gets deselected, but it wouldn't really be useful as it won't process text changes anymore too. This is by design to prevent additional performance impact when the user is not using an inputfield.

    What's your use case for this actually? Why does the keyboard need to stay onscreen?
     
  3. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hi Alex

    The plugin doesn't support it currently, but I can add it as a new CharacterValidation type in a future version of the plugin.
    I've added it to my TODO list (see https://trello.com/b/0qda8XOp/advanced-input-field), not sure yet if it will included in next release though.
     
  4. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Okay, Thanks.
    I will wait your next version for this feature.
    Best
    Alex
     
  5. christian_qnipp

    christian_qnipp

    Joined:
    Aug 8, 2017
    Posts:
    2
    Hello, I encountered a bug when using voice input on an iPhone.

    To create a scene to reproduce the bug you only need an AdvancedInputField and a button to clear the input field in the scene.

    1. Focus input field
    2. Use microphone button to enter text via voice
    3. Press ui button that calls advancedInputField.Clear()
    4. See that the input field has been cleared
    5. Focus the input field again
    6. See that the previously cleared text will show again inside the input field
    7. As soon as another input is entered, the wrong text will disappear

    This is only reproducable on an iPhone and only by using the voice input.
     
  6. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thank you for the bug report (including repro steps). I've added this bug to the TODO list of the plugin.
     
  7. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Hello, I have some problem.
    When a user clicks the iOS keyboard button "HideKeyboard" - the keyboard is hidden for a second but appears again

    I think it's because of the inputField is still focused.
     
  8. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thanks for the report. I think the key doesn't send the "CancelKeyboard" event properly from the native binding of the plugin. I will recheck on my iOS test devices and probably include a fix in next release.
     
  9. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Hi, I am Alex.
    I had already asked a feature that make first letter of sentence into a capital letter.
    I'd like to know whether it's have been implemented in current version.
    If not, I'd like to know when it will be done.
    Thanks
    Best
    Alex
     
  10. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    It will be included in next release. It's already implemented in current development version as a new CharacterValidation type). I expect to release it next week, still having some issues with UWP specifically.
    Progress can also be seen here: https://trello.com/b/0qda8XOp/advanced-input-field (currently in the verify phase)
     
    andrefjdesign likes this.
  11. toddfiore

    toddfiore

    Joined:
    Dec 16, 2016
    Posts:
    12
    I'm building a basic chat feature and would like to replicate the message input box like Android and iOS do. Meaning it is a multi-line newline input box that has full editing capabilities and also scrolls as the message gets bigger. Is there any way to do this? I've tried content size fitters and scroll views but I cant get scrolling and editing to work.

    For an example just use your phones built in sms app and watch how their input box grows and shrinks and allows scrolling.

    Thanks
     
  12. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Current Advanced Input Fields don't render all their text (only a region of text that fits in the bounding box), so ContentSizeFitters will not work. I would need to implement something in the plugin to get this working.
    But basically you need an option to show a (second) inputfield attached to the TouchScreenKeyboard when an Advanced Input Field gets focused and always fits all text (optimal size), right?
     
  13. toddfiore

    toddfiore

    Joined:
    Dec 16, 2016
    Posts:
    12
    Hm in a way yes. Or a way to easily scroll through an advanced input field while maintaining editability. Basically I need to mirror the experience of a native sms applications input box.
     
  14. hammadb

    hammadb

    Joined:
    Oct 3, 2016
    Posts:
    6
    Character limit does not work on iOS
    As a workaround I added some code to MobileTextInputHandler in ProcessTextChange

    if(InputField.CharacterLimit > 0 && keyboardEvent.Value.Length > InputField.CharacterLimit)
    {
    Keyboard.ChangeText(InputField.Text);
    } else {
    InputField.Text = keyboardEvent.Value;
    }
     
    Last edited: Mar 5, 2018
  15. cmbellman

    cmbellman

    Joined:
    Sep 19, 2013
    Posts:
    20
    Hello,

    After upgrading to 1.5.0 I only get the keyboard working for first time I activate an input field. Next time the field activates and cursor starts blinking, but the keyboard doesn't show. Has anything changed that I should implement in my code? I'm using input.ManualSelect() to activate the fields from code.

    So it's working first time, I can submit and keyboard goes down. Second time it's not showing.

    I'm testing on a Note 8.

    EDIT: don't know if this is a clue, I'm seeing thousands of this message in logcat:

    InputMethodManagerService: hideCurrentInputLocked : shouldHideSoftInput is false
     
    Last edited: Mar 8, 2018
  16. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I noticed a problem with the character limit code on iOS while fixing something else (it was using the wrong text variable in the native iOS binding.) It's fixed in current development version and will be included in next release.
     
  17. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Could you try replacing attached file (NativeKeyboard.aar) in Assets/Plugins/Android? This fixes a cancel keyboard bug that occurred when changing between some keyboard types, so it might be related.
     

    Attached Files:

  18. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Hi, I have installed your updated new version of Advanced Input Field. All features are working correctly.
    Regarding to cursor position, I'd like to know how can I set the cursor position programmatically at run time.
    Looking forward to your reply.
    Best
    Alex
     
  19. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Hi, I've installed new version of your advanced input field plugin. All features are working correctly.
    Regarding to use of this plugin, I'd like to know some thing.
    1. How can I set cursor position programmatically at run time.
    2. How can I get string of current cursor position when user change the cursor position.
    Looking forward to your reply.
    Best
    Alex
     
  20. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    For the first functionality you can add this method in AdvancedInputField.cs:
    Code (CSharp):
    1. public void SetCaretPosition(int caretPosition)
    2. {
    3.     if(textNavigator != null && text != null)
    4.     {
    5.         textNavigator.CaretPosition = Mathf.Clamp(caretPosition, 0, text.Length);
    6.     }
    7.     else
    8.     {
    9.         Debug.LogWarning("Couldn't set caret position, the input field is not initialized yet");
    10.     }
    11. }
    For the second functionality I'll need to change some more code (implementing event for caret changes and exposing that to the AdvancedInputField class).
    I'll take a look at that later (probably tomorrow)
     
  21. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Thanks. I will wait for you tomorrow.
     
  22. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    And, I'd like to know the event when user move the cursor position.
    Thanks
    Best
    Alex
     
  23. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Regarding to the function that you mentioned above, it's not working for me.
    The text that should be displayed on the Advance input field is longer than the input field can display.

    "[3/12/2018 1:26 AM]\r\nThis is my new note for this schedule.\r\n[3/12/2018 1:26 AM]\r\nI'd like to discuss about this feature today.\r\n[3/12/2018 1:27 AM]\r\nHi\nWhat are you doing now ?\n\r\n[3/12/2018 1:28 AM]\r\nI am writing new spec for this feature.\r\n[3/12/2018 1:29 AM]\r\nIs it possible to chat with you for this\nFeature?\n\r\n[3/12/2018 1:32 AM]\r\nWhat do you this about this feature?\r\n[3/12/2018 1:34 AM]\r\nI can not understand what you mean.\r\n[3/12/2018 1:36 AM]\r\nWhen I develop this logic, this feature was very simple for my view.\n\n\r\n[3/12/2018 1:37 AM]\r\nBut currently, It's \nNot so easy logic to implement.\r\n[ I DAG ]\n"

    This is the text that should be displayed on the input field.
    I am going to set the cursor position to the end of this text.
    so, user can edit text from the end of this text.
    But when I call the method "SetCaretPosition", it's not set the cursor at the end of this text.

    I've called this method in the call back function named "OnSelectionChanged(bool arg0)".
    In your advanced input field plugin, this function is called when user tap the input field and going to edit text.

    I will thanks if you can teach me for this issue.

    Looking forward to your reply.

    Best
    Alex
     
  24. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Ah, OK. I only tested it quickly yesterday with some text that fits in the inputfield, but it should autoscroll to the place of the caret position automatically normally. I'll look into it tonight why it's not doing that.
     
  25. alexMobileApps50

    alexMobileApps50

    Joined:
    Sep 23, 2017
    Posts:
    21
    Thank you.
    I will wait for your reply.
    Best
    Alex.
     
  26. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Hi, today I updated the plugin from asset store.
    For Android everything is OK
    For iOS I have problems:

    There are a lot of duplicates symbols for architecture arm64

    for example: duplicate symbol _indexOf In NativeKeyboard.a

    You can see it in a screenshot (Screen Shot 2018-03-12 at 17.33.13.png)

    1) What should I do?
    2) Should I remove the TouchScreenKeyboard.a ?
     

    Attached Files:

  27. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    You might have missed it, but see the first post of this thread for the Upgrade Notes ;). It tells you which files are outdated and should be removed.
     
  28. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    Content type integer and decimal are not working on android.

    Edit: Nevermind, I have to update to Unity 5.6.5. I'll report back when done.
     
    Last edited: Mar 12, 2018
  29. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    After some debugging I noticed that caret position gets overwritten by the internal processing of the tap event that occurs after the OnSelectionChanged event. A temporarily workaround is to delay the SetCaretPosition call by 1 frame.

    My debug code:
    Code (CSharp):
    1. public class Test4: MonoBehaviour
    2. {
    3.     [SerializeField]
    4.     private AdvancedInputField inputField;
    5.  
    6.     private void Start()
    7.     {
    8.         inputField.OnSelectionChanged.AddListener(OnSelectionChanged);
    9.         inputField.OnCaretPositionChanged.AddListener(OnCaretPositionChanged);
    10.         inputField.Text = "[3 / 12 / 2018 1:26 AM]\r\nThis is my new note for this schedule.\r\n[3 / 12 / 2018 1:26 AM]\r\nI'd like to discuss about this feature today.\r\n[3/12/2018 1:27 AM]\r\nHi\nWhat are you doing now ?\n\r\n[3/12/2018 1:28 AM]\r\nI am writing new spec for this feature.\r\n[3/12/2018 1:29 AM]\r\nIs it possible to chat with you for this\nFeature?\n\r\n[3/12/2018 1:32 AM]\r\nWhat do you this about this feature?\r\n[3/12/2018 1:34 AM]\r\nI can not understand what you mean.\r\n[3/12/2018 1:36 AM]\r\nWhen I develop this logic, this feature was very simple for my view.\n\n\r\n[3/12/2018 1:37 AM]\r\nBut currently, It's \nNot so easy logic to implement.\r\n[I DAG]\n";
    11.     }
    12.  
    13.     public void OnClearClick()
    14.     {
    15.         Debug.Log("OnClearClick");
    16.         inputField.Clear();
    17.     }
    18.  
    19.     public void OnSelectionChanged(bool selected)
    20.     {
    21.         Debug.Log("OnSelectionChanged: " + selected);
    22.         if(selected)
    23.         {
    24.             //inputField.SetCaretPosition(inputField.Text.Length); //Too early, caret position  modification will get overwritten by tap event
    25.             StartCoroutine(DelayedCaretSet());
    26.         }
    27.     }
    28.  
    29.     private IEnumerator DelayedCaretSet()
    30.     {
    31.         yield return null;
    32.         inputField.SetCaretPosition(inputField.Text.Length);
    33.     }
    34.  
    35.     public void OnCaretPositionChanged(int caretPosition)
    36.     {
    37.         Debug.Log("OnCaretPositionChanged: " + caretPosition);
    38.     }
    39. }
    Please apply attached patch version, it contains several small fixes and adds an event for caret position changes.

    I'm thinking about maybe including an option on a AdvancedInputField instance to determine what should happen with the caret position when it get's focused (use press location of User, beginning of text or end of text).
     

    Attached Files:

    Last edited: Mar 12, 2018
  30. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    Confirmed not working on Unity 5.6.5.

    This is the keyboard that appears when Content Type is integer:
    integer.jpeg

    This is the keyboard that appears when Content Type is decimal:
    decimal.jpeg

    Edit:
    I tested them on a different device and they worked. I am now testing on other devices.

    Edit 2:
    I tested them on different devices and they are different on every device. Some give you the option to add the . on decimal keypad, some don't. What should I do?

    Edit 3:
    Downloading a better android keyboard solves this issue. Instructing users to download a better keyboard is madness, but it will have to do.
     
    Last edited: Mar 13, 2018
  31. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hmm, inconsistent behaviour on different Android devices... What devices do work and which don't? I only have Samsung devices for development, but maybe I can find one of those devices that don't work to test with.

    Another workaround is to show the full keyboard by setting 'Custom' content type in the inspector: KeyboardType: Default and CharacterValidation: Decimal, but this is less user friendly.
     
  32. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    After I removed the file I got the same error

    There are a lot of duplicates symbols for architecture arm64
    duplicate symbol _indexOf In NativeKeyboard.a

    NativeKeyboard.a (UnityCallBack.o)
    NativeKeyboard.a (TextValidator.o)

    duplicate symbol _countOccurences
    NativeKeyboard.a (UnityCallBack.o)
    NativeKeyboard.a (TextValidator.o)

    duplicate symbol _clamp
    NativeKeyboard.a (UnityCallBack.o)
    NativeKeyboard.a (TextValidator.o)

    duplicate symbol _UnityStringFromNSString
    NativeKeyboard.a (UnityCallBack.o)
    NativeKeyboard.a (TextValidator.o)


    SEE ScreenShot .

    I have removed the next files
    - Plugins/Android/TouchScreenKeyboard.aar
    - Plugins/iOS/TouchScreenKeyboard.a
    - Plugins/UWP/UWPKeyboard.pri
    - Plugins/UWP/UWPKeyboard.pdb
    - Plugins/UWP/UWPKeyboard.dll
    - Plugins/Advanced Input Field/Scripts/TouchScreenKeyboard​
     

    Attached Files:

  33. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I tried to reproduce the errors, but couldn't get those errors to appear when building or archiving the iOS app in Xcode. I made a new project in Unity, imported version 1.5 package of the plugin, added the sample scenes to the build settings and made a build for iOS device (also tried archiving). This works for me without errors.

    Perhaps it's a specific Unity or Xcode version that's causing that error.

    I did find a possible problem in the iOS code that could cause errors. So I've rebuild the iOS Native binding file again. See if the attached file fixes it for you (replace it in Assets/Plugins/iOS).
    Otherwise please specify me what version of Unity & Xcode you are using and any custom build settings you have used.
     

    Attached Files:

  34. amtrong318

    amtrong318

    Joined:
    Sep 20, 2017
    Posts:
    6
    Hi
    I purchased this package.
    When I played sample scenes, It is not working.
    In Phone, When I click input field, It never appears keyboard screen.
    So I can't input letters.
    What is wrong?
    I didn't change anything.
     
  35. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hmm, strange.
    I need a little more information to pinpoint the issue.
    What platform are you using? Android, iOS, UWP?
    What is your mobile test device?
    Do you have any bluetooth/hardware keyboard connected to the device? (Maybe it's sending a false positive for a hardware keyboard)
    Does it show the blinking caret after you selected the input field?
     
  36. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Hi, I am sorry but I still have errors.

    XCode Version 9.2 (9C40b)
    Unity Version 2017.3.0f3

    I created a new project import your plugins - everything is WORK )

    But my project isn't compilated.
    I found such flags in BuildSetting -> Other Linker Flags
    $(inherited) -weak_framework CoreMotion -weak-lSystem -ObjC

    The flag "-ObjC" breaks the compilation. If I remove this flag - build compilation is successful.
    I use this flag for GoogleSignIn plugins.
     
  37. amtrong318

    amtrong318

    Joined:
    Sep 20, 2017
    Posts:
    6
    Thanks for your reply.
    I used android platform first.
    and I tested both of Samsung S6 and Nox emulator.
    but When I click input filed, nothing happens.
    Only show the blinking caret.
     
  38. amtrong318

    amtrong318

    Joined:
    Sep 20, 2017
    Posts:
    6
  39. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Please see the PM that I have just send to you.
     
  40. amtrong318

    amtrong318

    Joined:
    Sep 20, 2017
    Posts:
    6
    Hi
    I played Form.apk on my android phone.
    It works good
     
  41. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    OK, will see if I reproduce it that way
     
  42. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    These devices are old Samsung phones that use an old version of Samsung Keyboard.

    Another unrelated issue:
    Do you remember a bug in a previous version where if you left the app open on android and never closed it, and then the phone automatically cleaned memory and then you tried opening the app again it would crash? It's happening again.
     
  43. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    Something very strange is happening in one of my projects. The native keyboard is not showing on iOS. The input fields are there and when I click on them the carat shows normally but the keyboard doesn't appear. The same project works fine on android. The debug logs don't show anything.
    This only happens on this project. Other projects work fine with the same version of the plugin, project settings and compilation settings. I tried everything from tweaking settings to deleting and reinstalling the plugin.
    I'm thinking about creating a new project and importing the assets from the old project to the new one, basically recreating the project. Do you have any ideas before I do this? This issue makes absolutely no sense to me.
     
  44. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I could reproduce the issue with the adding the GoogleSignIn SDK to my test Xcode project. I've modified some of the classes with errors in the native iOS binding to use Objective C style notation and that seems to fix the compiler errors issues in my test project.
    Could you please check if this fixes it for you too?
     

    Attached Files:

  45. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I probably forgot to add the fix for that crash in the new native Android binding (old code for fix should still work I think). I'll add it again in the next release.
     
  46. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Maybe some other plugin is causing conflicts with this plugin. That's usually the first thing I check when I have different behaviour in two similar projects.
     
  47. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    Thank you, please don't forget

    The project doesn't have any other plugins. It only has some sprites and very basic scripts. I will double check and get back to you.
     
  48. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Thank, you so much ;)
    Everything is working ;)
     
  49. fidelsoto

    fidelsoto

    Joined:
    Aug 7, 2012
    Posts:
    87
    I created an empty project, imported Advanced Input Field Plugin, and ran the sample scenes on an iPad 4 mini. The virtual keyboard does not appear. This is very strange as the plugin is working on another project. I don't understand what could be the problem.
    Can I get an older version of the plugin in the meantime?
    Or... is it possible to have a new version with these fixes by monday?
     
    Last edited: Mar 23, 2018
  50. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I've send you a PM