mirror of
https://github.com/keymanapp/keyman.git
synced 2026-11-02 09:07:41 +00:00
Merge pull request #2136 from keymanapp/android-js-stability
[Android] Improves keyboard swap stability
This commit is contained in:
commit
dac0f15adc
2 changed files with 19 additions and 4 deletions
|
|
@ -190,6 +190,7 @@ final class KMKeyboard extends WebView {
|
|||
|
||||
public void loadKeyboard() {
|
||||
keyboardSet = false;
|
||||
this.javascriptAfterLoad.clear();
|
||||
|
||||
if(keyboardType == KeyboardType.KEYBOARD_TYPE_INAPP)
|
||||
KMManager.InAppKeyboardLoaded = false;
|
||||
|
|
@ -207,7 +208,9 @@ final class KMKeyboard extends WebView {
|
|||
if((keyboardType == KeyboardType.KEYBOARD_TYPE_INAPP && KMManager.InAppKeyboardLoaded) ||
|
||||
(keyboardType == KeyboardType.KEYBOARD_TYPE_SYSTEM && KMManager.SystemKeyboardLoaded)) {
|
||||
|
||||
if(this.javascriptAfterLoad.size() == 1)
|
||||
// If !this.keyboardSet, then pageLoaded hasn't fired yet.
|
||||
// When pageLoaded fires, it'll call `callJavascriptAfterLoad` safely.
|
||||
if(this.javascriptAfterLoad.size() == 1 && keyboardSet)
|
||||
callJavascriptAfterLoad();
|
||||
}
|
||||
}
|
||||
|
|
@ -221,8 +224,11 @@ final class KMKeyboard extends WebView {
|
|||
if(javascriptAfterLoad.size() > 0) {
|
||||
loadUrl("javascript:" + javascriptAfterLoad.get(0));
|
||||
javascriptAfterLoad.remove(0);
|
||||
if (javascriptAfterLoad.size() > 0) {
|
||||
callJavascriptAfterLoad();
|
||||
// Make sure we didn't reset the page in the middle of the queue!
|
||||
if(keyboardSet) {
|
||||
if (javascriptAfterLoad.size() > 0) {
|
||||
callJavascriptAfterLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -592,7 +592,16 @@ namespace com.keyman.osk {
|
|||
|
||||
// Build a layout using the default for the device
|
||||
if(typeof layout != 'object' || layout == null) {
|
||||
let kbdDevVersion = new utils.Version(activeKeyboard['KVER']);
|
||||
var kbdDevVersion: utils.Version;
|
||||
|
||||
// This CAN be called with no backing keyboard; KMW will try to force-show
|
||||
// the OSK even without a backing keyboard on mobile, using the default
|
||||
// layout as the OSK's base.
|
||||
if(activeKeyboard) {
|
||||
kbdDevVersion = new utils.Version(activeKeyboard['KVER']);
|
||||
} else {
|
||||
kbdDevVersion = new utils.Version(keyman['version']);
|
||||
}
|
||||
layout=Layouts.buildDefaultLayout(PVK, kbdDevVersion, kbdBitmask, formFactor);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue