diff options
| author | Jules Aguillon | 2023-12-17 12:41:19 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2023-12-17 12:41:19 +0100 |
| commit | d7c230e173aeb039565d479af7b6f00776a70626 (patch) | |
| tree | 6839706b7ce8bf71b881b2f7a11e4eafba710037 /srcs | |
| parent | 478d8082f41b7859356c3f9662e1c46327b4b76e (diff) | |
| download | unexpected-keyboard-d7c230e173aeb039565d479af7b6f00776a70626.tar.gz unexpected-keyboard-d7c230e173aeb039565d479af7b6f00776a70626.zip | |
prefs: Use QWERTY (US) as the default custom layout
This layout definition contains some documentation and is a better
default than no text.
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/LayoutsPreference.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/LayoutsPreference.java b/srcs/juloo.keyboard2/LayoutsPreference.java index 313b46f..a9405e6 100644 --- a/srcs/juloo.keyboard2/LayoutsPreference.java +++ b/srcs/juloo.keyboard2/LayoutsPreference.java @@ -151,7 +151,7 @@ public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Lay callback.select(new SystemLayout()); break; case "custom": - select_custom(callback, ""); + select_custom(callback, read_initial_custom_layout()); break; default: callback.select(new NamedLayout(name)); @@ -203,6 +203,22 @@ public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Lay select(callback); } + /** The initial text for the custom layout entry box. The qwerty_us layout is + a good default and contains a bit of documentation. */ + String read_initial_custom_layout() + { + try + { + Resources res = getContext().getResources(); + byte[] raw = res.openRawResource(R.raw.latn_qwerty_us).readAllBytes(); + return new String(raw, "UTF-8"); + } + catch (Exception _e) + { + return ""; + } + } + class LayoutsAddButton extends AddButton { public LayoutsAddButton(Context ctx) |
