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
[TIMOB-25882] Android: return event is received twice from Symbol TC55/TC70 scanner. #9948
Conversation
I'm not sure if I understand. Do you mean actual scanning software that reads texts via the mobile device's camera and outputs it to the app's TextField? And this issue only happens with Motorola Symbol phones? If so, then I would assume its simulating key events via software. How were you able to test this? |
I was not able to test the exact scenario as the one described in the ticket's comment. Apparently these devices have an embedded scanner that can be set up by third party software. I don't like what I did in this PR and IMO this is something that is hard to be universally solved, because different configuration of such scanners' input may result in different events and their handling. A better approach for me would be to propagate whatever the Android triggers to the JS, but that will most likely cause disparity for the event and we don't want that. |
Thanks for the explanation. It looks like PR #9652 is the one that changed this behavior. Can you do a quick test with that PR's code as well? If it passes, then yeah, let's go with your change. |
@jquick-axway Tried the test case from #9652 with software keyboard and bluetooth keyboard both on landscape and portrait modes - the event is fired only once as expected. |
//one of the two callbacks, and the next checks deal with 'Next' and 'Done' callbacks, respectively. | ||
//Refer to TiUIText.handleReturnKeyType(int) for a list of return keys that are mapped to EditorInfo.IME_ACTION_NEXT and EditorInfo.IME_ACTION_DONE. | ||
if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) { | ||
if (tv.getMaxLines() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use the this.field
property like in the other PR.
The rest looks fine.
@jquick-axway Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Pass
FR Passed. Studio Ver: 5.1.0 |
Generated by 🚫 dangerJS |
…5/TC70 scanner. (tidev#9948) * Prevent double onActionEditor call from simulated enter key. * Change check for TextField. * Forgot the 'this'.
…5/TC70 scanner. (tidev#9948) * Prevent double onActionEditor call from simulated enter key. * Change check for TextField. * Forgot the 'this'.
JIRA: https://jira.appcelerator.org/browse/TIMOB-25882
NOTE: This PR relies on #9933 to be merged first.
Description:
As far as I understood/researched and tested the scanner simulates a keyboard for the input and sends an enter key pressed event.
onActionEditor
is called with actionID equal toTYPE_NULL
and once for every keyEvent action - ACTION_UP and ACTION_DOWN. If the first call is marked as not consumed (the method call returns false) the second one is not triggered. I am not certain why it is handled that way and most likely it is bubbled up to something that prevents the second call. This seems to be the case regardless of the IME_ACTION for the TextField. I was not able to think of a cleaner solution that would cover the cases.I don't think should be labeled as a bug or improvement, because it has the same behavior in native Android as well. We are doing some of the filtering of the events under the hood.