abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Config.java
diff options
context:
space:
mode:
authorJules Aguillon2023-01-30 23:58:47 +0100
committerJules Aguillon2023-01-30 23:58:47 +0100
commit540384bb0a29b9e43dd4fe69fd5fc8f380fd6cbd (patch)
treecf7a213bb421680a1eec252c5d13e04d757cba24 /srcs/juloo.keyboard2/Config.java
parentc7184303e9e291487641324468ec60417ef47bf7 (diff)
downloadunexpected-keyboard-540384bb0a29b9e43dd4fe69fd5fc8f380fd6cbd.tar.gz
unexpected-keyboard-540384bb0a29b9e43dd4fe69fd5fc8f380fd6cbd.zip
Add optional number row
An option is added to enable an extra number row at the top of the keyboard. Digits are removed from the keyboard while the number row is visible.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
-rw-r--r--srcs/juloo.keyboard2/Config.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 5ff7951..bd0db23 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -28,6 +28,7 @@ final class Config
public boolean show_numpad = false;
// From the 'numpad_layout' option, also apply to the numeric pane.
public boolean inverse_numpad = false;
+ public boolean number_row;
public float swipe_dist_px;
public float slide_step_px;
public boolean vibrateEnabled;
@@ -111,6 +112,7 @@ final class Config
second_layout = tweak_secondary_layout(layout_of_string(res, _prefs.getString("second_layout", "none")));
custom_layout = KeyboardData.load_string(_prefs.getString("custom_layout", ""));
inverse_numpad = _prefs.getString("numpad_layout", "default").equals("low_first");
+ number_row = _prefs.getBoolean("number_row", false);
// 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.
@@ -165,6 +167,7 @@ final class Config
* - Remove "localized" keys from other locales (not in 'extra_keys')
* - Replace the action key to show the right label
* - Swap the enter and action keys
+ * - Add the optional numpad and number row
*/
public KeyboardData modify_layout(KeyboardData kw)
{
@@ -176,8 +179,11 @@ final class Config
if (extra_keys_subtype != null)
extra_keys.addAll(extra_keys_subtype);
extra_keys.addAll(extra_keys_param);
+ boolean number_row = this.number_row && !show_numpad;
if (show_numpad)
KeyboardData.num_pad.getKeys(remove_keys);
+ if (number_row)
+ KeyboardData.number_row.getKeys(remove_keys);
kw = kw.mapKeys(new KeyboardData.MapKeyValues() {
public KeyValue apply(KeyValue key, boolean localized)
{
@@ -223,6 +229,8 @@ final class Config
});
if (show_numpad)
kw = kw.addNumPad();
+ if (number_row)
+ kw = kw.addNumberRow();
if (extra_keys.size() > 0)
kw = kw.addExtraKeys(extra_keys.iterator());
return kw;