From 8dc085048acff3ec1d46bdb3eafca0ac0773be25 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Tue, 5 Jan 2021 00:18:24 +0100 Subject: [PATCH] Remove the preview popup This was a half-finished feature: - Dangerous when typing passwords - Caused crash on some devices - Ugly (on its own but also blinking when sliding and not fixed in size) --- res/drawable/preview_popup.xml | 11 --- res/values/colors.xml | 3 - res/values/dimens.xml | 5 - res/values/strings.xml | 4 - res/xml/settings.xml | 8 -- srcs/juloo.keyboard2/Config.java | 7 -- srcs/juloo.keyboard2/KeyPreviewPopup.java | 108 ---------------------- srcs/juloo.keyboard2/Keyboard2View.java | 21 ----- 8 files changed, 167 deletions(-) delete mode 100644 res/drawable/preview_popup.xml delete mode 100644 srcs/juloo.keyboard2/KeyPreviewPopup.java diff --git a/res/drawable/preview_popup.xml b/res/drawable/preview_popup.xml deleted file mode 100644 index ce9a7fa..0000000 --- a/res/drawable/preview_popup.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/res/values/colors.xml b/res/values/colors.xml index 82f3e10..c20ba3a 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -6,9 +6,6 @@ #FFFFFF #229933 #A0A0A0 - #FFFFFF - #202020 - #666666 #202020 #FFFFFF @color/emoji_button_bg diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 7b19e38..f32b786 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -9,11 +9,6 @@ 4dp 16dp 10dp - 16dp - 6dp - 1dp - 4dp - 8dp 56dp 250dp diff --git a/res/values/strings.xml b/res/values/strings.xml index f62d533..0d2adeb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -34,8 +34,4 @@ %sdp Horizontal margin %sdp - - Preview - Preview - Enable/Disable preview on key down diff --git a/res/xml/settings.xml b/res/xml/settings.xml index 769547a..e25f185 100644 --- a/res/xml/settings.xml +++ b/res/xml/settings.xml @@ -52,14 +52,6 @@ max="50" /> - - - _minWidth) - setMinWidth(width); - x = (_anchor.getMeasuredWidth() - width) / 2; - y = -(height + _config.previewBottomMargin); - if (!isShowing()) - showAtLocation(_anchor, Gravity.NO_GRAVITY, x, y); - update(x, y, width, height); - } -} diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 86c78ab..041b881 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -34,13 +34,6 @@ public class Keyboard2View extends View private Handler _handler; private static int _currentWhat = 0; - private KeyPreviewPopup _previewPopup; - - /* - ** TODO: settings: preview_text_size - ** TODO: settings: preview_timeout - ** TODO: disable preview in password fields - */ private Config _config; private float _keyWidth; @@ -64,7 +57,6 @@ public class Keyboard2View extends View _vibratorService = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); _handler = new Handler(this); _config = ((Keyboard2)context).getConfig(); - _previewPopup = new KeyPreviewPopup(this, _config); _keyBgPaint.setColor(getResources().getColor(R.color.key_bg)); _keyDownBgPaint.setColor(getResources().getColor(R.color.key_down_bg)); _keyLabelPaint = initLabelPaint(_keyLabelPaint, Paint.Align.CENTER, R.color.key_label, R.dimen.label_text_size, null); @@ -273,24 +265,12 @@ public class Keyboard2View extends View { if (key.value != null && (key.flags & (KeyValue.FLAG_LOCKED | KeyValue.FLAG_NOCHAR)) == 0) ((Keyboard2)getContext()).handleKeyUp(key.value, _flags); - // previewNextKeyDown - if (!_config.previewEnabled) - return ; - for (KeyDown k : _downKeys) - if ((k.value.getFlags() & (KeyValue.FLAG_KEY_FONT | KeyValue.FLAG_NOREPEAT | KeyValue.FLAG_NOCHAR)) == 0) - { - _previewPopup.setPreview(k.value, _flags); - return ; - } - _previewPopup.setPreview(null, 0); } private void handleKeyDown(KeyValue key) { if (key == null) return ; - if (_config.previewEnabled && (key.getFlags() & (KeyValue.FLAG_KEY_FONT | KeyValue.FLAG_NOREPEAT | KeyValue.FLAG_NOCHAR)) == 0) - _previewPopup.setPreview(key, _flags); vibrate(); } @@ -395,7 +375,6 @@ public class Keyboard2View extends View public void onDetachedFromWindow() { super.onDetachedFromWindow(); - _previewPopup.forceDismiss(); } private void drawLabel(Canvas canvas, KeyValue k, float x, float y, boolean locked)