Skip to content

Commit abb35a6

Browse files
committed
Create new attribute keyIsPreviewable
for Key, inherited from Row.keysArePreviewable, inherited from Keyboard.keysArePreviewable
1 parent 4f8cb03 commit abb35a6

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

app/src/main/java/io/github/yawnoc/strokeinput/Key.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class Key {
3939
public boolean isShiftable;
4040
public boolean isExtendedLeft;
4141
public boolean isExtendedRight;
42+
public boolean isPreviewable;
4243
public String valueText;
4344
public String displayText; // overrides valueText drawn
4445
public String valueTextShifted; // overrides displayText drawn when shifted
@@ -106,6 +107,11 @@ public Key(
106107
attributesArray.getBoolean(R.styleable.Key_keyIsExtendedLeft, false);
107108
isExtendedRight =
108109
attributesArray.getBoolean(R.styleable.Key_keyIsExtendedRight, false);
110+
isPreviewable =
111+
attributesArray.getBoolean(
112+
R.styleable.Row_keysArePreviewable,
113+
parentRow.keysArePreviewable
114+
);
109115

110116
valueText = attributesArray.getString(R.styleable.Key_keyValueText);
111117
displayText = attributesArray.getString(R.styleable.Key_keyDisplayText);

app/src/main/java/io/github/yawnoc/strokeinput/Keyboard.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class Keyboard {
6868

6969
// Key properties
7070
public boolean keysAreShiftable;
71+
public boolean keysArePreviewable;
7172
public int keyWidth;
7273
public int keyHeight;
7374
public int keyFillColour;
@@ -208,6 +209,11 @@ private void parseKeyboardAttributes(
208209

209210
keysAreShiftable =
210211
attributesArray.getBoolean(R.styleable.Keyboard_keysAreShiftable, false);
212+
keysArePreviewable =
213+
attributesArray.getBoolean(
214+
R.styleable.Keyboard_keysArePreviewable,
215+
true
216+
);
211217

212218
keyWidth =
213219
Valuey.getDimensionOrFraction(

app/src/main/java/io/github/yawnoc/strokeinput/Row.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class Row {
4040

4141
// Key properties
4242
public final boolean keysAreShiftable;
43+
public final boolean keysArePreviewable;
4344
public final int keyWidth;
4445
public final int keyHeight;
4546
public final int keyFillColour;
@@ -80,6 +81,11 @@ public Row(
8081
R.styleable.Row_keysAreShiftable,
8182
parentKeyboard.keysAreShiftable
8283
);
84+
keysArePreviewable =
85+
attributesArray.getBoolean(
86+
R.styleable.Row_keysArePreviewable,
87+
parentKeyboard.keysArePreviewable
88+
);
8389

8490
keyWidth =
8591
Valuey.getDimensionOrFraction(

app/src/main/res/values/attrs.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<declare-styleable name="Keyboard">
44
<attr name="keyboardFillColour" format="color" />
55
<attr name="keysAreShiftable" format="boolean" />
6+
<attr name="keysArePreviewable" format="boolean" />
67
<attr name="keyWidth" format="dimension|fraction" />
78
<attr name="keyHeight" format="dimension|fraction" />
89
<attr name="keyFillColour" format="color" />
@@ -19,6 +20,7 @@
1920
<declare-styleable name="Row">
2021
<attr name="rowOffsetX" format="dimension|fraction" />
2122
<attr name="keysAreShiftable" />
23+
<attr name="keysArePreviewable" />
2224
<attr name="keyWidth" />
2325
<attr name="keyHeight" />
2426
<attr name="keyFillColour" />
@@ -39,6 +41,7 @@
3941
<attr name="keyIsShiftable" format="boolean" />
4042
<attr name="keyIsExtendedLeft" format="boolean" />
4143
<attr name="keyIsExtendedRight" format="boolean" />
44+
<attr name="keyIsPreviewable" format="boolean" />
4245
<attr name="keyValueText" format="string" />
4346
<attr name="keyDisplayText" format="string" />
4447
<attr name="keyValueTextShifted" format="string" />

0 commit comments

Comments
 (0)