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

refactor(android): keyboard handling for TextField and TextArea #11662

Merged
merged 4 commits into from Jul 14, 2020

Conversation

jquick-axway
Copy link
Contributor

@jquick-axway jquick-axway commented Apr 28, 2020

JIRA:

Summary:

  • TIMOB-27616 TextField/TextArea with decimal keyboard type only supports period '.' for decimal point.
    • Added support for localized decimal separator such as comma ',' and Arabic decimal.
    • Was a bug on Google's end. Solved by writing custom DecimalPadKeyListener class.
  • TIMOB-27869 KEYBOARD_TYPE_ASCII should not allow emoji like iOS.
    • Emoji are now filtered-out when user attempts to enter them or paste them.
  • TIMOB-27870 KEYBOARD_TYPE_NUMBERS_PUNCTUATION should allow all chars except emoji like iOS.
    • Android used to not allow any letters of any language to be entered. Now allows all characters except emoji. If you only want decimal numbers, then use KEYBOARD_TYPE_DECIMAL_PAD instead.
    • On iOS, this type works just like ASCII keyboard type. The only difference is which side of the keyboard is 1st shown when keyboard pops-up.
  • TIMOB-27871 Setting TextField or TextArea property "editable" to false should allow user to copy text to clipboard.
    • Only supported on Android 5.0 and above. (Android 4.4 has bugs on Google's end when toggling the "editable" property.)

Localized Decimal Separator Test:

  1. Follow the test procedure shown in TIMOB-27616.
  2. Verify you can enter a comma ',' for decimal separator when using a European locale.

The Big Test:

  1. Build and run TextFieldKeyboardAdvancedTest.js attached to TIMOB-27616 on Android.
  2. Tap on the "Show Text Inputs" button at the bottom of the window.
  3. Tap on the ASCII field.
  4. Verify that you can enter letters, numbers, and punctuation.
  5. Attempt to enter emoji into the field. (They should be blocked.)
  6. Tap on the DECIMAL_PAD field.
  7. Verify that you enter -123.456 for English locale.
  8. Tap on the DEFAULT field.
  9. Verify that you can enter any character, including emoji.
  10. Tap on the NUMBERS_PUNCTUATION field.
  11. Verify that you can enter letters, numbers, and punctuation.
  12. Attempt to enter emoji into the field. (They should be blocked.)
  13. Tap the Back button.
  14. Tap on the "Editable" switch to disable it. (Makes fields read-only.)
  15. Tap on the "Show Text Inputs" button.
  16. Verify that you cannot enter text into any of the fields.
  17. Hold your finger on the text in 1 of the fields until a clipboard popup appears.
  18. Verify that "Cut" and "Paste" do not work. (This is good since fields are read-only.)
  19. Tap on the "Copy" option.
  20. Tap on the Back button.
  21. Tap on the "Editable" switch to re-enable it.
  22. Tap on the "Show Text Inputs" button.
  23. Hold your finger on a field and attempt to paste last copied text.
  24. Tap on the Back button.
  25. Tap on the "Max Length" button.
  26. Select 5 for the max length.
  27. Tap on the "Show Text Inputs" button.
  28. Verify that you cannot enter more than 5 characters in all fields. (Note that 1 emoji character counts as 2 characters.)
  29. Tap the Back button.
  30. Tap on the "Password Mask" switch to enable it.
  31. Tap on the "Show Text Inputs" button.
  32. Verify that all fields are password masked.
  33. Rotate to landscape.
  34. Tap on each field and verify that they are still password masked. (Note that some fields will be shown fullscreen, some won't. This is okay.)

- TIMOB-27616: Decimal keyboard type only allows period for decimal point. Ignores current locale.
  * Added localized decimal separator support such as comma and Arabic's unicode separator.
- TIMOB-27869: KEYBOARD_TYPE_ASCII should filter out emoji like iOS.
- TIMOB-27870: KEYBOARD_TYPE_NUMBERS_PUNCTUATION should allow all chars except emoji like iOS.
  * Used to not allow letters of any language. Now supports all characters except emoji.
- TIMOB-27871: Setting TextField/TextArea "editable" to false should allow user to copy text to clipboard.
  * Supported on Android 5.0 and higher. (Has issues on Android 4.4 when dynamically toggling "editable" property.)
- Updated API docs to better clarify how keyboard types should work.
@build
Copy link
Contributor

build commented Apr 28, 2020

Warnings
⚠️

Commit c3133c8635954b2efd5551b7ef5b1c5430178a44 has a message "refactor(android): keyboard handling for TextField and TextArea

  • TIMOB-27616: Decimal keyboard type only allows period for decimal point. Ignores current locale.
    • Added localized decimal separator support such as comma and Arabic's unicode separator.
  • TIMOB-27869: KEYBOARD_TYPE_ASCII should filter out emoji like iOS.
  • TIMOB-27870: KEYBOARD_TYPE_NUMBERS_PUNCTUATION should allow all chars except emoji like iOS.
    • Used to not allow letters of any language. Now supports all characters except emoji.
  • TIMOB-27871: Setting TextField/TextArea "editable" to false should allow user to copy text to clipboard.
    • Supported on Android 5.0 and higher. (Has issues on Android 4.4 when dynamically toggling "editable" property.)
  • Updated API docs to better clarify how keyboard types should work." giving 1 errors:
  • body's lines must not be longer than 100 characters
Messages
📖

💾 Here's the generated SDK zipfile.

📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖

✅ All tests are passing
Nice one! All 6694 tests are passing.
(There are 698 skipped tests not included in that total)

Generated by 🚫 dangerJS against 8f61e59

Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FR Passed, tested with the following test cases/scenarios.

Test Cases:
TIMOB-27616
Able to follow above instructions with no issues.

TIMOB-27869:
Now unable to enter emojis when using a KEYBOARD_TYPE_ASCII keyboard:

var window = Ti.UI.createWindow();
window.add(Ti.UI.createTextField({
	keyboardType: Ti.UI.KEYBOARD_TYPE_ASCII,
	width: "90%",
}));
window.open();

TIMOB-27870:
Now able to use characters from other languages while still not being able to use emojis when using the KEYBOARD_TYPE_NUMBERS_PUNCTUATION keyboard

var window = Ti.UI.createWindow();
window.add(Ti.UI.createTextField({
keyboardType: Ti.UI.KEYBOARD_TYPE_NUMBERS_PUNCTUATION,
width: "90%",
}));
window.open();

TIMOB-27871
Able to copy text even if the editable property is set to false

var window = Ti.UI.createWindow();
window.add(Ti.UI.createTextField({
	keyboardType: Ti.UI.KEYBOARD_TYPE_NUMBERS_PUNCTUATION,
	width: "90%",
  value: 'Copy me',
  editable: false,
}));
window.open();

Localized Decimal Separator Test: TIMOB-27616
Able to now use a ',' as a decimal locator when changing locale, in this case locale was changed to Dansk. Locale can be changed from the android keyboard settings.

Test Environment

MacOS Big Sur: 11.0 Beta
Xcode: 12.0 Beta 
Java Version: 1.8.0_242
Android NDK: 21.3.6528147
Node.js: 12.18.1
""NPM":"5.0.0","CLI":"8.0.0""
API29 Pixel XL emulator

@ssjsamir
Copy link
Contributor

@jquick-axway In the last step you mention (Note that some fields will be shown fullscreen, some won't. This is okay.) Is this the case here?
Screenshot 2020-07-13 at 15 45 35

@jquick-axway
Copy link
Contributor Author

@ssjsamir, we disable "fullscreen" editing with password mask using:

  • KEYBOARD_TYPE_ASCII
  • KEYBOARD_TYPE_URL
  • KEYBOARD_TYPE_PHONE_PAD
  • KEYBOARD_TYPE_EMAIL
  • KEYBOARD_TYPE_DECIMAL_PAD
    • If no password mask, we disable fullscreen for locales NOT using '.' for decimal too.

The reason we disable fullscreen editing is to work-around bugs on Google's end. Google will show the wrong virtual keyboard (or it'll have missing important keys) when fullscreen.

@sgtcoolguy sgtcoolguy merged commit c8cab5a into tidev:master Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants