Skip to content

Commit 1f1914d

Browse files
committed
Implement abort on move outside keyboard
by adding a 1 px gutter at the top of the keyboard. The fix in c40fbe2 already makes typing abort when the user moves onto a pixel not occupied by a key. But that only works for pixels inside the InputContainer. This commit ensures that there is a 1 px row which is key-free, at the top of our InputContainer.
1 parent 8fcf9ad commit 1f1914d

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
- Fixed NullPointerException for `onSinglePointerTouchEvent` of null key
77
- Fixed key press colour change dependent on activity background
8+
- Implemented abort on move outside keyboard (by adding 1 px gutter)
89
- Reduced space bar height
910
- Reduced digit row key height
1011
- Added fillColour attribute for the keyboard as a whole

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
- Candidates bar
3333
- Keyboard
3434
TODO:
35-
- Cancel key press if move outside keyboard
3635
- Switch to symbols keyboard
3736
- Candidates
3837
*/

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ public class Keyboard {
4141
private static final int DEFAULT_KEY_TEXT_COLOUR = Color.WHITE;
4242
private static final int DEFAULT_KEY_TEXT_SIZE_SP = 32;
4343
private final int default_key_text_size_px;
44+
4445
private static final int DEFAULT_KEYBOARD_FILL_COLOUR = Color.BLACK;
46+
private static final int KEYBOARD_GUTTER_HEIGHT_PX = 1;
4547

4648
// Key properties
4749
private int keyWidth;
@@ -330,12 +332,12 @@ private void loadKeyboard(
330332
boolean inRow = false;
331333

332334
int x = 0;
333-
int y = 0;
335+
int y = KEYBOARD_GUTTER_HEIGHT_PX;
334336
Key key = null;
335337
Row row = null;
336338

337-
int maximumX = 0;
338-
int maximumY = 0;
339+
int maximumX = x;
340+
int maximumY = y;
339341

340342
Resources resources = context.getResources();
341343

0 commit comments

Comments
 (0)