-
-
Notifications
You must be signed in to change notification settings - Fork 112
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-based popup key longpressses #9573
Comments
Note: this means banner will always be visible on Android, no option to switch off banner any more. |
UX question: Should Android follow iOS and display a Keyman image banner when predictions are disabled? It may take me some time to repurpose the iOS banners to the Android form factors. |
That needs to be done, yes. The UX for longpress when the banner is not visible is not very good. |
ok. so it sounds like I should have Keyman Engine for Android always display the banner (probably a blank black banner) that the apps can then theme with a custom image banner. It's a little unfortunate "blank banner" in KeymanWeb currently means a banner height 0 keyman/web/src/engine/osk/src/banner/banner.ts Lines 103 to 112 in ab4f45e
The language settings toggle to disable predictions will stop suggestions from appearing, but the banner remains. |
Yes, this should be the same in both Android and iOS, ideally. The banner image could be specified by Android (and iOS)'s keyboard.html CSS, and if that's possible, then I suggest that it could be implemented something like this:
This would scale the image according to the height of the banner, and fill remaining space white, I think. That should handle all the various aspect ratios. One could use keyman-banner.svg instead, which would give a better result on all devicess. That way we don't need to have a new API to define the image. But this depends on how the existing banner is implemented. @jahorton thoughts? Does this sound sensible? |
What the iOS app actually does is use the For an interactive version of the idea: https://elmah.io/tools/base64-image-encoder/ can be used to construct a data URL; set the image banner's image-source to the URL spit out and you've got an image. For a small black box that could be tiled as the background:
For what iOS uses, https://github.com/keymanapp/keyman/blob/master/ios/keyman/Keyman/SWKeyboard/ImageBannerViewController.swift has the most compact, centralized version of the code. It actually renders a full iOS view to an image, then converts that to base64. See The result is then forwarded through this block to the WebView: keyman/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/KeymanWebViewController.swift Lines 411 to 421 in ab4f45e
which in turn references this: keyman/ios/engine/KMEI/KeymanEngine/resources/Keyman.bundle/Contents/Resources/ios-host.js Lines 79 to 84 in ab4f45e
This approach was taken partly due to iOS dark-mode support. Seems like Java has a Base64 utility class that might make a good lead. Here's a StackOverflow post regarding it; not the most clear, but it should still be helpful. https://stackoverflow.com/a/36492265 Ah right, the other part of the reason we took this approach: it's quite difficult to construct a sufficient set of banner images for all the different aspect ratios supported by iOS; by constructing it at runtime, we can ensure the banner's layout always looks good and appropriate. But yeah, there is an API for this in the iOS engine. |
That seems overly complicated. One could just use the dark mode CSS property. And then we can keep it purely web-side.
https://stackoverflow.com/a/57795495/1836776 also shows how to detect change in color scheme. In CSS:
|
We already use that for the OSK CSS. |
Hence my suggestion of the |
As a reminder of the app's history, here's how we used to specify the banner's image before predictive text: There were quite a few image files for the various aspect ratios and resolution levels involved. #1703 seems to be when the change was made. Part of this was also due to our desire to allow OEM theming for the banner - FirstVoices had its own banner style, after all. Still does, actually, and it uses the old, pre-12.0 approach with separate defined files: keyman/oem/firstvoices/ios/SWKeyboard/FVInputViewController.swift Lines 58 to 75 in ab4f45e
The main issue with the pure Web-side suggestion is that, so far as I can see, we lose the OEM theming. |
keyman/web/src/engine/osk/src/banner/bannerView.ts Lines 176 to 190 in e56c5ba
afaict, even though I have Keyman for Android change the banner to image, KeymanWeb already initialized with a constructor for |
That would be its default value until a different form of banner is specified. From iOS: keyman/ios/engine/KMEI/KeymanEngine/resources/Keyman.bundle/Contents/Resources/ios-host.js Lines 74 to 77 in e56c5ba
The Alternatively, |
From the Sept 2023 team planning meetings, it was decided to have Android match iOS (see #2968) in using KeymanWeb for handling longpress keys.
Pros: maintainability of OSK, also avoids duplicating gestures
Cons: The longpresses would be limited to the top of the OSK / banner
Affects: Keyman Engine for Android consumers (FV, KAB, etc).
This might also end up resolving open issues specific to Android longpresses
e.g. #9499
The text was updated successfully, but these errors were encountered: