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

Android: SDLActivity (Java) key & edit events under API 33 (TIRAMISU) #6170

Closed
312937 opened this issue Sep 2, 2022 · 8 comments
Closed
Assignees
Labels
waiting Waiting on user response
Milestone

Comments

@312937
Copy link

312937 commented Sep 2, 2022

I'd like to suggest at least one change to the class DummyEdit:

  1. @lines 1863++

CURRENT

public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    ic = new SDLInputConnection(this, true);
    
    outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
    outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
            | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;

    return ic;
}

MODIFIED

public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    ic = new SDLInputConnection(this, true);
    
    outAttrs.inputType = InputType.TYPE_CLASS_TEXT;
    outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
            | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;
    
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
        outAttrs.imeOptions |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
    }

    return ic;
}
  1. I might suggest more modifications but they seem quite specific (personal/individual choice):

     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
         outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_PERSONALIZED_LEARNING;
     }
    

... and respectively (@line 1867):

    outAttrs.inputType = (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
            & ~(InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
  1. Further, the declaration @line 209 might be improved:
  • protected static DummyEdit mTextEdit;

DummyEdit instead of View.

All the proposed modifications have already been verified.

Ad 1)
The (TIRAMISU) trouble arises in SDLInputConnection.commitText(...) which provides (let's say) 'separated text chunks' (discarding the context on each EOL).

Many thanks for you great work!

@slouken slouken closed this as completed in 6acc7a5 Oct 1, 2022
@slouken
Copy link
Collaborator

slouken commented Oct 1, 2022

I think this takes care of the big issues, yes?

@312937
Copy link
Author

312937 commented Oct 10, 2022

I apologize for a very late response.
Following is somehow a recommended quick-fix to a trouble under Tiramisu:

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
        outAttrs.imeOptions |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
    }

The rest is surely only an optional discussion.

@slouken
Copy link
Collaborator

slouken commented Oct 10, 2022

So we are setting the inputType to InputType.TYPE_TEXT_FLAG_MULTI_LINE, and I don't see any documentation for EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE. Can you check the current main code and see if that works, and if it doesn't, can you please provide more information on this option and why it's necessary?

@slouken slouken reopened this Oct 10, 2022
@slouken slouken self-assigned this Oct 10, 2022
@slouken slouken added this to the 2.26.0 milestone Oct 10, 2022
@slouken slouken added the waiting Waiting on user response label Oct 10, 2022
@312937
Copy link
Author

312937 commented Oct 10, 2022

The current main did not work (Tiramisu). I treat 2.24.0 as current for Android. Up to my knowledge, there were no changes between 2.24.0 and 2.24.1 in the android-project subfolder.
The trouble appeared while testing under Tiramisu (API 33 in Emulator).
I patched all my apps (in the store) with the described fix (after some debugging). Thus, I'm using the fix in the field now.
I'll provide you the link to one app with a promotion code via another channel (where I reported SDL2 2.0.16 bug while drawing rectangles about a year ago). I'd like to avoid promoting my apps via this (your) platform.

@slouken
Copy link
Collaborator

slouken commented Oct 10, 2022

You don't need to provide a link to your app, I was hoping for a link to the documentation for the option that you're setting.

So, just to be clear, you tested SDL 2.25.0 with change 6acc7a5, and it did not work in the Tiramisu emulator, is that correct?
Here's a zip file you can download if you haven't already tested this commit:
https://www.libsdl.org/tmp/SDL-2.0.zip

@312937
Copy link
Author

312937 commented Oct 11, 2022

I'm sorry. I have (completely) misunderstood you (with current). I'll verify (main ~ 2.25.0) immediately and let you know.

@312937
Copy link
Author

312937 commented Oct 11, 2022

It seems "to work for me" (if I didn't make any mistake during the build).

Roughly verified the key input issues (main '2.25.0' SHA 4227a0b) under Android emulator:

  • API 33
  • API 28

PS.

  1. I had a typo in my description imeOptions instead of inputType.
  2. Sorry for the misunderstanding.

@slouken
Copy link
Collaborator

slouken commented Oct 11, 2022

Great, thanks!

@slouken slouken closed this as completed Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting on user response
Projects
None yet
Development

No branches or pull requests

2 participants