abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorRaphael2022-04-02 10:42:40 -0400
committerGitHub2022-04-02 16:42:40 +0200
commit2dda39f453854a9e9e139131039d57d7c79e26cb (patch)
treee20f69d7f71bccfe8e700269d481ac480e117525
parentfbf8901bdbe717047f0d333c78d173618f7f0f6d (diff)
downloadunexpected-keyboard-2dda39f453854a9e9e139131039d57d7c79e26cb.tar.gz
unexpected-keyboard-2dda39f453854a9e9e139131039d57d7c79e26cb.zip
`Arrows` and `Box` system (#114)
* Add `Arrows` and `Box` accent system
-rw-r--r--res/xml/numeric.xml16
-rw-r--r--res/xml/settings.xml1
-rw-r--r--srcs/juloo.keyboard2/Config.java3
-rw-r--r--srcs/juloo.keyboard2/KeyModifier.java68
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java7
5 files changed, 85 insertions, 10 deletions
diff --git a/res/xml/numeric.xml b/res/xml/numeric.xml
index 348ada1..2ded41c 100644
--- a/res/xml/numeric.xml
+++ b/res/xml/numeric.xml
@@ -3,26 +3,26 @@
<row>
<key width="0.75" key0="esc" key2="~" key4="!"/>
<key width="0.75" key0="(" key2="[" key4="{"/>
- <key key0="7" key1="&lt;" key2="&gt;" key4="↖"/>
- <key key0="8" key2="∞" key4="↑"/>
- <key key0="9" key2="π" key4="↗"/>
+ <key key0="7" key1="&lt;" key2="&gt;"/>
+ <key key0="8" key2="∞"/>
+ <key key0="9" key2="π"/>
<key width="0.75" key0="*" key1="√" key2="×"/>
<key width="0.75" key0="/" key1="%" key3="÷"/>
</row>
<row>
<key width="0.75" key0="tab" key1=";" key2="|" key4="\\"/>
<key width="0.75" key0=")" key2="]" key4="}"/>
- <key key0="4" key4="←"/>
+ <key key0="4" key1="box" key3="arrows"/>
<key key0="5" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
- <key key0="6" key4="→"/>
+ <key key0="6"/>
<key width="0.75" key0="+" key1="Σ" key2="$"/>
<key width="0.75" key0="-" key2="^"/>
</row>
<row>
<key shift="0.35" width="1.15" key0="shift" key2="fn" key4="alt"/>
- <key key0="1" key1="superscript" key2="ordinal" key3="subscript" key4="↙"/>
- <key key0="2" key4="↓"/>
- <key key0="3" key4="↘"/>
+ <key key0="1" key1="superscript" key2="ordinal" key3="subscript"/>
+ <key key0="2"/>
+ <key key0="3"/>
<key width="1.15" key0="backspace" key2="delete"/>
</row>
<row height="0.95">
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 6a76486..a3d4957 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -17,6 +17,7 @@
<CheckBoxPreference android:key="lockable_meta" android:title="Meta" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_sup" android:title="Sup" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_sub" android:title="Sub" android:defaultValue="false"/>
+ <CheckBoxPreference android:key="lockable_box" android:title="Box" android:defaultValue="false"/>
</PreferenceScreen>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_vibrate">
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index ab2d13a..3c436c3 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -126,7 +126,8 @@ final class Config
| (prefs.getBoolean("lockable_fn", false) ? KeyValue.FLAG_FN : 0)
| (prefs.getBoolean("lockable_meta", false) ? KeyValue.FLAG_META : 0)
| (prefs.getBoolean("lockable_sup", false) ? KeyValue.FLAG_ACCENT_SUPERSCRIPT : 0)
- | (prefs.getBoolean("lockable_sub", false) ? KeyValue.FLAG_ACCENT_SUBSCRIPT : 0);
+ | (prefs.getBoolean("lockable_sub", false) ? KeyValue.FLAG_ACCENT_SUBSCRIPT : 0)
+ | (prefs.getBoolean("lockable_box", false) ? KeyValue.FLAG_ACCENT_BOX : 0);
characterSize = prefs.getFloat("character_size", characterSize);
accents = Integer.valueOf(prefs.getString("accents", "1"));
theme = getThemeId(res, prefs.getString("theme", ""));
diff --git a/srcs/juloo.keyboard2/KeyModifier.java b/srcs/juloo.keyboard2/KeyModifier.java
index 58355c1..dc81195 100644
--- a/srcs/juloo.keyboard2/KeyModifier.java
+++ b/srcs/juloo.keyboard2/KeyModifier.java
@@ -139,6 +139,74 @@ class KeyModifier
case 'o': return 'ₒ';
default: return c;
}
+ case KeyValue.FLAG_ACCENT_ARROWS:
+ if ((flags & KeyValue.FLAG_SHIFT) == 0)
+ {
+ switch (c)
+ {
+ case '1': return '↙';
+ case '2': return '↓';
+ case '3': return '↘';
+ case '4': return '←';
+ case '6': return '→';
+ case '7': return '↖';
+ case '8': return '↑';
+ case '9': return '↗';
+ default: return c;
+ }
+ }
+ else
+ {
+ switch (c)
+ {
+ case '1': return '⇙';
+ case '2': return '⇓';
+ case '3': return '⇘';
+ case '4': return '⇐';
+ case '6': return '⇒';
+ case '7': return '⇖';
+ case '8': return '⇑';
+ case '9': return '⇗';
+ default: return c;
+ }
+ }
+ case KeyValue.FLAG_ACCENT_BOX:
+ if ((flags & KeyValue.FLAG_SHIFT) == 0)
+ {
+ switch (c)
+ {
+ case '1': return '└';
+ case '2': return '┴';
+ case '3': return '┘';
+ case '4': return '├';
+ case '5': return '┼';
+ case '6': return '┤';
+ case '7': return '┌';
+ case '8': return '┬';
+ case '9': return '┐';
+ case '0': return '─';
+ case '.': return '│';
+ default: return c;
+ }
+ }
+ else
+ {
+ switch (c)
+ {
+ case '1': return '╚';
+ case '2': return '╩';
+ case '3': return '╝';
+ case '4': return '╠';
+ case '5': return '╬';
+ case '6': return '╣';
+ case '7': return '╔';
+ case '8': return '╦';
+ case '9': return '╗';
+ case '0': return '═';
+ case '.': return '║';
+ default: return c;
+ }
+ }
default: return c; // Can't happen
}
}
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 74d21aa..2b632e5 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -50,11 +50,14 @@ class KeyValue
public static final int FLAG_ACCENT_CARON = (1 << 26);
public static final int FLAG_ACCENT_MACRON = (1 << 27);
public static final int FLAG_ACCENT_ORDINAL = (1 << 28);
+ public static final int FLAG_ACCENT_ARROWS = (1 << 29);
+ public static final int FLAG_ACCENT_BOX = (1 << 30);
public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 |
FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 |
FLAG_ACCENT_CARON | FLAG_ACCENT_MACRON | FLAG_ACCENT_SUPERSCRIPT |
- FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_ORDINAL | FLAG_ACCENT_RING;
+ FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_ORDINAL | FLAG_ACCENT_ARROWS |
+ FLAG_ACCENT_BOX | FLAG_ACCENT_RING;
// Language specific keys that are removed from the keyboard by default
public static final int FLAG_LOCALIZED = (1 << 25);
@@ -168,6 +171,8 @@ class KeyValue
addModifierKey("superscript", "Sup", FLAG_ACCENT_SUPERSCRIPT | FLAG_SMALLER_FONT);
addModifierKey("subscript", "Sub", FLAG_ACCENT_SUBSCRIPT | FLAG_SMALLER_FONT);
addModifierKey("ordinal", "Ord", FLAG_ACCENT_ORDINAL | FLAG_SMALLER_FONT);
+ addModifierKey("arrows", "Arr", FLAG_ACCENT_ARROWS | FLAG_SMALLER_FONT);
+ addModifierKey("box", "Box", FLAG_ACCENT_BOX | FLAG_SMALLER_FONT);
addModifierKey("fn", "Fn", FLAG_FN | FLAG_SMALLER_FONT);
addModifierKey("meta", "◆", FLAG_META);