diff --git a/app/src/main/java/helium314/keyboard/keyboard/MainKeyboardView.java b/app/src/main/java/helium314/keyboard/keyboard/MainKeyboardView.java index 59926cccf..d6a31e066 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/MainKeyboardView.java +++ b/app/src/main/java/helium314/keyboard/keyboard/MainKeyboardView.java @@ -83,7 +83,6 @@ import java.util.WeakHashMap; * @attr ref R.styleable#MainKeyboardView_ignoreAltCodeKeyTimeout * @attr ref R.styleable#MainKeyboardView_keyPreviewLayout * @attr ref R.styleable#MainKeyboardView_keyPreviewOffset - * @attr ref R.styleable#MainKeyboardView_keyPreviewHeight * @attr ref R.styleable#MainKeyboardView_popupKeysKeyboardLayout * @attr ref R.styleable#MainKeyboardView_popupKeysKeyboardForActionLayout * @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha diff --git a/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewChoreographer.java b/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewChoreographer.java index c2a1f0105..2a09551f2 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewChoreographer.java +++ b/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewChoreographer.java @@ -89,7 +89,7 @@ public final class KeyPreviewChoreographer { keyPreviewView.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); mParams.setGeometry(keyPreviewView); final int previewWidth = keyPreviewView.getMeasuredWidth(); - final int previewHeight = mParams.mPreviewHeight; + final int previewHeight = keyPreviewView.getMeasuredHeight(); final int keyDrawWidth = key.getDrawWidth(); // The key preview is horizontally aligned with the center of the visible part of the // parent key. If it doesn't fit in this {@link KeyboardView}, it is moved inward to fit and diff --git a/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewDrawParams.java b/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewDrawParams.java index 132e47ffa..013131a23 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewDrawParams.java +++ b/app/src/main/java/helium314/keyboard/keyboard/internal/KeyPreviewDrawParams.java @@ -15,7 +15,6 @@ import helium314.keyboard.latin.settings.Settings; public final class KeyPreviewDrawParams { // XML attributes of {@link MainKeyboardView}. public final int mPreviewOffset; - public final int mPreviewHeight; public final int mPreviewBackgroundResId; private boolean mShowPopup = true; @@ -47,13 +46,6 @@ public final class KeyPreviewDrawParams { public KeyPreviewDrawParams(final TypedArray mainKeyboardViewAttr) { mPreviewOffset = mainKeyboardViewAttr.getDimensionPixelOffset( R.styleable.MainKeyboardView_keyPreviewOffset, 0); - // crashes when too small (or just < 1?) - final float heightScale = (float) Math.max(1f, Math.sqrt(Settings.getInstance().getCurrent().mKeyboardHeightScale)); - // todo: further scaling issue - // key height and thus text height (in pixels) don't change with display density, - // but keyPreviewHeight does -> how to do it right? - mPreviewHeight = (int) (mainKeyboardViewAttr.getDimensionPixelSize( - R.styleable.MainKeyboardView_keyPreviewHeight, 0) * heightScale); mPreviewBackgroundResId = mainKeyboardViewAttr.getResourceId( R.styleable.MainKeyboardView_keyPreviewBackground, 0); } @@ -68,10 +60,11 @@ public final class KeyPreviewDrawParams { public void setGeometry(final View previewTextView) { final int previewWidth = previewTextView.getMeasuredWidth(); + final int previewHeight = previewTextView.getMeasuredHeight(); // The width and height of visible part of the key preview background. The content marker // of the background 9-patch have to cover the visible part of the background. mVisibleWidth = previewWidth - previewTextView.getPaddingLeft() - previewTextView.getPaddingRight(); - mVisibleHeight = mPreviewHeight - previewTextView.getPaddingTop() - previewTextView.getPaddingBottom(); + mVisibleHeight = previewHeight - previewTextView.getPaddingTop() - previewTextView.getPaddingBottom(); // The distance between the top edge of the parent key and the bottom of the visible part // of the key preview background. setVisibleOffset(-previewTextView.getPaddingBottom() / 2); diff --git a/app/src/main/res/values-land/config.xml b/app/src/main/res/values-land/config.xml index f68b9a5c7..cde49ee1b 100644 --- a/app/src/main/res/values-land/config.xml +++ b/app/src/main/res/values-land/config.xml @@ -29,9 +29,7 @@ -22.4dp 1.6dp - 80dp 0dp - 122dp 90% 65% 65% diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index bb0c40edd..463b87b1d 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -102,8 +102,6 @@ - - diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index a25ef277e..bc22125eb 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -35,9 +35,7 @@ -26.4dp 40.0dp - 80dp 0dp - 111dp 82% 55% 55% diff --git a/app/src/main/res/values/themes-holo_base.xml b/app/src/main/res/values/themes-holo_base.xml index bd6d242d8..1c0217d65 100644 --- a/app/src/main/res/values/themes-holo_base.xml +++ b/app/src/main/res/values/themes-holo_base.xml @@ -56,7 +56,6 @@ parent="KeyboardView.HoloBase" > @drawable/keyboard_key_feedback_holo_white - @dimen/config_key_preview_height_holo @dimen/config_key_preview_offset_holo 1.0 @color/spacebar_text_shadow_color_holo diff --git a/app/src/main/res/values/themes-lxx-base.xml b/app/src/main/res/values/themes-lxx-base.xml index d954130fd..6fd7fc51a 100644 --- a/app/src/main/res/values/themes-lxx-base.xml +++ b/app/src/main/res/values/themes-lxx-base.xml @@ -42,7 +42,6 @@ > @layout/popup_keys_keyboard_for_action_lxx @drawable/keyboard_key_feedback_lxx_light - @dimen/config_key_preview_height_lxx @dimen/config_key_preview_offset_lxx -1.0 diff --git a/app/src/main/res/values/themes-rounded-base.xml b/app/src/main/res/values/themes-rounded-base.xml index a8ff93204..d249954f1 100644 --- a/app/src/main/res/values/themes-rounded-base.xml +++ b/app/src/main/res/values/themes-rounded-base.xml @@ -48,7 +48,6 @@ > @layout/popup_keys_keyboard_for_action_lxx @drawable/keyboard_key_feedback_lxx_light - @dimen/config_key_preview_height_lxx @dimen/config_key_preview_offset_lxx -1.0