Consolidate 3 public methods of key preview into one

Change-Id: I0ac92c56bdb636998f7f5e20fba6830b4ac435fa
This commit is contained in:
Tadashi G. Takaoka 2014-06-17 17:05:11 -07:00
parent 4c45fff240
commit 3ff72dd0da
2 changed files with 14 additions and 9 deletions

View file

@ -35,7 +35,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodSubtype;
import android.widget.TextView;
import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.accessibility.MainKeyboardAccessibilityDelegate;
@ -461,12 +460,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
}
locatePreviewPlacerView();
final TextView previewTextView = mKeyPreviewChoreographer.getKeyPreviewTextView(
key, mDrawingPreviewPlacerView);
getLocationInWindow(mOriginCoords);
mKeyPreviewChoreographer.placeKeyPreview(key, previewTextView, keyboard.mIconsSet,
mKeyDrawParams, getWidth(), mOriginCoords);
mKeyPreviewChoreographer.showKeyPreview(key, previewTextView, isHardwareAccelerated());
mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams,
getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated());
}
// Implements {@link TimerHandler.Callbacks} method.

View file

@ -57,7 +57,7 @@ public final class KeyPreviewChoreographer {
mParams = params;
}
public TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) {
private TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) {
TextView previewTextView = mShowingKeyPreviewTextViews.remove(key);
if (previewTextView != null) {
return previewTextView;
@ -134,7 +134,16 @@ public final class KeyPreviewChoreographer {
private static final int STATE_NORMAL = 0;
private static final int STATE_HAS_MOREKEYS = 1;
public void placeKeyPreview(final Key key, final TextView previewTextView,
public void placeKeyPreviewAndShow(final Key key, final KeyboardIconsSet iconsSet,
final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
final ViewGroup placerView, final boolean withAnimation) {
final TextView previewTextView = getKeyPreviewTextView(key, placerView);
placeKeyPreview(
key, previewTextView, iconsSet, drawParams, keyboardViewWidth, keyboardOrigin);
showKeyPreview(key, previewTextView, withAnimation);
}
private void placeKeyPreview(final Key key, final TextView previewTextView,
final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams,
final int keyboardViewWidth, final int[] originCoords) {
previewTextView.setTextColor(drawParams.mPreviewTextColor);
@ -189,7 +198,7 @@ public final class KeyPreviewChoreographer {
previewTextView.setPivotY(previewHeight);
}
public void showKeyPreview(final Key key, final TextView previewTextView,
private void showKeyPreview(final Key key, final TextView previewTextView,
final boolean withAnimation) {
if (!withAnimation) {
previewTextView.setVisibility(View.VISIBLE);