From 15ce200ce3f9d19f1a1f1fb43f176bf511f14271 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Tue, 28 Dec 2021 17:47:18 +0100 Subject: Separate "handler" code As with the previous commit, remove casts of the context. The "handler" object is referenced in the "config" object for now. --- srcs/juloo.keyboard2/Config.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/Config.java') diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index e7a793a..73c43be 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -34,7 +34,9 @@ final class Config public boolean shouldOfferSwitchingToNextInputMethod; public int accent_flags_to_remove; - private Config(Context context) + public final IKeyEventHandler handler; + + private Config(Context context, IKeyEventHandler h) { Resources res = context.getResources(); // static values @@ -61,6 +63,7 @@ final class Config // initialized later shouldOfferSwitchingToNextInputMethod = false; accent_flags_to_remove = 0; + handler = h; } /* @@ -120,13 +123,18 @@ final class Config private static Config _globalConfig = null; - public static void initGlobalConfig(Context context) + public static void initGlobalConfig(Context context, IKeyEventHandler handler) { - _globalConfig = new Config(context); + _globalConfig = new Config(context, handler); } public static Config globalConfig() { return _globalConfig; } + + public static interface IKeyEventHandler + { + public void handleKeyUp(KeyValue value, int flags); + } } -- cgit v1.2.3