Samsung keyboard doesn't work correctly with TextEditor

When selecting the Samsung keyboard as default keyboard on recent Samsung phones and tablets, trying to enter texts in a JUCE TextEditor will fail. It fails in different ways:
Although backspace usually works, tapping on a character does not show up until you press the Done button. Sometimes, pressing a button on the keyboard makes it press the button left to the button you are pressing. Furthermore, when using voice commands, only the first letter of the word that is spoken is entered in the TextEditor. I don’t really care about the last one, but the others make it unusable on Samsung devices.
When switching to the Google GBoard however, no such problems exist. When the Samsung keyboard goes in a mode that it doesn’t suggest text, it also works ok, so perhaps changing outAttrs.inputType = InputType.TYPE_NULL;
in ComponentPeerView.java
to InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
might work.

EDIT: I did the change to ComponentPeerView.java, copied the file into my project and changed the cpp file to not take the bytecode and now it works on my S9. On the Tab S3, it didn’t work and I had to set it to
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD

3 Likes

This should be integrated into master IMHO since the current support for smart soft keyboards is pretty much broken

This “fix” seems to have a drawback… According to some forums, it works only with latin keyboards.

Anyone overall JUCE has this issue for a while now.
another one of those feedbacks that got lost :slight_smile:

1 Like

That’s a real shame :frowning:

Any updates on this issue? We’ve just had a report from a user on a Samsung A40, saying they are unable to type into a text field which is a JUCE TextEditor.

@ttg did you find a workaround?

Did you try something similar to my patching of adding the not use auto-correct flag?
It might help. if it does, would be nice to share you user’s insights here.

1 Like

Unfortunately that patch does not fix the issue we’re seeing on Samsung phones.

However, I still think it should be merged into JUCE as autocorrect should be off by default IMO.

1 Like

Just to confirm, the issue is with the default Samsung keyboard. Installing Gboard from Google Play and using that as the default keyboard fixes the issue.

Any updates on this issue? I got a tip off that it might have been fixed in JUCE 6.0.5, but alas no. I want to be sure there isn’t a fix around in JUCE before embarking on using native Android text input fields and JNI to workaround the issue.

Sorry, I’m fixing some other issues so I can’t take a look at this at the moment. I’m not aware of any changes that have been made in this area in the last few months.

1 Like

Ok, thanks for the update!

On Android, Wotja avoids these problems by specifically displaying our own Text Editor native Java Activity (rather than using the built-in Juce text editor).

HTH, Pete

1 Like

I ended up with a rather convoluted hack, involving ComponentListeners on TextEditors, a custom app Activity, and various JNI and Java methods to create and manage native Android TextEdit components on top of the JUCE ones, with callbacks to send the text from Java to C++. It’s ugly but it works. It also has the advantage of looking and behaving like a native text field.

2 Likes

Yeah, that is basically what I did :slight_smile:

I’d hope that at some point the Juce team might provide a better implementation.

The same sort of issue applies if you want to use the CodeEditorComponent on Android.

2 Likes

I have a similar issue with my own custom framework (not using JUCE).

I capture soft keyboard input through onKeyDown() in my implementation of GL2JNIView. Then I forward the character through JNI to my C++ UI framework.

On some devices (Samsung A20e for example), letters don’t show up when typing them. But if I hit for example a ‘.’ after a character, it makes the character appear. Backspace works as well.

I experienced the same issue testing on a Xiaomi phone a couple of years ago.

If you find the root of the issue I’m very interested to know what it is.