chore(android): Cleanup

This commit is contained in:
Darcy Wong 2023-11-07 11:02:21 +07:00
parent 8630121828
commit 1e30002392
4 changed files with 11 additions and 14 deletions

View file

@ -36,7 +36,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.health.SystemHealthManager;
import android.text.InputType;
import android.util.Log;
import android.view.HapticFeedbackConstants;
@ -1423,7 +1422,7 @@ public final class KMManager {
* @return boolean - Success
*/
public static boolean setBannerOptions(boolean mayPredict) {
String url = KMString.format("setBannerOptions(%b)", mayPredict); // TODO?
String url = KMString.format("setBannerOptions(%b)", mayPredict);
if (InAppKeyboard != null) {
InAppKeyboard.loadJavascript(url);
}

View file

@ -24,8 +24,8 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
public static Context context;
private KMTextView textView;
// Paths relative to assets folder for banner themes
private static String BANNER_THEME_GREEN = "svg/green_banner.svg";
// Paths relative to assets folder for banner themes. Change this for custom banner
private static String BANNER_THEME_KMSAMPLE1 = "svg/green_banner.svg";
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -58,7 +58,6 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
KMManager.addKeyboard(this, kbInfo);
// Add a dictionary
/*
HashMap<String, String>lexicalModelInfo = new HashMap<String, String>();
lexicalModelInfo.put(KMManager.KMKey_PackageID, "example.ta.wordlist");
lexicalModelInfo.put(KMManager.KMKey_LanguageID, "ta");
@ -67,7 +66,6 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
lexicalModelInfo.put(KMManager.KMKey_LexicalModelVersion, "1.0");
KMManager.addLexicalModel(context, lexicalModelInfo);
KMManager.registerAssociatedLexicalModel("ta");
*/
}
@Override
@ -129,9 +127,10 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
public void onKeyboardShown() {
// Handle Keyman keyboard shown event here if needed
// Set the in-app banner image here. Doesn't work in KMManager.init
KMManager.setBannerImage(KeyboardType.KEYBOARD_TYPE_INAPP, BANNER_THEME_GREEN);
KMManager.setBanner(KeyboardType.KEYBOARD_TYPE_INAPP, KMManager.BannerType.IMAGE);
// Uncomment these lines if the app doesn't use a dictionary
// and wants to set the in-app banner image here.
//KMManager.setBannerImage(KeyboardType.KEYBOARD_TYPE_INAPP, BANNER_THEME_KMSAMPLE1);
//KMManager.setBanner(KeyboardType.KEYBOARD_TYPE_INAPP, KMManager.BannerType.IMAGE);
}
@Override

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1" width="1024px" height="256px"><path fill="#00FF00" d="m0,0v1h1V0"/></svg>

After

Width:  |  Height:  |  Size: 131 B

View file

@ -27,10 +27,8 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
private static View inputView = null;
private KMHardwareKeyboardInterpreter interpreter = null;
// Theme for light-blue banner. Replace the string with your custom theme by uploading a color image to https://elmah.io/tools/base64-image-encoder/
public static final String KM_BANNER_THEME_KMSAMPLE2 =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYYAAAAaCAYAAACzU/tpAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUAVGh1IDI2IE9jdCAyMDIzIDA5OjMwOjI5IEFNICswN6UZZDEAAAB5SURBVHic7dUxAYAwAMCwMbdTiA8MsWdPFcCRKOjXa93POwDgmF8HAPAvxgBAGAMAYQwAhDEAEMYAQBgDAGEMAIQxABDGAEAYAwBhDACEMQAQxgBAGAMAYQwAhDEAEMYAQBgDAGEMAIQxABDGAEAYAwBhDACEMQAQGyB8AyU9yxQXAAAAAElFTkSuQmCC";
// Paths relative to assets folder for banner themes. Change this for custom banner
public static final String BANNER_THEME_KMSAMPLE2 = "svg/green_banner.svg";
/**
* Main initialization of the input method component. Be sure to call
@ -75,7 +73,7 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
// Uncomment these two lines if keyboard doesn't use a dictionary.
// The suggestion banner is replaced with this color.
//KMManager.setBannerImage(KeyboardType.KEYBOARD_TYPE_SYSTEM, KM_BANNER_THEME_KMSAMPLE2);
//KMManager.setBannerImage(KeyboardType.KEYBOARD_TYPE_SYSTEM, BANNER_THEME_KMSAMPLE2);
//KMManager.setBanner(KeyboardType.KEYBOARD_TYPE_SYSTEM, KMManager.BannerType.IMAGE);
}