From 84405d2a6815a99992849e821e073835f2d892e3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 23 Jun 2014 13:54:25 -0700 Subject: [PATCH] Fix some comments and rename method and parameter names This is a follow up change of I12139a925d and I0ac92c56bd Change-Id: Id6e9f4434fddd5d4274e06da5063606c2ffad932 --- .../inputmethod/keyboard/MainKeyboardView.java | 6 +++--- .../inputmethod/keyboard/MoreKeysKeyboard.java | 11 ++++++----- .../keyboard/internal/KeyPreviewChoreographer.java | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 81825934f..702efb3d7 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -451,7 +451,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack locatePreviewPlacerView(); getLocationInWindow(mOriginCoords); - mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams, + mKeyPreviewChoreographer.placeAndShowKeyPreview(key, keyboard.mIconsSet, mKeyDrawParams, getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated()); } @@ -554,11 +554,11 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack // though there may be some chances that the value is zero. width == 0 // will cause zero-division error at // {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}. - final boolean singleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled() + final boolean isSingleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled() && !key.noKeyPreview() && moreKeys.length == 1 && mKeyPreviewDrawParams.getVisibleWidth() > 0; final MoreKeysKeyboard.Builder builder = new MoreKeysKeyboard.Builder( - context, key, getKeyboard(), singleMoreKeyWithPreview, + context, key, getKeyboard(), isSingleMoreKeyWithPreview, mKeyPreviewDrawParams.getVisibleWidth(), mKeyPreviewDrawParams.getVisibleHeight(), newLabelPaint(key)); moreKeysKeyboard = builder.build(); diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java index 353e07cf7..e0184d7f1 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java @@ -261,13 +261,13 @@ public final class MoreKeysKeyboard extends Keyboard { * @param context the context of {@link MoreKeysKeyboardView}. * @param key the {@link Key} that invokes more keys keyboard. * @param keyboard the {@link Keyboard} that contains the parentKey. - * @param singleMoreKeyWithPreview true if the key has only one more key - * and key popup preview is enabled. + * @param isSingleMoreKeyWithPreview true if the key has just a single + * "more key" and its key popup preview is enabled. * @param keyPreviewDrawParams the parameter to place key preview. - * @param paintToMeasure the {@link Paint} object to measure a more key width + * @param paintToMeasure the {@link Paint} object to measure a "more key" width */ public Builder(final Context context, final Key key, final Keyboard keyboard, - final boolean singleMoreKeyWithPreview, final int keyPreviewVisibleWidth, + final boolean isSingleMoreKeyWithPreview, final int keyPreviewVisibleWidth, final int keyPreviewVisibleHeight, final Paint paintToMeasure) { super(context, new MoreKeysKeyboardParams()); load(keyboard.mMoreKeysTemplate, keyboard.mId); @@ -275,10 +275,11 @@ public final class MoreKeysKeyboard extends Keyboard { // TODO: More keys keyboard's vertical gap is currently calculated heuristically. // Should revise the algorithm. mParams.mVerticalGap = keyboard.mVerticalGap / 2; + // This {@link MoreKeysKeyboard} is invoked from the key. mParentKey = key; final int keyWidth, rowHeight; - if (singleMoreKeyWithPreview) { + if (isSingleMoreKeyWithPreview) { // Use pre-computed width and height if this more keys keyboard has only one key to // mitigate visual flicker between key preview and more keys keyboard. // Caveats for the visual assets: To achieve this effect, both the key preview diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java index 6fc300beb..cd29c8d17 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java @@ -105,7 +105,7 @@ public final class KeyPreviewChoreographer { mFreeKeyPreviewViews.add(keyPreviewView); } - public void placeKeyPreviewAndShow(final Key key, final KeyboardIconsSet iconsSet, + public void placeAndShowKeyPreview(final Key key, final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin, final ViewGroup placerView, final boolean withAnimation) { final KeyPreviewView keyPreviewView = getKeyPreviewView(key, placerView);