From 8b2c07c9cbb783149bfa58c2d375472d87aa2e57 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 19 Jul 2023 23:28:33 +0200 Subject: Refactor: Centralize logging in a static class This new class will help write more logs. The LogPrinter is no longer created everytime the keyboard is opened. An error log is added if failing to load the custom extra keys. --- srcs/juloo.keyboard2/Keyboard2.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'srcs/juloo.keyboard2/Keyboard2.java') diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 4b82c33..48e60db 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -26,8 +26,6 @@ import java.util.Set; public class Keyboard2 extends InputMethodService implements SharedPreferences.OnSharedPreferenceChangeListener { - static private final String TAG = "Keyboard2"; - private Keyboard2View _keyboardView; private KeyEventHandler _keyeventhandler; // If not 'null', the layout to use instead of [_currentTextLayout]. @@ -40,8 +38,6 @@ public class Keyboard2 extends InputMethodService private Config _config; - private boolean _debug_logs = false; - /** Layout currently visible. */ KeyboardData current_layout() { @@ -87,7 +83,7 @@ public class Keyboard2 extends InputMethodService _config = Config.globalConfig(); _keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard); _keyboardView.reset(); - _debug_logs = getResources().getBoolean(R.bool.debug_logs); + Logs.set_debug_logs(getResources().getBoolean(R.bool.debug_logs)); } private List getEnabledSubtypes(InputMethodManager imm) @@ -239,16 +235,6 @@ public class Keyboard2 extends InputMethodService return null; } - private void log_editor_info(EditorInfo info) - { - LogPrinter p = new LogPrinter(Log.DEBUG, TAG); - info.dump(p, ""); - if (info.extras != null) - Log.d(TAG, "extras: "+info.extras.toString()); - Log.d(TAG, "swapEnterActionKey: "+_config.swapEnterActionKey); - Log.d(TAG, "actionLabel: "+_config.actionLabel); - } - private void refresh_special_layout(EditorInfo info) { switch (info.inputType & InputType.TYPE_MASK_CLASS) @@ -274,8 +260,7 @@ public class Keyboard2 extends InputMethodService _keyboardView.setKeyboard(current_layout()); _keyeventhandler.started(info); setInputView(_keyboardView); - if (_debug_logs) - log_editor_info(info); + Logs.debug_startup_input_view(info, _config); } @Override -- cgit v1.2.3