spiegel-keyman/android/KMEA
Marc Durdin 909d833474 fix(web): improve keyboard switch performance
Summary of these changes:

Two targeted improvements; more optimization is possible but IMO this is
a significant enough improvement to go through test:

1. In oskView.ts, avoid calling `VisualKeyboard.refreshLayout` twice
   from `OSKView.refreshLayout`. This roughly halves the time spent in
   `VisualKeyboard.refreshLayout` for a keyboard switch.
2. In modelManager.ts, we avoid a very expensive `unloadModel` /
   `loadModel` sequence from `registerModel` by checking to see if the
   model spec we are passed is already registered. This avoids an
   expensive callback to Keyman for Android which causes the banner to
   'bounce'.

Longer notes:

So `VisualKeyboard.refreshLayout` is called 20+ times during a keyboard
switch. It is a very expensive call. It is the bulk of the time spent
when you press the globe key in Keyman for Android. This seems ripe for
optimization; see the following functions in keyboard.html:

* `setKeymanLanguage` -> `setActiveKeyboard` -> 6 calls
* `enableSuggestions` -> `registerModel` -> 8 calls
* `stateChange` -> 6+ calls

`OSKView.refreshLayout` always seems to call
`VisualKeyboard.refreshLayout` twice: first with `setSize`, and then
again itself.

Keyman for Android and KeymanWeb seem to fight over who is responsible
for selecting models (KMW first calls `loadModel`, then Keyman for
Android calls `unloadModel`, `loadModel`, through `enableSuggestions`).

The fix for rotation (`correctOSKTextSize()`), as called from
`stateChange()`, is expensive as well, because it rebuilds the entire
keyboard from scratch.

Along with that, we have the size of the webview changing as the model
is unloaded and reloaded and lots of back-and-forth between the
KeymanWeb and KMEA which seems unnecessary.

Shouldn't KeymanWeb be responsible for loading and unloading models,
once they are all registered? We should only need to register the models
once at page load time (when config changes, do we just reload the
page?).
2021-11-22 10:47:05 +11:00
..
app fix(web): improve keyboard switch performance 2021-11-22 10:47:05 +11:00
gradle/wrapper chore(android/engine): Update dependencies 2021-05-18 10:08:05 +07:00
test_resources fix(android/engine): Fix zip slip vulnerability 2021-01-20 15:42:22 +07:00
.classpath Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
build.gradle fix(android/engine): Skip tests for missing resource errors 2021-05-18 12:00:32 +07:00
build.sh feat(android): Spacebar text controls 2021-06-24 10:58:26 +10:00
gradle.properties chore(android/engine): Update dependencies 2021-05-18 10:08:05 +07:00
gradlew fix(android): Update Gradle wrapper to 5.6.4 2020-08-07 08:51:01 +07:00
gradlew.bat fix(android): Update Gradle wrapper to 5.6.4 2020-08-07 08:51:01 +07:00
lint.xml Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
proguard-project.txt Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
project.properties Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00
settings.gradle Keyman for Android 2.8 Open Source 2017-07-21 11:52:22 +07:00