mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-25 09:47:42 +00:00
Merge pull request #13219 from keymanapp/fix/android/send-options-api
fix(android): Remove sendOptionsToKeyboard function from Engine API
This commit is contained in:
commit
905684f11a
5 changed files with 17 additions and 14 deletions
|
|
@ -250,8 +250,6 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
|
|||
if (exText != null)
|
||||
exText = null;
|
||||
}
|
||||
// Initialize keyboard options
|
||||
KMManager.sendOptionsToKeyboard();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ public class AdjustLongpressDelayActivity extends BaseActivity {
|
|||
// Store the longpress delay as a reference
|
||||
// and then update KeymanWeb with the longpress delay
|
||||
KMManager.setLongpressDelay(currentDelayTimeMS);
|
||||
KMManager.sendOptionsToKeyboard();
|
||||
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -475,8 +475,7 @@ public class MainActivity extends BaseActivity implements OnKeyboardEventListene
|
|||
|
||||
@Override
|
||||
public void onKeyboardLoaded(KeyboardType keyboardType) {
|
||||
// Initialize keyboard options
|
||||
KMManager.sendOptionsToKeyboard();
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ var bannerImagePath = '';
|
|||
var bannerHTMLContents = '';
|
||||
var fragmentToggle = 0;
|
||||
var deferredBannerCall;
|
||||
var longpressDelay = null;
|
||||
|
||||
var sentryManager = new KeymanSentryManager({
|
||||
hostPlatform: "android"
|
||||
|
|
@ -71,6 +72,10 @@ function init() {
|
|||
|
||||
keyman.refreshOskLayout();
|
||||
}
|
||||
// Initialize the longpress delay
|
||||
if(longpressDelay !== null) {
|
||||
setLongpressDelay(longpressDelay);
|
||||
}
|
||||
});
|
||||
|
||||
keyman.addEventListener('keyboardloaded', setIsChiral);
|
||||
|
|
@ -128,11 +133,10 @@ function notifyHost(event, params) {
|
|||
// Update the KeymanWeb longpress delay
|
||||
// delay is in milliseconds
|
||||
function setLongpressDelay(delay) {
|
||||
if (keyman.osk) {
|
||||
longpressDelay = delay;
|
||||
if (keyman && keyman.osk) {
|
||||
keyman.osk.gestureParams.longpress.waitLength = delay;
|
||||
console_debug('setLongpressDelay('+delay+')');
|
||||
} else {
|
||||
window.console.log('setLongpressDelay error: keyman.osk undefined');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -722,6 +722,7 @@ public final class KMManager {
|
|||
}
|
||||
keyboard.setBanner(KMManager.BannerType.HTML);
|
||||
keyboard.showBanner(true);
|
||||
sendLongpressDelay();
|
||||
}
|
||||
setEngineWebViewVersionStatus(appContext, keyboard);
|
||||
}
|
||||
|
|
@ -921,7 +922,7 @@ public final class KMManager {
|
|||
copyAsset(context, KMFilename_KmwCss, "", true);
|
||||
copyAsset(context, KMFilename_KmwGlobeHintCss, "", true);
|
||||
copyAsset(context, KMFilename_Osk_Ttf_Font, "", true);
|
||||
|
||||
|
||||
// Needed until our minimum version of Chrome is 61.0+.
|
||||
copyAsset(context, KMFilename_JSPolyfill2, "", true);
|
||||
|
||||
|
|
@ -2124,7 +2125,7 @@ public final class KMManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the longpress delay (in milliseconds) as a stored preference.
|
||||
* Set the longpress delay (in milliseconds) as a stored preference and sends to KeymanWeb.
|
||||
* Valid range is 300 ms to 1500 ms. Returns true if the preference is successfully stored.
|
||||
* @param longpressDelay - int longpress delay in milliseconds
|
||||
* @return boolean
|
||||
|
|
@ -2140,17 +2141,19 @@ public final class KMManager {
|
|||
editor.putInt(KMKey_LongpressDelay, longpressDelay);
|
||||
editor.commit();
|
||||
|
||||
// Send longpress delay to KeymanWeb
|
||||
sendLongpressDelay();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends options to the KeymanWeb keyboard.
|
||||
* Sends longpress delay to the KeymanWeb keyboard.
|
||||
* 1. number of milliseconds to trigger a longpress gesture.
|
||||
* This method requires a keyboard to be loaded for the value to take effect.
|
||||
*/
|
||||
public static void sendOptionsToKeyboard() {
|
||||
private static void sendLongpressDelay() {
|
||||
int longpressDelay = getLongpressDelay();
|
||||
if (isKeyboardLoaded(KeyboardType.KEYBOARD_TYPE_INAPP)) {
|
||||
if (InAppKeyboard != null) {
|
||||
InAppKeyboard.loadJavascript(KMString.format("setLongpressDelay(%d)", longpressDelay));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue