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

change(android,web) Use web-based popup key longpresses #9591

Merged
merged 9 commits into from
Sep 22, 2023

Conversation

darcywong00
Copy link
Contributor

@darcywong00 darcywong00 commented Sep 19, 2023

Addresses part of #9573 and fixes #9499

This updates Keyman Engine for Android to match iOS using KeymanWeb for handling longpresses.
The longpress keys will be limited by the top of the banner/OSK.

KeymanWeb changes

  • Remove Android-specific portions of buildEmbeddedGestureConfig and pendingLongpress

Keyman Engine for Android changes

  • Remove native Java code for popup, preview, and longpresses keys, as it's handled in KeymanWeb.

Note: this means banner will always be visible on Android, no option to switch off banner any more.

This portion of #9573 will be addressed on a separate PR. Android will possibly need some image banners to display when predictions are disabled.

User Testing

Setup - Install the PR build of Keyman for Android on an Android device emulator. In the Keyman app, also install the IPA (SIL) keyboard

  1. Install the PR build of Keyman for Android on an Android device/emulator
  2. Open Keyman In-App and dismiss the "Get Started" menu
  3. Switch to IPA (SIL) keyboard in the Keyman App
  4. Click the Number (123) key
  5. Long press [ key
  6. From the longpress options, select < special character
  7. Verify the < symbol appears on the screen.
  • TEST_ANDROID_INAPP - Verifies longpresses and globe key work in the Keyman app
  1. Install the PR build of Keyman for Android on an Android device/emulator
  2. Open Keyman In-App and select sil_eurolatin keyboard
  3. On the default sil_eurolatin keyboard, briefly press a top row key and release
  4. Verify the key preview briefly appears, and the selected key is output
  5. Longpress on a top row key and hold
  6. Verify the longpress keys appear (position limited to the top of the banner)
  7. Select a longpress key and release
  8. Verify the selected key is output
  9. Short-press the globe key
  10. Verify the Keyman keyboard switches to IPA (SIL) keyboard
  11. Long-press the globe key and release
  12. Verify the keyboard picker menu appears.
  13. Select a keyboard
  14. Verify Keyman switches to the selected keyboard
  • TEST_ANDROID_SYSTEM_LONGPRESSES - Verifies longpresses and globe key work as a system keyboard
  1. Install the PR build of Keyman for Android on an Android device/emulator
  2. Open Keyman In-App and select the "Get Started" menu
  3. Enable Keyman as a system keyboard and set as default keyboard
  4. Launch a separate app (e.g. Chrome browser) and select a text area
  5. With default Keyman sil_eurolatin keyboard, briefly press a top row key and release
  6. Verify the key preview briefly appears, and the selected key is output
  7. Longpress on a top row key and hold
  8. Verify the longpress keys appear (position limited to the top of the banner)
  9. Select a longpress key and release
  10. Verify the selected key is output
  11. Short-press the globe key
  12. Verify the Keyman keyboard switches to IPA (SIL) keyboard
  13. Long-press the globe key and release
  14. Verify the keyboard picker menu appears.
  15. Select a keyboard
  16. Verify Keyman switches to the selected keyboard
  • TEST_IOS_INAPP - Verifies longpresses key works in the Keyman for iPhone and iPad app
  1. Install the PR build of Keyman for iPhone and iPad on an iOS device/emulator
  2. Open Keyman In-App and select sil_eurolatin keyboard
  3. On the default sil_eurolatin keyboard, briefly press a top row key and release
  4. Verify the key preview briefly appears, and the selected key is output
  5. Longpress on a top row key and hold
  6. Verify the longpress keys appear (position limited to the top of the banner)
  7. Select a longpress key and release
  8. Verify the selected key is output

@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels Sep 19, 2023
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Sep 19, 2023

User Test Results

Test specification and instructions

  • TEST_IPA_RENDERING (PASSED): Tested in Android 12.0 / API31 emulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on an Android emulator. 2. Switched to IPA (SIL) keyboard in the Keyman In-App. 3. Verified that the < symbol appears on the text input screen after selecting it from the long-press options. Seems to be working as expected. (notes)
  • TEST_ANDROID_INAPP (PASSED): Tested in Android 12.0 / API31 emulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on an Android emulator. 2. Verified that the long press key on the top row is working as expected for sil_eurolatin keyboard. 3. Verified that the keyboard has been changed to IPA (SIL) after short-press and releasing the globe key. 4. Also, verified that the keyboard picker menu appears, after long press and release of the globe key. Able to switch to some other keyboard from the Keyboard picker menu. Seems to be working as expected. (notes)
  • TEST_ANDROID_SYSTEM_LONGPRESSES (PASSED): Tested in Android 12.0 / API31 emulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on an Android emulator. 2. Enabled Keyman as the default keyboard using Get started dialog. Opened Chrome browser. Verified that the long press key on the top row is working as expected for the sil_eurolatin keyboard. 3. Verified that the keyboard has been changed to IPA (SIL) after short-press and releasing the globe key. 4. Also, verified that the keyboard picker menu appears, after long press and release of the globe key. Able to switch to some other keyboard from the Keyboard picker menu. Seems to be working as expected. (notes)
  • TEST_IOS_INAPP (PASSED): Tested in iPhone 13 Pro Max / iOS 15.0 simulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on iPhone Simulator. 2. Switched to sil_eurolatin keyboard in the Keyman In-App. 3. Verified that the key preview briefly appears after briefly pressing a top row key and release. 4. Verified that the selected key appeared on the screen after selecting it from the longpress options. Seems to be working as expected. (notes)

Test Artifacts

@@ -490,7 +490,7 @@ div.android div.kmw-keytip-cap {
.tablet.ios #kmw-popup-keys .kmw-key{border:none;}
.phone.ios #kmw-popup-keys .kmw-key{border:none;}

.phone.android #kmw-popup-keys {border:none; border-radius: 2px; background-color:#ccc; padding:5px 5px 0 0;}
.phone.android #kmw-popup-keys {border:none; border-radius: 2px; background-color:#333333; padding:5px 5px 0 0;}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Longpress background styling to match the current background from

<color name="key_preview_bg2">#ff333333</color>

@darcywong00 darcywong00 marked this pull request as ready for review September 19, 2023 06:27

public resolve() {
if(this.resolver) {
this.resolver(new SubkeyDelegator(this.vkbd, this.baseKey));
Copy link
Contributor

Choose a reason for hiding this comment

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

SubkeyDelegator may be removed as well; it's used exclusively as a follow-up to this class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, I still had to keep SubkeyDelegator for

let gesture = osk.vkbd.subkeyGesture as SubkeyDelegator;

Copy link
Contributor

@jahorton jahorton Sep 19, 2023

Choose a reason for hiding this comment

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

Right, which is within the executePopupKey method. Which is no longer being called, correct?

... which means we could probably eliminate the whole executePopupKey method, while we're at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought both iOS and Android will still need KeymanWeb to handle executePopupKey.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotcha. I was able to remove popVisible (it had the same gesture)

Copy link
Contributor

@jahorton jahorton Sep 19, 2023

Choose a reason for hiding this comment

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

I thought both iOS and Android will still need KeymanWeb to handle executePopupKey.

Ah, I get that. Yeah, we did leave the Swift connections to it in place, since back when we moved iOS to rely on the WebView, we were hoping Apple would fix the motivating bug so that we could revert to the same strategy Android's been using. Didn't happen, though, and we never revisited to clean out the old code. Probably worth making into a cleanup issue.

web/src/app/webview/src/keymanEngine.ts Outdated Show resolved Hide resolved
Comment on lines -323 to -328
function executePopupKey(keyID, keyText) {
// KMW only needs keyID to process the popup key. keyText merely logged to console
//window.console.log('executePopupKey('+keyID+'); keyText: ' + keyText);
keyman.executePopupKey(keyID);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Re: a recent comment in one of the other threads.

@darcywong00
Copy link
Contributor Author

@bharanidharanj - please hold off on user testing until reviewers approve changes. Thanks

Copy link
Contributor

@jahorton jahorton left a comment

Choose a reason for hiding this comment

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

I'm satisfied with the fixes to my requests for changes at this point.

Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

Changes LGTM. Minor suggestions.

@@ -46,34 +45,5 @@ export function buildEmbeddedGestureConfig(device: DeviceSpec) {
}
}

if(device.OS == DeviceSpec.OperatingSystem.Android) {
embeddedGestureConfig.createKeyTip = (vkbd) => {
Copy link
Member

Choose a reason for hiding this comment

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

createKeyTip and startLongpress should be removed from EmbeddedGestureConfig.

I also think that the globe hint should be reimplemented in KeymanWeb, so we don't need any of this glue, and so it can be themed later. (This can be a separate pull)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

createKeyTip is used in oskView and visualKeyboard
startLongpress is used in visualKeyboard

@jahorton good with removing these?


globe hint split into separate issue #9596

Copy link
Contributor Author

Choose a reason for hiding this comment

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

createKeyTip and startLongpress should be removed from EmbeddedGestureConfig.

EmbeddedGestureConfig cleanup in 98660fe

@bharanidharanj
Copy link

bharanidharanj commented Sep 21, 2023

  • TEST_ANDROID_INAPP (PASSED): Tested in Android 12.0 / API31 emulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on an Android emulator. 2. Verified that the long press key on the top row is working as expected for sil_eurolatin keyboard. 3. Verified that the keyboard has been changed to IPA (SIL) after short-press and releasing the globe key. 4. Also, verified that the keyboard picker menu appears, after long press and release of the globe key. Able to switch to some other keyboard from the Keyboard picker menu. Seems to be working as expected.

@bharanidharanj
Copy link

  • TEST_ANDROID_SYSTEM_LONGPRESSES (PASSED): Tested in Android 12.0 / API31 emulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on an Android emulator. 2. Enabled Keyman as the default keyboard using Get started dialog. Opened Chrome browser. Verified that the long press key on the top row is working as expected for the sil_eurolatin keyboard. 3. Verified that the keyboard has been changed to IPA (SIL) after short-press and releasing the globe key. 4. Also, verified that the keyboard picker menu appears, after long press and release of the globe key. Able to switch to some other keyboard from the Keyboard picker menu. Seems to be working as expected.

@bharanidharanj
Copy link

  • TEST_IPA_RENDERING (PASSED): Tested in Android 12.0 / API31 emulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on an Android emulator. 2. Switched to IPA (SIL) keyboard in the Keyman In-App. 3. Verified that the < symbol appears on the text input screen after selecting it from the long-press options. Seems to be working as expected.

@bharanidharanj
Copy link

Test Results

  • TEST_IOS_INAPP (PASSED): Tested in iPhone 13 Pro Max / iOS 15.0 simulator and here is my observation: 1. Installed the attached PR build 17.0.176-alpha-test-9591 on iPhone Simulator. 2. Switched to sil_eurolatin keyboard in the Keyman In-App. 3. Verified that the key preview briefly appears after briefly pressing a top row key and release. 4. Verified that the selected key appeared on the screen after selecting it from the longpress options. Seems to be working as expected.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Sep 21, 2023
@darcywong00 darcywong00 merged commit 9e71322 into master Sep 22, 2023
2 checks passed
@darcywong00 darcywong00 deleted the change/android/move-longpress-kmw branch September 22, 2023 05:32
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.179-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants