abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/LayoutsPreference.java
diff options
context:
space:
mode:
authorJules Aguillon2023-12-17 12:41:19 +0100
committerJules Aguillon2023-12-17 12:41:19 +0100
commitd7c230e173aeb039565d479af7b6f00776a70626 (patch)
tree6839706b7ce8bf71b881b2f7a11e4eafba710037 /srcs/juloo.keyboard2/LayoutsPreference.java
parent478d8082f41b7859356c3f9662e1c46327b4b76e (diff)
downloadunexpected-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/juloo.keyboard2/LayoutsPreference.java')
-rw-r--r--srcs/juloo.keyboard2/LayoutsPreference.java18
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)