From a0e4f40994f779ad98268921c63d6535ad04224f Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 12 Oct 2011 18:50:04 +0900 Subject: Special handling of one key mini-keyboard to mitigate visual flicker Use pre-computed width and height of mini keyboard if * Popup key preview is enabled * The mini keyboard has only one key * Pre-computed width and height are specified Bug: 5248783 Change-Id: I53475698e87d5bd67d36e63323c25a9e9f18fbb1 --- java/src/com/android/inputmethod/keyboard/KeyboardView.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'java/src/com/android/inputmethod/keyboard/KeyboardView.java') diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 6af4123c9..6492c00fa 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -100,7 +100,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { // Key preview private final int mKeyPreviewLayoutId; - private final KeyPreviewDrawParams mKeyPreviewDrawParams; + protected final KeyPreviewDrawParams mKeyPreviewDrawParams; private boolean mShowKeyPreviewPopup = true; private final int mDelayBeforePreview; private int mDelayAfterPreview; @@ -284,11 +284,13 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } } - private static class KeyPreviewDrawParams { + protected static class KeyPreviewDrawParams { // XML attributes. public final Drawable mPreviewBackground; public final Drawable mPreviewLeftBackground; public final Drawable mPreviewRightBackground; + public final int mPreviewBackgroundWidth; + public final int mPreviewBackgroundHeight; public final int mPreviewTextColor; public final int mPreviewOffset; public final int mPreviewHeight; @@ -312,6 +314,10 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { setAlpha(mPreviewBackground, PREVIEW_ALPHA); setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA); setAlpha(mPreviewRightBackground, PREVIEW_ALPHA); + mPreviewBackgroundWidth = a.getDimensionPixelSize( + R.styleable.KeyboardView_keyPreviewBackgroundWidth, 0); + mPreviewBackgroundHeight = a.getDimensionPixelSize( + R.styleable.KeyboardView_keyPreviewBackgroundHeight, 0); mPreviewOffset = a.getDimensionPixelOffset( R.styleable.KeyboardView_keyPreviewOffset, 0); mPreviewHeight = a.getDimensionPixelSize( -- cgit v1.2.3