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

OK in DPAD center not working on TCL Flip 2 #182

Closed
AF1512 opened this issue Feb 12, 2023 · 21 comments · Fixed by #194 or #222
Closed

OK in DPAD center not working on TCL Flip 2 #182

AF1512 opened this issue Feb 12, 2023 · 21 comments · Fixed by #194 or #222
Assignees
Labels
bug Something isn't working device hack A device bug that requires a hack on our side

Comments

@AF1512
Copy link

AF1512 commented Feb 12, 2023

I'm using the TCL Flip 2 4058W and the OK button doesn't work in the messages app, for example it selects the word but then won't send the text, though in some other apps it does.

@sspanak
Copy link
Owner

sspanak commented Feb 13, 2023

I works properly in the apps that accept a default action for this key, but unfortunatelly, many apps do not.

I guess, this is mostly an issue in messaging apps. Me too, I would want to fix it only for a predefined list of the most popular apps (Telegram, Messenger, Whatsup and whatnot) and make the key perform the "SEND" action. Detecting the application and checking if it is in the list is easy (the name is in EditorInfo.packageName), but I haven't found a way of forcing an action.

Any help with this will be appreciated.

@sspanak sspanak added help wanted Extra attention is needed bug Something isn't working labels Feb 13, 2023
@AF1512
Copy link
Author

AF1512 commented Feb 13, 2023 via email

@justbruce
Copy link
Contributor

WhatsApp and Signal both have settings on the Android versions that allow you to send a message with the ENTER key.

Signal has it disabled by default, and it seems to vary by manufacturer and client version with WhatsApp whether it is enabled or disabled by default.

Might narrow down your research space.

@sspanak
Copy link
Owner

sspanak commented Feb 16, 2023

I did a quick research and according to this link, there is literally nothing to do if the application does not want to process the key press event.

So how does the default IME support the SEND function if the app itself
doesn't support default action, there must be a way for an IME to send the
SEND command

I suppose the default IME emulates ENTER key press (the one on computer keyboards), instead of OK key press (the one on most phones) or it is a custom action. Currently, TT9 does not work with custom actions and does not send ENTER if there is no default action. I could try one of these or both, when in a non-specialized text field (this is important!). But beyond that, I'm affraid, nothing else is possible.

@AF1512
Copy link
Author

AF1512 commented Feb 17, 2023

I connected the phone to scrpcy and was able to type using my keyboard and the ENTER key doesn't do anything (newline is SHIFT+ENTER) so it must be a custom action, but I don't know much about that.

@AshiVered
Copy link
Contributor

This bug is also in Qin1S+. But, a long press on the center, functions as send

@justbruce
Copy link
Contributor

I've just learned that on the S22 Flip, there is a translation layer always running (except when it crashes, which is how I found out it existed at all) for the hardware keys. It might be possible that the same thing is happening on other phones, which might explain all the varied types of behaviors being observed.

@sspanak sspanak removed the help wanted Extra attention is needed label Feb 21, 2023
@sspanak
Copy link
Owner

sspanak commented Feb 21, 2023

Thanks everyone for the comments. You gave me some ideas and I've found a way to make OK work at least as good as in Gboard or OpenBoard. Still, some applications such as Messenger refuse to send when the button is pressed, but I don't think anyone can do anything about it.

@sspanak sspanak self-assigned this Feb 23, 2023
@sspanak
Copy link
Owner

sspanak commented Feb 23, 2023

I have released beta-17.4 which fixes the problem. Note that in messaging applications "send with ENTER" must be enabled, otherwise they just ignore OK key. Try it out!

@SZRabinowitz
Copy link

SZRabinowitz commented Mar 9, 2023

In the TCL Flip 2 SMS app, even the newer version doesn't work. this can be bypassed by pressing options, then send. just a bit annoying.

I will try mapping another key instead of the OK key and see if that helps.

@SZRabinowitz
Copy link

@sspanak if you can point me to the the code responsible for that it would be amazing. thanks.

@sspanak
Copy link
Owner

sspanak commented Mar 13, 2023

@biden2020prez, this is not a bug. The default SMS application on Android (and some other apps as well) actually request the keyboards not to send anything with OK or ENTER, so I decided to honor the setting and disabled sending in such cases.

In other words, it is what the applications author wanted. It may be inconvenient in some cases, but it may be a good idea to save the user form a mishap in others. It depends.

Of course, it is possible to ignore the app request, but I haven't considered such option in TT9 so far.

@DarthFlip
Copy link
Contributor

I have solved this issue for this phone specifically by changing line 619 in TraditionalT9.java from sendDownUpKeyEvents(KeyEvent.KEYCODE_ENTER); to sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER);

@SZRabinowitz
Copy link

@DarthFlip Nice job! I think that was a bug fix for the Cat S22 Flip, which couldn't select words with the D-Pad.

Good catch. Now we need to make it a setting probably. I wonder if I can figure out how.

@sspanak
Copy link
Owner

sspanak commented Mar 15, 2023

OK, I am reopening this as it seems the issues still persists in some cases. Android is really confusing with all these alternative keys having almost similar, but not exactly the same functions. I may have gotten it wrong again.

Now we need to make it a setting probably. I wonder if I can figure out how.

This must not be a setting. The OK key must just work by sending the correct key code. Or maybe it should send both DPAD_CENTER and ENTER in order to cover all cases... I really don't know... 😄

I think that was a bug fix for the Cat S22 Flip, which couldn't select words with the D-Pad.

The code there has nothing to do with selecting the suggestions.

@sspanak sspanak reopened this Mar 15, 2023
@sspanak
Copy link
Owner

sspanak commented Mar 15, 2023

@biden2020prez, @DarthFlip, could you please try out this APK and let me know if OK is working for you?

@DarthFlip
Copy link
Contributor

Still doesnt work to send text message by clicking Dpad Center. It works fine (and always has worked fine) for selecting things.
What did you change? When I made

changing line 619 in TraditionalT9.java from sendDownUpKeyEvents(KeyEvent.KEYCODE_ENTER); to sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_CENTER);

It worked fine to send messages.
I didn't go through all the code but can it just be switched to DPAD_CENTER ?

Or maybe it should send both DPAD_CENTER and ENTER in order to cover all cases...

You could try that, would it potentially cause a double click?

@sspanak
Copy link
Owner

sspanak commented Mar 15, 2023

What did you change?

I ignored the application request to disable the key. Now OK always performs the target action and on my phone it is able to send an SMS.

But if this doesn't work for you, it means your SMS app works differently. It only relies on receiving the DPAD_CENTER key code.

I wish it was as simple as replacing the key code, but the problem is, using ENTER instead of DPAD_CENTER breaks sending messages in common apps like Viber, Telegram and likely WhatsApp. And I don't want to risk sending both, because it may indeed cause double click.

This is tricky. I see these possible solutions:

  1. Leave it as it is. Virtually no one that I know sends SMS anymore, including myself, so a slight inconvenince for a very rarely used function is not a big deal.
  2. Pressing OK works like now (ENTER), but holding would force any defined action, or if the app reports no action, send DPAD_CENTER. There will be a setting for controlling this behavior called "Force Send Messages" and located on the Hotkey screen. The possible options would be: no key (default), hold OK, F1, F2, ... or other unassigned special keys (only available on some phones).

I don't want to make force sending the default action for holding OK, because it may be used for something else in the future.

I am also open for alternative ideas, if you have any.

@SZRabinowitz
Copy link

SZRabinowitz commented Mar 15, 2023

@sspanak I like your idea of long press. But why not make it a setting to choose a different keycode for long press and short press?

I know many people who send SMS. Keep in mind you are developing for keypad phones with touchscreen, but many people use this on old phones with no touchscreen.

But I guess it would be nice to confirm whether or not it works on other phone's SMS app.

@sspanak
Copy link
Owner

sspanak commented Mar 17, 2023

@biden2020prez , @DarthFlip , I've come up with a hack to send both DPAD_CENTER and ENTER without causing a double click (hopefully!). Could you please double check if this APK allows sending SMS on your phones?

@AF1512
Copy link
Author

AF1512 commented Mar 17, 2023

Works fine, thanks!

@sspanak sspanak added the device hack A device bug that requires a hack on our side label Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working device hack A device bug that requires a hack on our side
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants