abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Config.java
diff options
context:
space:
mode:
authorJules Aguillon2022-11-13 00:24:23 +0100
committerJules Aguillon2022-11-13 00:24:23 +0100
commit51b330c6168a8b0e0c16482254d4674fbe5476c7 (patch)
treebc3b05120d606e386269322e7fab2694e20ee845 /srcs/juloo.keyboard2/Config.java
parent815e30a505eb6766e29d85c2e1a5d8f4da9c83d3 (diff)
downloadunexpected-keyboard-51b330c6168a8b0e0c16482254d4674fbe5476c7.tar.gz
unexpected-keyboard-51b330c6168a8b0e0c16482254d4674fbe5476c7.zip
Allow switching quickly between two layouts
A new option allow to choose a secondary layout, the switching key is placed on the top edge of the space bar. The "Programming layout" option was basically doing that but it was possible to choose from a few layouts only. It is improved and renamed. The 'LayoutListPreference' allows setting the string for the first entry but otherwise share the rest of the array. Add nice icons from materialdesignicons.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
-rw-r--r--srcs/juloo.keyboard2/Config.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index b2c23a5..6c1dced 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -25,7 +25,7 @@ final class Config
// From preferences
public int layout; // Or '-1' for the system defaults
- public int programming_layout; // Or '-1' for none
+ public int second_layout; // Or '-1' for none
public boolean show_numpad = false;
public float swipe_dist_px;
public boolean vibrateEnabled;
@@ -46,7 +46,7 @@ final class Config
// Dynamically set
public boolean shouldOfferSwitchingToNextInputMethod;
- public boolean shouldOfferSwitchingToProgramming;
+ public boolean shouldOfferSwitchingToSecond;
public String actionLabel; // Might be 'null'
public int actionId; // Meaningful only when 'actionLabel' isn't 'null'
public boolean swapEnterActionKey; // Swap the "enter" and "action" keys
@@ -65,7 +65,7 @@ final class Config
sublabelTextSize = 0.22f;
// default values
layout = -1;
- programming_layout = -1;
+ second_layout = -1;
vibrateEnabled = true;
longPressTimeout = 600;
longPressInterval = 65;
@@ -81,7 +81,7 @@ final class Config
refresh(res);
// initialized later
shouldOfferSwitchingToNextInputMethod = false;
- shouldOfferSwitchingToProgramming = false;
+ shouldOfferSwitchingToSecond = false;
actionLabel = null;
actionId = 0;
swapEnterActionKey = false;
@@ -115,10 +115,8 @@ final class Config
{
keyboardHeightPercent = _prefs.getInt("keyboard_height", 35);
}
- String layout_s = _prefs.getString("layout", "system");
- layout = layout_s.equals("system") ? -1 : layoutId_of_string(layout_s);
- String prog_layout_s = _prefs.getString("programming_layout", "none");
- programming_layout = prog_layout_s.equals("none") ? -1 : layoutId_of_string(prog_layout_s);
+ layout = layoutId_of_string(_prefs.getString("layout", "none"));
+ second_layout = layoutId_of_string(_prefs.getString("second_layout", "none"));
// The swipe distance is defined relatively to the "exact physical pixels
// per inch of the screen", which isn't affected by the scaling settings.
// Take the mean of both dimensions as an approximation of the diagonal.
@@ -185,8 +183,8 @@ final class Config
case ACTION:
return (swapEnterActionKey && action_key != null) ?
KeyValue.getKeyByName("enter") : action_key;
- case SWITCH_PROGRAMMING:
- return shouldOfferSwitchingToProgramming ? key : null;
+ case SWITCH_SECOND:
+ return shouldOfferSwitchingToSecond ? key : null;
}
break;
case Keyevent:
@@ -249,6 +247,7 @@ final class Config
{
switch (name)
{
+ case "system": case "none": return -1;
case "azerty": return R.xml.azerty;
case "bangla": return R.xml.bangla;
case "bgph1": return R.xml.local_bgph1;