diff options
Diffstat (limited to 'java/src/com')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/MainKeyboardView.java | 6 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java | 13 |
2 files changed, 11 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 71e3eeeaf..f3cfae203 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -484,11 +484,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack return; } - final TextView previewTextView = mKeyPreviewChoreographer.getKeyPreviewTextView( - key, getContext()); locatePreviewPlacerView(); - mDrawingPreviewPlacerView.addView( - previewTextView, ViewLayoutUtils.newLayoutParam(mDrawingPreviewPlacerView, 0, 0)); + final TextView previewTextView = mKeyPreviewChoreographer.getKeyPreviewTextView( + key, mDrawingPreviewPlacerView); getLocationInWindow(mOriginCoords); mKeyPreviewChoreographer.placeKeyPreview(key, previewTextView, keyboard.mIconsSet, mKeyDrawParams, getWidth(), mOriginCoords); diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java index c1922b7c4..df869b2bc 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java @@ -58,7 +58,7 @@ public final class KeyPreviewChoreographer { mParams = params; } - public TextView getKeyPreviewTextView(final Key key, final Context context) { + public TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) { TextView previewTextView = mShowingKeyPreviewTextViews.remove(key); if (previewTextView != null) { return previewTextView; @@ -67,10 +67,15 @@ public final class KeyPreviewChoreographer { if (previewTextView != null) { return previewTextView; } + final Context context = placerView.getContext(); if (mParams.mLayoutId != 0) { - return (TextView)LayoutInflater.from(context).inflate(mParams.mLayoutId, null); + previewTextView = (TextView)LayoutInflater.from(context) + .inflate(mParams.mLayoutId, null); + } else { + previewTextView = new TextView(context); } - return new TextView(context); + placerView.addView(previewTextView, ViewLayoutUtils.newLayoutParam(placerView, 0, 0)); + return previewTextView; } public boolean isShowingKeyPreview(final Key key) { @@ -244,7 +249,7 @@ public final class KeyPreviewChoreographer { zoomOutAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(final Animator animation) { - dismissKeyPreview(key, true /* withAnimation */); + dismissKeyPreview(key, false /* withAnimation */); } }); return zoomOutAnimation; |