summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/KeyboardView.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-10-12 18:50:04 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-10-14 17:49:48 +0900
commita0e4f40994f779ad98268921c63d6535ad04224f (patch)
treefa5282d0d50dc697a5338fc7bb1088bdbde3a38a /java/src/com/android/inputmethod/keyboard/KeyboardView.java
parented6bc82d9785372c407e1a4f563ae7d30c479b8a (diff)
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
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyboardView.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java10
1 files changed, 8 insertions, 2 deletions
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(