Skip to content

fix(android): Convert Keyman app layout to use ConstraintLayout for handling edge-to-edge 🪟#14396

Merged
darcywong00 merged 6 commits intomasterfrom
fix/android/constraint-layout
Aug 18, 2025
Merged

fix(android): Convert Keyman app layout to use ConstraintLayout for handling edge-to-edge 🪟#14396
darcywong00 merged 6 commits intomasterfrom
fix/android/constraint-layout

Conversation

@darcywong00
Copy link
Contributor

@darcywong00 darcywong00 commented Jul 24, 2025

Follows #14395 for #14248

This uses Android Studio's tool to convert the top level layout from RelativeLayout to ConstraintLayout.
Layout also updated with constraints to specify the order and boundaries. This way, the edge-to-edge doesn't cover up the top and bottom portions of the app.

Also incorporates @chrisvire's suggestions from the KAB team along with AlphaTiles/AlphaTiles#160 to BaseActivity

Note: BaseActivity.setupStatusBarColors() only works on Android API M (27) through Upsidedown Cake (34)

Screenshots

Phone Android API 34 in portrait and landscape orientations. Landscape orientation width to tweak separately (Now fixed)

Keyman app System Keyboard
app API 34 system 34 portrait
app landscape system 34 landscape

TODO's on separate PRs:

  • Tweak landscape keyboard width
  • Update other activities in the Keyman app and engine
  • Update FirstVoices and Sample apps
  • Handle OSK on API 36

User Testing

(edit) Changing groups from API 28 to API 34
Setup - Install the PR build of Keyman for Android on an Android device/emulator of the specified API

GROUP_PHONE_API_34: Use Android API 34 on a phone device/emulator
GROUP_TABLET_API_34: Use Android API 34 on a tablet device/emulator

  • TEST_INAPP - Verifies in-app keyboard layout is fine
  1. Install Keyman for Android on the specified Android API level for the device/emulator
  2. Launch the app in the default Portrait orientation and dismiss the Get Started menu
  3. Observe the Keyman app and verify:
    • Keyman menu bar is not covered by the top status bar
    • in-app keyboard is not covered by the bottom navigation bar
    • keyboard buttons and suggestion bar function as expected
  4. Rotate the app to landscape orientation (unlock orientation lock if necessary) and wait for the app to refresh
  5. Observe the Keyman app and verify:
    • Keyman menu bar is not covered by the top status bar
    • in-app keyboard is not covered by the camera notch or navigation bar
    • keyboard buttons and suggestion bar function as expected
  • TEST_SYSTEM_KEYBOARD - Verifies the system keyboard is not obscured
  1. Install Keyman for Android on the specified Android API level for the device/emulator
  2. Launch the app in the default Portrait orientation use the Get Started menu to enable Keyman as the default system keyboard
  3. Launch Chrome app and select text area
  4. With Keyman as the system keyboard, verify:
    • system keyboard is not obscured by the bottom navigation bar
    • keyboard buttons and suggestion bar function as expected
  5. Rotate the device to landscape orientation (unlock orientation lock if necessary) and wait for the keyboard to refresh
  6. With Keyman as the system keyboard, verify
    • system keyboard is not obscured by the camera notch or navigation bar
    • keyboard buttons and suggestion bar function as expected
      .

@darcywong00 darcywong00 added this to the A19S8 milestone Jul 24, 2025
@github-project-automation github-project-automation bot moved this to Todo in Keyman Jul 24, 2025
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels Jul 24, 2025
@github-actions github-actions bot added android/ android/app/ and removed user-test-required User tests have not been completed labels Jul 24, 2025
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Jul 24, 2025

User Test Results

Test specification and instructions

  • ✅ GROUP_PHONE_API_34: Use Android API 34 on a phone device/emulator

    2 tests PASSED
  • ⬜ GROUP_PHONE_API_36: Use Android API 36 on a phone device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

    • TEST_INAPP (OPEN): retest
    • TEST_SYSTEM_KEYBOARD (OPEN): retest
  • ✅ GROUP_TABLET_API_34: Use Android API 34 on a tablet device/emulator

    2 tests PASSED
  • 🟥 GROUP_TABLET_API_36: Use Android API 36 on a tablet device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

Results Template
# Test Results

### GROUP_PHONE_API_36: Use Android API 36 on a phone device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

* **TEST_INAPP (OPEN):** notes
* **TEST_SYSTEM_KEYBOARD (OPEN):** notes
Retesting Template
Test-bot: retest GROUP_TABLET_API_36 TEST_SYSTEM_KEYBOARD

Test Artifacts

@github-actions github-actions bot added the fix label Jul 24, 2025
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-required User tests have not been completed label Jul 24, 2025
@darcywong00 darcywong00 marked this pull request as draft July 24, 2025 07:42
jahorton
jahorton previously approved these changes Jul 24, 2025
@darcywong00 darcywong00 removed the request for review from ermshiperete July 24, 2025 14:13
@MattGyverLee
Copy link
Contributor

@darcywong00 The App Builders have the same API35 problem. I see that your fix is in the Keyman Android app and not the Keyman engine. Does the proposed fix extend to a SystemKeyboard when the app is closed and make it show above the toolbar as well?

@darcywong00
Copy link
Contributor Author

I'm still trying to work on the fix (this is in progress :( )

@MattGyverLee
Copy link
Contributor

MattGyverLee commented Jul 28, 2025

Well it seems that you and @AaronHemphill are SIL's experts on this issue (we just discovered it today). App builders was hoping to release AB 13 soon and this API35 issue may be a blocker. It seems to affect all of the apps' bottom elements, but blocking the bottom bar of a keyboard is the worst case.

@darcywong00 darcywong00 force-pushed the fix/android/constraint-layout branch from 8a5ddfc to 526775d Compare July 30, 2025 06:06
Using Android Studio's tool to convert the top level RelativeLayout to ConstraintLayout. This way, the edge-to-edge doesn't cover up the top and bottom portions of the app.

Also apply insets so app and keyboard fit in usable areas.
@darcywong00 darcywong00 force-pushed the fix/android/constraint-layout branch from 526775d to 85986dd Compare July 30, 2025 07:12
@darcywong00 darcywong00 marked this pull request as ready for review July 31, 2025 01:01
@darcywong00 darcywong00 requested a review from jahorton July 31, 2025 01:01
@darcywong00 darcywong00 dismissed jahorton’s stale review July 31, 2025 01:02

PR ready to re-review.
Note: only the main app is updated (in-app keyboard and system keyboard).

@MattGyverLee
Copy link
Contributor

Richard has completed his inset work for the app builders, including fixing these margins.
https://github.com/sillsdev/app-builders/issues/1925

@darcywong00 darcywong00 added this to the A19S9 milestone Aug 2, 2025
@keymanapp-test-bot keymanapp-test-bot bot added the user-test-required User tests have not been completed label Aug 2, 2025
@darcywong00
Copy link
Contributor Author

@dinakaranr - maybe a polyfill missing on older Android device. I'll change the tests to use API 34 instead.
Test-bot: retest

This brings in some of the changes the Keyboard App builder team  did to integrate with Keyman Engine for Android 18.0 and supporting edge to edge
@dinakaranr
Copy link

dinakaranr commented Aug 6, 2025

Test Results

I retested this PR in the "Keyman-19.0.89-alpha-test-14396" build on Android 9, API_34 and API_36 for Mobile and Tablet. Here I am sharing my observation.

GROUP_PHONE_API_34: Use Android API 34 on a phone device/emulator

  • TEST_INAPP (Passed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Android 9 API_34 for the device/emulator.
  2. Launch the app in the default Portrait orientation and dismiss the Get Started menu
  3. Observe the Keyman app and verify:
    • Keyman menu bar is not covered by the top status bar on the horizontal bar. It works well.
    • in-app keyboard is not covered by the bottom navigation bar. It works well.
    • keyboard buttons and suggestion bar function are not work as expected. because keyboard does not appear.
  4. Rotate the app to landscape orientation (unlock orientation lock if necessary) and wait for the app to refresh
  5. Observe the Keyman app and verify:
    • Keyman menu bar is not covered by the top status bar. It works well.
    • in-app keyboard is not covered by the camera notch. It works well.
    • keyboard buttons and suggestion bar function works as expected.
  • TEST_SYSTEM_KEYBOARD (Passed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Android 9 API_34 for the device/emulator.
  2. Launch the app in the default Portrait orientation use the Get Started menu to enable Keyman as the default system keyboard
  3. Launch Chrome app and select text area(online editor webpage)
  4. With Keyman as the system keyboard, verify:
    • system keyboard is not obscured by the bottom navigation bar
    • keyboard buttons and suggestion bar function are not work as expected. because keyboard does not appear.
  5. Rotate the device to landscape orientation (unlock orientation lock if necessary) and wait for the keyboard to refresh
  6. With Keyman as the system keyboard, verify
    • system keyboard is obscured by the camera notch or navigation bar
    • keyboard buttons and suggestion bar function are not work as expected. because keyboard does not appear.
      Please refer to the screenshot below

GROUP_PHONE_API_36: Use Android API 36 on a phone device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

  • TEST_INAPP (Passed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Pixel 8 API_36 for the device/emulator.
  2. Launch the app in the default Portrait orientation and dismiss the Get Started menu
  3. Observe the Keyman app and verify:
    • Keyman menu bar is not covered by the top status bar on the horizontal bar. It works well.
    • in-app keyboard is not covered by the bottom navigation bar. It works well.
  4. Rotate the app to landscape orientation (unlock orientation lock if necessary) and wait for the app to refresh
  5. Observe the Keyman app and verify:
    • Keyman menu bar is not covered by the top status bar. It works well.
    • in-app keyboard is not covered by the camera notch. It works well.
    • keyboard buttons and suggestion bar function works expected.
  • TEST_SYSTEM_KEYBOARD (failed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Pixel 8 API_36 for the device/emulator.
  2. Launch the app in the default Portrait orientation use the Get Started menu to enable Keyman as the default system keyboard
  3. Launch Chrome app and select text area(online editor webpage)
  4. With Keyman as the system keyboard, verify:
    • system keyboard is not obscured by the bottom navigation bar. It works well.
    • keyboard buttons and suggestion bar function works as expected.
  5. Rotate the device to landscape orientation (unlock orientation lock if necessary) and wait for the keyboard to refresh
  6. With Keyman as the system keyboard, verify
    • system keyboard is not obscured by the camera notch or navigation bar. It works well.
    • keyboard buttons and suggestion bar function are not work as expected. because keyboard does not appear.
      Please refer to the screenshot below

GROUP_TABLET_API_34: Use Android API 34 on a tablet device/emulator

  • TEST_INAPP (passed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Android 9 Tablet API_34 for the device/emulator.
  2. Launch the app in the default Portrait orientation and dismiss the Get Started menu
  3. Observe the Keyman app and verify:
    - Keyman menu bar is not covered by the top status bar on the horizontal bar. It works well.
    - in-app keyboard is not covered by the bottom navigation bar. It works well.
    - keyboard buttons and suggestion bar function works as expected.
  4. Rotate the app to landscape orientation (unlock orientation lock if necessary) and wait for the app to refresh
  5. Observe the Keyman app and verify:
    - Keyman menu bar is not covered by the top status bar. It works well.
    - in-app keyboard is not covered by the camera notch. It works well.
    - keyboard buttons and suggestion bar function works as expected.
  • TEST_SYSTEM_KEYBOARD (passed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Android 9 Tablet API_34 for the device/emulator.
  2. Launch the app in the default Portrait orientation use the Get Started menu to enable Keyman as the default system keyboard
  3. Launch Chrome app and select text area(online editor webpage)
  4. With Keyman as the system keyboard, verify:
    - system keyboard is not obscured by the bottom navigation bar. It works well.
    - keyboard buttons and suggestion bar function as expected. It works well.
  5. Rotate the device to landscape orientation (unlock orientation lock if necessary) and wait for the keyboard to refresh
  6. With Keyman as the system keyboard, verify
    - system keyboard is not obscured by the camera notch or navigation bar. It works well.
    - keyboard buttons and suggestion bar function as expected.
    Please refer to the screenshot below

GROUP_TABLET_API_36: Use Android API 36 on a tablet device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

  • TEST_INAPP (Passed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Pixel 8 tablet API_36 for the device/emulator.
  2. Launch the app in the default Portrait orientation and dismiss the Get Started menu
  3. Observe the Keyman app and verify:
    - Keyman menu bar is not covered by the top status bar on the horizontal bar. It works well.
    - in-app keyboard is not covered by the bottom navigation bar. It works well.
    - keyboard buttons and suggestion bar function as expected. It works well
  4. Rotate the app to landscape orientation (unlock orientation lock if necessary) and wait for the app to refresh
  5. Observe the Keyman app and verify:
    - Keyman menu bar is not covered by the top status bar. It works well.
    - in-app keyboard is not covered by the camera notch. It works well.
    - keyboard buttons and suggestion bar function works expected.
  • TEST_SYSTEM_KEYBOARD (failed):
  1. Install Keyman-19.0.89-alpha-test-14396 for Android on the Pixel 8 API_36 for the device/emulator.
  2. Launch the app in the default Portrait orientation use the Get Started menu to enable Keyman as the default system keyboard
  3. Launch Chrome app and select text area(online editor webpage)
  4. With Keyman as the system keyboard, verify:
    - system keyboard is not obscured by the bottom navigation bar. It works well.
    - keyboard buttons and suggestion bar function as expected.
  5. Rotate the device to landscape orientation (unlock orientation lock if necessary) and wait for the keyboard to refresh
  6. With Keyman as the system keyboard, verify
    - system keyboard is not obscured by the camera notch or navigation bar. It works well.
    - keyboard buttons and suggestion bar function are not work as expected. because keyboard does not appear.
    Please refer to the screenshot below

@keymanapp-test-bot keymanapp-test-bot bot added user-test-failed and removed user-test-required User tests have not been completed labels Aug 6, 2025
@dinakaranr dinakaranr removed their assignment Aug 6, 2025
@darcywong00
Copy link
Contributor Author

Ah, there may be some interaction on the Android 36 emulator while a physical keyboard is plugged in.
Will update user test setup steps for the following:

device Settings --> Keyboard --> On-screen keyboard --> click Gboard --> physical keyboard --> Show on-screen keyboard needs to be "on"

@darcywong00
Copy link
Contributor Author

darcywong00 commented Aug 6, 2025

Setup steps for API 36 updated.
Test-bot: retest GROUP_PHONE_API_36
Test-bot: retest GROUP_TABLET_API_36

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-required User tests have not been completed label Aug 6, 2025
@darcywong00
Copy link
Contributor Author

darcywong00 commented Aug 12, 2025

I still can't get the OSK to show on API 36. Will move those tests and address on a follow-on PR

Copying those test steps here:

For GROUP_PHONE_API_36 and GROUP_TABLET_API_36, additional steps if running on emulator:
device Settings --> Keyboard --> On-screen keyboard --> click Gboard -->  physical keyboard --> Show on-screen keyboard needs to be "on". This way, the on-screen keyboard appears in the emulator.

GROUP_PHONE_API_36: Use Android API 36 on a phone device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

GROUP_TABLET_API_36: Use Android API 36 on a tablet device/emulator. Also change device to use 3-button navigation. Go to Device settings --> Display & Touch --> Navigation mode --> change from "Gesture navigation" to "3-button navigation"

And clearing the tests that got moved:

Test-bot: retest GROUP_PHONE_API_36 TEST_SYSTEM_KEYBOARD, GROUP_TABLET_API_36 TEST_SYSTEM_KEYBOARD

@AaronHemphill
Copy link

AaronHemphill commented Aug 12, 2025 via email

@mcdurdin
Copy link
Member

I still can't get the OSK to show on API 36. Will move those tests and address on a follow-on PR

It'd be better to get it fixed fully here, I think. I don't want to see the build on master not working on API 36 devices...

@darcywong00 darcywong00 modified the milestones: A19S9, A19S10 Aug 16, 2025
Base automatically changed from main/android/taregt-api-35 to master August 18, 2025 07:11
@darcywong00 darcywong00 merged commit 7e5e117 into master Aug 18, 2025
6 of 7 checks passed
@darcywong00 darcywong00 deleted the fix/android/constraint-layout branch August 18, 2025 07:11
@github-project-automation github-project-automation bot moved this from Todo to Done in Keyman Aug 18, 2025
@keyman-server
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

chore(android): Play Store requires targeting Android API 35 or higher

7 participants