refactor(android/engine): Move toggleSuggestionBanner to KMKeyboard

This commit is contained in:
Darcy Wong 2023-04-27 08:00:12 +07:00
parent 1184036c7a
commit e8fa340812
2 changed files with 20 additions and 20 deletions

View file

@ -422,6 +422,26 @@ final class KMKeyboard extends WebView {
public static String currentBanner() { return currentBanner; }
private static void toggleSuggestionBanner(String languageID, boolean inappKeyboardChanged, boolean systemKeyboardChanged) {
//reset banner state if new language has no lexical model
if (InAppKeyboard != null && InAppKeyboard.currentBanner().equals(KMKeyboard.KM_BANNER_STATE_SUGGESTION)
&& getAssociatedLexicalModel(languageID)==null) {
InAppKeyboard.setCurrentBanner(KMKeyboard.KM_BANNER_STATE_BLANK);
}
if (SystemKeyboard != null && SystemKeyboard.currentBanner().equals(KMKeyboard.KM_BANNER_STATE_SUGGESTION)
&& getAssociatedLexicalModel(languageID)==null) {
SystemKeyboard.setCurrentBanner(KMKeyboard.KM_BANNER_STATE_BLANK);
}
if(inappKeyboardChanged) {
InAppKeyboard.setLayoutParams(getKeyboardLayoutParams());
}
if(systemKeyboardChanged) {
SystemKeyboard.setLayoutParams(getKeyboardLayoutParams());
}
}
/**
* Return the full path to the display text font. Usually used for creating a Typeface font
* @return String

View file

@ -2152,26 +2152,6 @@ public final class KMManager {
globeKeyState = state;
}
private static void toggleSuggestionBanner(String languageID, boolean inappKeyboardChanged, boolean systemKeyboardChanged) {
//reset banner state if new language has no lexical model
if (InAppKeyboard != null && InAppKeyboard.currentBanner().equals(KMKeyboard.KM_BANNER_STATE_SUGGESTION)
&& getAssociatedLexicalModel(languageID)==null) {
InAppKeyboard.setCurrentBanner(KMKeyboard.KM_BANNER_STATE_BLANK);
}
if (SystemKeyboard != null && SystemKeyboard.currentBanner().equals(KMKeyboard.KM_BANNER_STATE_SUGGESTION)
&& getAssociatedLexicalModel(languageID)==null) {
SystemKeyboard.setCurrentBanner(KMKeyboard.KM_BANNER_STATE_BLANK);
}
if(inappKeyboardChanged) {
InAppKeyboard.setLayoutParams(getKeyboardLayoutParams());
}
if(systemKeyboardChanged) {
SystemKeyboard.setLayoutParams(getKeyboardLayoutParams());
}
}
/**
* Return if the lock screen is locked (prevents keyboard picker menu from being displayed)
* @return boolean