Fix some comments and rename method and parameter names

This is a follow up change of I12139a925d and I0ac92c56bd

Change-Id: Id6e9f4434fddd5d4274e06da5063606c2ffad932
This commit is contained in:
Tadashi G. Takaoka 2014-06-23 13:54:25 -07:00
parent 7d6bc4d063
commit 84405d2a68
3 changed files with 10 additions and 9 deletions

View file

@ -451,7 +451,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
locatePreviewPlacerView(); locatePreviewPlacerView();
getLocationInWindow(mOriginCoords); getLocationInWindow(mOriginCoords);
mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams, mKeyPreviewChoreographer.placeAndShowKeyPreview(key, keyboard.mIconsSet, mKeyDrawParams,
getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated()); 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. <code>width == 0</code> // though there may be some chances that the value is zero. <code>width == 0</code>
// will cause zero-division error at // will cause zero-division error at
// {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}. // {@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 && !key.noKeyPreview() && moreKeys.length == 1
&& mKeyPreviewDrawParams.getVisibleWidth() > 0; && mKeyPreviewDrawParams.getVisibleWidth() > 0;
final MoreKeysKeyboard.Builder builder = new MoreKeysKeyboard.Builder( final MoreKeysKeyboard.Builder builder = new MoreKeysKeyboard.Builder(
context, key, getKeyboard(), singleMoreKeyWithPreview, context, key, getKeyboard(), isSingleMoreKeyWithPreview,
mKeyPreviewDrawParams.getVisibleWidth(), mKeyPreviewDrawParams.getVisibleWidth(),
mKeyPreviewDrawParams.getVisibleHeight(), newLabelPaint(key)); mKeyPreviewDrawParams.getVisibleHeight(), newLabelPaint(key));
moreKeysKeyboard = builder.build(); moreKeysKeyboard = builder.build();

View file

@ -261,13 +261,13 @@ public final class MoreKeysKeyboard extends Keyboard {
* @param context the context of {@link MoreKeysKeyboardView}. * @param context the context of {@link MoreKeysKeyboardView}.
* @param key the {@link Key} that invokes more keys keyboard. * @param key the {@link Key} that invokes more keys keyboard.
* @param keyboard the {@link Keyboard} that contains the parentKey. * @param keyboard the {@link Keyboard} that contains the parentKey.
* @param singleMoreKeyWithPreview true if the <code>key</code> has only one more key * @param isSingleMoreKeyWithPreview true if the <code>key</code> has just a single
* and key popup preview is enabled. * "more key" and its key popup preview is enabled.
* @param keyPreviewDrawParams the parameter to place key preview. * @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, 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) { final int keyPreviewVisibleHeight, final Paint paintToMeasure) {
super(context, new MoreKeysKeyboardParams()); super(context, new MoreKeysKeyboardParams());
load(keyboard.mMoreKeysTemplate, keyboard.mId); 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. // TODO: More keys keyboard's vertical gap is currently calculated heuristically.
// Should revise the algorithm. // Should revise the algorithm.
mParams.mVerticalGap = keyboard.mVerticalGap / 2; mParams.mVerticalGap = keyboard.mVerticalGap / 2;
// This {@link MoreKeysKeyboard} is invoked from the <code>key</code>.
mParentKey = key; mParentKey = key;
final int keyWidth, rowHeight; final int keyWidth, rowHeight;
if (singleMoreKeyWithPreview) { if (isSingleMoreKeyWithPreview) {
// Use pre-computed width and height if this more keys keyboard has only one key to // 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. // mitigate visual flicker between key preview and more keys keyboard.
// Caveats for the visual assets: To achieve this effect, both the key preview // Caveats for the visual assets: To achieve this effect, both the key preview

View file

@ -105,7 +105,7 @@ public final class KeyPreviewChoreographer {
mFreeKeyPreviewViews.add(keyPreviewView); 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 KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
final ViewGroup placerView, final boolean withAnimation) { final ViewGroup placerView, final boolean withAnimation) {
final KeyPreviewView keyPreviewView = getKeyPreviewView(key, placerView); final KeyPreviewView keyPreviewView = getKeyPreviewView(key, placerView);