Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard input type customization for SDL2 #2057

Closed
wants to merge 1 commit into from
Closed

Add keyboard input type customization for SDL2 #2057

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 28, 2020

This is the continuation of kivy/kivy#6716. With these changes,
applications using SDL2 as window provider will be able to change the
keyboard input type. This is achieved replacing the default value of
outAttrs.inputType on SDLActivity.java for keyboardInputType.
PythonActivity.java now has changeKeyboard, a function that basically
allows the switching of the input type, modifying keyboardInputType to a
given value. This function is called in Kivy through the android module.

Closes #2015, Fixes #796

This is the continuation of kivy/kivy#6716. With these changes, 
applications using SDL2 as window provider will be able to change the 
keyboard input type. This is achieved replacing the default value of 
outAttrs.inputType on SDLActivity.java for keyboardInputType. 
PythonActivity.java now has changeKeyboard, a function that basically 
allows the switching of the input type, modifying keyboardInputType to a 
given value. This function is called in Kivy through the android module.
@Fak3
Copy link
Contributor

Fak3 commented Feb 3, 2020

Does it fix #796?

@chavarinbonbyn
Copy link

Which version contains the fix ?

@ghost
Copy link
Author

ghost commented Feb 22, 2020

@chavarinbonbyn None yet. It's a work in progress (for more details, see kivy/kivy#6716).

@inclement
Copy link
Member

Thanks, this change seems good, but I'm wary about changing our SDLActivity code because I thought we were nowadays pulling this straight from the SDL project without changes. If we want to modify it, it would be ideal to do so only via the PythonActivity subclass.

Does anyone else have any thoughts about it?

@AndreMiras
Copy link
Member

I didn't realise that, then it's a very valid point.
I think we should clarify by maybe dynamically pulling this code just like we pull other recipe and patch when needed. @inclement would this make sense and how achievable this would be to you?

@inclement
Copy link
Member

It should be pretty straightforward, but I'm not sure what is the "correct" way to do it. That might only be because I haven't looked at it much for a while - I actually thought we were dynamically extracting the SDL2 deps in their entiretly.

@Fak3
Copy link
Contributor

Fak3 commented Mar 30, 2020

The #1779 pr removes SDL files from p4a source, but that pr has not not been merged yet

@inclement
Copy link
Member

Thanks @Fak3, I really am behind!

@ghost
Copy link
Author

ghost commented Mar 30, 2020

Thanks, this change seems good, but I'm wary about changing our SDLActivity code because I thought we were nowadays pulling this straight from the SDL project without changes.

I know it is somehow a breaking change because I modified SDLActivity.

If we want to modify it, it would be ideal to do so only via the PythonActivity subclass.

Do you guys have any suggestion on how to achieve this?

By the way, if you merge this pull request as it is, you'll find some bugs when using it with Kivy. It's described in kivy/kivy#6716 and #2015. The numeric keyboard is working as expected, but any TYPE_CLASS_TEXT keyboard without a PASSWORD variation isn't.

In summary, the bugs are:

  • It seems the predictive text in TYPE_CLASS_TEXT keyboards is not working because of a missing implementation of on_textedit in the TextInput class.

  • In old android versions the app will crash when inserting an emoji, and a tofu appears in newer android versions. It might be a font issue.

@ghost
Copy link
Author

ghost commented Jul 5, 2020

Hello!

I wanted to try a different approach, but I realized the
SDLActivity.java file does not exist (the pull request #2113 is related
to it). In the new approach I tried I still need to modify the
SDLActivity file, so how do I proceed?

@dwmoffatt
Copy link
Contributor

@franccisco What about changing the changeKeyboard in PythonActivity to modify mTextEdit directly instead of it doing a resetInput on it?

In theory, this could work if the changes take effect without needing to do a resetInput on the mTextEdit

@matham
Copy link
Member

matham commented Jan 11, 2021

#2405 can close this?

@AndreMiras
Copy link
Member

Definitely, thanks for the heads up

@AndreMiras AndreMiras closed this Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numeric keyboard doesn't work with SDL2
6 participants