From 9e41c1dd463c0a902d30373e5e0aebb8fa48b332 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 7 Jan 2025 10:07:31 +0700 Subject: [PATCH 1/3] fix(android/engine): Cleanup deprecated keys Remove deprecated keys no longer used from #4462 during Keyman 14.0 --- .../app/src/main/java/com/keyman/engine/KMManager.java | 7 +------ .../app/src/test/java/com/keyman/engine/KMManagerTest.java | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java index e776476aff6..bc02ea25aa5 100644 --- a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java +++ b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java @@ -249,7 +249,7 @@ public int toInt() { public final static String predictionPrefSuffix = ".mayPredict"; public final static String correctionPrefSuffix = ".mayCorrect"; - public final static String autoCorrectionPrefSuffix = ".mayAutoCorect"; + public final static String autoCorrectionPrefSuffix = ".mayAutoCorrect"; // Special override for when the keyboard may have haptic feedback when typing. // haptic feedback disabled for hardware keystrokes @@ -305,11 +305,6 @@ public int toInt() { public static final String KMKey_LexicalModelVersion = "lmVersion"; public static final String KMKey_LexicalModelPackageFilename = "kmpPackageFilename"; - // DEPRECATED keys - public static final String KMKey_CustomKeyboard = "CustomKeyboard"; - public static final String KMKey_CustomModel = "CustomModel"; - public static final String KMKey_HelpLink = "helpLink"; - // Keyman internal keys protected static final String KMKey_ShouldShowHelpBubble = "ShouldShowHelpBubble"; diff --git a/android/KMEA/app/src/test/java/com/keyman/engine/KMManagerTest.java b/android/KMEA/app/src/test/java/com/keyman/engine/KMManagerTest.java index 59a0237b377..91fc7dd3709 100644 --- a/android/KMEA/app/src/test/java/com/keyman/engine/KMManagerTest.java +++ b/android/KMEA/app/src/test/java/com/keyman/engine/KMManagerTest.java @@ -126,7 +126,6 @@ public void create_newKeyboardsList() { HashMap kmInfo = new HashMap(); kmInfo.put(KMManager.KMKey_PackageID, "khmer_angkor"); kmInfo.put(KMManager.KMKey_KeyboardID, "khmer_angkor"); - kmInfo.put(KMManager.KMKey_CustomKeyboard, "Y"); kmInfo.put(KMManager.KMKey_LanguageID, "km"); kmInfo.put(KMManager.KMKey_KeyboardName, "Khmer Angkor"); kmInfo.put(KMManager.KMKey_LanguageName, "Central Khmer"); From 1d86a0d2174b17f2514690ef13618105beb71ebb Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 7 Jan 2025 10:44:00 +0700 Subject: [PATCH 2/3] fix(android/engine): Remove deprecated addKeyboard call --- .../java/com/keyman/engine/KMManager.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java index bc02ea25aa5..cc12b36dca2 100644 --- a/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java +++ b/android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java @@ -1709,26 +1709,6 @@ public static boolean addKeyboard(Context context, Keyboard keyboardInfo) { return KeyboardPickerActivity.addKeyboard(context, keyboardInfo); } - // Intend to deprecate in Keyman 15.0 - public static boolean addKeyboard(Context context, HashMap keyboardInfo) { - String packageID = keyboardInfo.get(KMManager.KMKey_PackageID); - String keyboardID = keyboardInfo.get(KMManager.KMKey_KeyboardID); - String keyboardName = keyboardInfo.get(KMManager.KMKey_KeyboardName); - String languageID = keyboardInfo.get(KMManager.KMKey_LanguageID); - String languageName = keyboardInfo.get(KMManager.KMKey_LanguageName); - String version = keyboardInfo.get(KMManager.KMKey_KeyboardVersion); - String helpLink = keyboardInfo.get(KMManager.KMKey_CustomHelpLink); - String kmpLink = MapCompat.getOrDefault(keyboardInfo, KMManager.KMKey_KMPLink, ""); - String font = keyboardInfo.get(KMManager.KMKey_Font); - String oskFont = keyboardInfo.get(KMManager.KMKey_OskFont); - boolean isNewKeyboard = true; - - Keyboard k = new Keyboard(packageID, keyboardID, keyboardName, - languageID, languageName, version, helpLink, kmpLink, - isNewKeyboard, font, oskFont); - return addKeyboard(context, k); - } - public static boolean removeKeyboard(Context context, int position) { return KeyboardPickerActivity.removeKeyboard(context, position); } From 2454be9f5feeab2b2650fbbb0f5b80b366097c93 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 7 Jan 2025 14:22:02 +0700 Subject: [PATCH 3/3] fix(android/engine): Update usage in FunctionalTestHelper --- .../keyman/engine/view/FunctionalTestHelper.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/android/KMEA/app/src/test/java/com/keyman/engine/view/FunctionalTestHelper.java b/android/KMEA/app/src/test/java/com/keyman/engine/view/FunctionalTestHelper.java index b56a4063eba..0d4b7c81deb 100644 --- a/android/KMEA/app/src/test/java/com/keyman/engine/view/FunctionalTestHelper.java +++ b/android/KMEA/app/src/test/java/com/keyman/engine/view/FunctionalTestHelper.java @@ -66,7 +66,21 @@ static void installCustomKeyboard(File aKPMFile) throws IOException, JSONExcepti Assert.assertEquals(installedKbds.size(),1); - KMManager.addKeyboard(ApplicationProvider.getApplicationContext(),(HashMap) installedKbds.get(0)); + HashMap map = (HashMap)installedKbds.get(0); + Keyboard keyboard = new Keyboard( + map.get(KMManager.KMKey_PackageID), + map.get(KMManager.KMKey_KeyboardID), + map.get(KMManager.KMKey_KeyboardName), + map.get(KMManager.KMKey_LanguageID), + map.get(KMManager.KMKey_LanguageName), + map.get(KMManager.KMKey_KeyboardVersion), + map.get(KMManager.KMKey_CustomHelpLink), + map.get(KMManager.KMKey_KMPLink), + true, + null, + null + ); + KMManager.addKeyboard(ApplicationProvider.getApplicationContext(), keyboard); }