diff options
| author | Jules Aguillon | 2022-11-26 22:30:45 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-11-26 22:30:45 +0100 |
| commit | e745c812691462380695da2275757e3f29bbbdb2 (patch) | |
| tree | 1a6c9e62fffa6085455b9e2323533927a01a292d /srcs/juloo.keyboard2/Config.java | |
| parent | 09d984a1ab597cceab8a416b3f3cbf60bc1a5525 (diff) | |
| download | unexpected-keyboard-e745c812691462380695da2275757e3f29bbbdb2.tar.gz unexpected-keyboard-e745c812691462380695da2275757e3f29bbbdb2.zip | |
Allow using a custom layout
Add an option for specifying an XML layout description as a string.
The option is a bit rough at the moment:
- No documentation, users have to be aware of the keyboard's code to use
this option.
- No error are shown, the layout will fallback to qwerty on error.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Config.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java index 5fb2ab5..8404946 100644 --- a/srcs/juloo.keyboard2/Config.java +++ b/srcs/juloo.keyboard2/Config.java @@ -26,6 +26,7 @@ final class Config // From preferences public KeyboardData layout; // Or 'null' for the system defaults public KeyboardData second_layout; // Or 'null' for none + public KeyboardData custom_layout; // Might be 'null' public boolean show_numpad = false; public float swipe_dist_px; public boolean vibrateEnabled; @@ -66,6 +67,7 @@ final class Config // default values layout = null; second_layout = null; + custom_layout = null; vibrateEnabled = true; longPressTimeout = 600; longPressInterval = 65; @@ -117,6 +119,7 @@ final class Config } layout = layout_of_string(res, _prefs.getString("layout", "none")); second_layout = layout_of_string(res, _prefs.getString("second_layout", "none")); + custom_layout = KeyboardData.load_string(_prefs.getString("custom_layout", "")); // The baseline for the swipe distance correspond to approximately the // width of a key in portrait mode, as most layouts have 10 columns. // Multipled by the DPI ratio because most swipes are made in the diagonals. @@ -252,6 +255,7 @@ final class Config switch (name) { case "system": case "none": return null; + case "custom": if (custom_layout != null) return custom_layout; break; case "azerty": id = R.xml.azerty; break; case "bangla": id = R.xml.bangla; break; case "bgph1": id = R.xml.local_bgph1; break; |
