diff options
| author | Jules Aguillon | 2022-03-15 11:49:32 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-03-15 18:42:29 +0100 |
| commit | f9cd4ca2d8c46679d1f00517ea0f1ae9dfb8d75a (patch) | |
| tree | d9c54bcb2792acff27766795b942582ac24b9d41 /srcs | |
| parent | 9bb7c7e66f6c22bbe341ae88b853ffad40fcbe31 (diff) | |
| download | unexpected-keyboard-f9cd4ca2d8c46679d1f00517ea0f1ae9dfb8d75a.tar.gz unexpected-keyboard-f9cd4ca2d8c46679d1f00517ea0f1ae9dfb8d75a.zip | |
Log editor infos while debugging
Useful when debugging why the keyboard doesn't work as expected with a
specific app.
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 0cc2512..83edb21 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -18,6 +18,8 @@ import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; +import android.util.Log; +import android.util.LogPrinter; import java.util.List; import java.util.HashSet; import java.util.Set; @@ -25,12 +27,16 @@ import java.util.Set; public class Keyboard2 extends InputMethodService implements SharedPreferences.OnSharedPreferenceChangeListener { + static private final String TAG = "Keyboard2"; + private Keyboard2View _keyboardView; private int _currentTextLayout; private ViewGroup _emojiPane = null; private Config _config; + private boolean _debug_logs = false; + private KeyboardData getLayout(int resId) { return KeyboardData.load(getResources(), resId); @@ -47,6 +53,7 @@ public class Keyboard2 extends InputMethodService _config.refresh(this); _keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard); _keyboardView.reset(); + _debug_logs = getResources().getBoolean(R.bool.debug_logs); } private List<InputMethodSubtype> getEnabledSubtypes(InputMethodManager imm) @@ -182,6 +189,16 @@ public class Keyboard2 extends InputMethodService } } + 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); + } + @Override public void onStartInputView(EditorInfo info, boolean restarting) { @@ -192,6 +209,8 @@ public class Keyboard2 extends InputMethodService else _keyboardView.setKeyboard(getLayout(_currentTextLayout)); setInputView(_keyboardView); + if (_debug_logs) + log_editor_info(info); } @Override |
