From c22ca7302c16773dbe1971323034dd6e23d9611b Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 15 Apr 2021 23:23:31 +0200 Subject: Stateless KeyboardData class It was a pain to use. It was also a pain to write this though. --- srcs/juloo.keyboard2/Keyboard2View.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'srcs/juloo.keyboard2/Keyboard2View.java') diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 041b881..84159b2 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -87,7 +87,10 @@ public class Keyboard2View extends View public void setKeyboard(KeyboardData keyboard) { - _keyboard = keyboard; + if (_config.disableAccentKeys) + _keyboard = keyboard.removeKeys(new KeyboardData.RemoveKeysByFlags(KeyValue.FLAGS_ACCENTS)); + else + _keyboard = keyboard; reset(); } @@ -195,7 +198,7 @@ public class Keyboard2View extends View if (touchY < y || touchY >= (y + _config.keyHeight)) continue ; x = (KEY_PER_ROW * _keyWidth - row.getWidth(_keyWidth)) / 2 + _config.horizontalMargin; - for (KeyboardData.Key key : row) + for (KeyboardData.Key key : row.getKeys()) { keyW = _keyWidth * key.width; if (touchX >= x && touchX < (x + keyW)) @@ -343,7 +346,7 @@ public class Keyboard2View extends View for (KeyboardData.Row row : _keyboard.getRows()) { x = (KEY_PER_ROW * _keyWidth - row.getWidth(_keyWidth)) / 2f + _config.horizontalMargin; - for (KeyboardData.Key k : row) + for (KeyboardData.Key k : row.getKeys()) { float keyW = _keyWidth * k.width; KeyDown keyDown = getKeyDown(k); -- cgit v1.2.3