britzl / gooey

Defold GUI system
MIT License
150 stars 22 forks source link

Non-native feel on backspace on inputs, Android #17

Closed karlmacklin closed 6 years ago

karlmacklin commented 6 years ago

My Galaxy S7 is on Android 7.0. Trying the example project in the repo, using kenneyblue, and testing the input.

When focusing on the input text, my phone's keyboard pops up. Writing text works fine. When pressing the backspace button on the keyboard, I have to hold it down to make it remove characters. A single tap on backspace does not register "long enough" for it to remove any text.

Reproduce:

Expected:

Actual:

britzl commented 6 years ago

Hmm, odd, it works perfectly fine on my HTC One M9 with Android 7.0. Using HTC Sense Input.

I assume you have a key-backspace Key Trigger in your input bindings (I guess you did, otherwise it shouldn't work at all)?

What settings do you have on Input repeat delay and interval? (although that should only affect how the input field behaves when keeping it pressed)

karlmacklin commented 6 years ago

Is that a setting in Android you mean? If in Defold, whatever the example project is using.

I'm using Swiftkeyboard in Android, and switching to Samsung keyboard stops the issue. My initial description is a bit off I realize after my new testing.

The way Swiftkeyboard seems to act is like this:

Type 1 letter Hit backspace once, nothing happens Hit once again, it removes the letter

Type 3 letters, Hit backspace three times, nothing happens Fourth time, it removes one of the letters, and consecutive backspace hits continue to remove letters.

So, it's as if it builds up a buffer of needed backspace its that is equivalent to the amount of characters input. That is why I first thought it requires me to hold down backspace to delete at all, which is not the case.

Some type of ghost field or something? I haven't done enough input testing on different games on the phone to see if this is a common thing with Swiftkeyboard, but I'd attribute it to that at least and not any issue with Gooey/Defold.

Unless you have a followup idea of something else to test, feel free to close!

britzl commented 6 years ago

This sounds like there's some issue with how input.marked_text is handled. I'll install SwiftKeyboard and take a look.

britzl commented 6 years ago

Ok, I found the reason. Make sure to go into game.project and select HiddenInputField as the Input Method in the Android section. The KeyEvent option which is default is the old way of handling input on Android.

karlmacklin commented 6 years ago

I tried this, and initially I thought it worked fine.

However, in my example, I have a gooey text input that I fill with text (and successfully can backspace within now).

With KeyEvent way, the default one, let me do the following: With the keyboard up and typing into the field, I could press a gui button I have that is coded like this:

in init function: input = kenneyblue.input("input", gui.KEYBOARD_TYPE_DEFAULT, nil, { x=0, y=0 }, { empty_text = "EMPTY, MAX 8 CHARS" })

on_input:

spaceshooter.spacebutton("createbtn", action_id, action, function(button)
  local success = profilehandler.create_profile(input.text)
  refresh_gui()
end)

The input.text there gets the input data from the text field correctly.

With the new HiddenInputField, the input.text is empty, until I press enter on the swiftkey keyboard.

Perhaps this is expected, but I'm not sure how to tell the keyboard to commit the text so to say, from Defold, if even possible?