am cf915ddc: Rename classes related to AbstractDrawingPreview

* commit 'cf915ddc878699909365dd599a0e154552e244e2':
  Rename classes related to AbstractDrawingPreview
main
Tadashi G. Takaoka 2013-12-24 01:42:00 -08:00 committed by Android Git Automerger
commit 4abe6662b5
6 changed files with 53 additions and 50 deletions

View File

@ -49,13 +49,13 @@ import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
import com.android.inputmethod.annotations.ExternallyReferenced; import com.android.inputmethod.annotations.ExternallyReferenced;
import com.android.inputmethod.keyboard.internal.DrawingHandler; import com.android.inputmethod.keyboard.internal.DrawingHandler;
import com.android.inputmethod.keyboard.internal.GestureFloatingPreviewText; import com.android.inputmethod.keyboard.internal.DrawingPreviewPlacerView;
import com.android.inputmethod.keyboard.internal.GestureTrailsPreview; import com.android.inputmethod.keyboard.internal.GestureFloatingTextDrawingPreview;
import com.android.inputmethod.keyboard.internal.GestureTrailsDrawingPreview;
import com.android.inputmethod.keyboard.internal.KeyDrawParams; import com.android.inputmethod.keyboard.internal.KeyDrawParams;
import com.android.inputmethod.keyboard.internal.KeyPreviewDrawParams; import com.android.inputmethod.keyboard.internal.KeyPreviewDrawParams;
import com.android.inputmethod.keyboard.internal.NonDistinctMultitouchHelper; import com.android.inputmethod.keyboard.internal.NonDistinctMultitouchHelper;
import com.android.inputmethod.keyboard.internal.PreviewPlacerView; import com.android.inputmethod.keyboard.internal.SlidingKeyInputDrawingPreview;
import com.android.inputmethod.keyboard.internal.SlidingKeyInputPreview;
import com.android.inputmethod.keyboard.internal.TimerHandler; import com.android.inputmethod.keyboard.internal.TimerHandler;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
@ -152,12 +152,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
private final ObjectAnimator mAltCodeKeyWhileTypingFadeinAnimator; private final ObjectAnimator mAltCodeKeyWhileTypingFadeinAnimator;
private int mAltCodeKeyWhileTypingAnimAlpha = Constants.Color.ALPHA_OPAQUE; private int mAltCodeKeyWhileTypingAnimAlpha = Constants.Color.ALPHA_OPAQUE;
// Preview placer view // Drawing preview placer view
private final PreviewPlacerView mPreviewPlacerView; private final DrawingPreviewPlacerView mDrawingPreviewPlacerView;
private final int[] mOriginCoords = CoordinateUtils.newInstance(); private final int[] mOriginCoords = CoordinateUtils.newInstance();
private final GestureFloatingPreviewText mGestureFloatingPreviewText; private final GestureFloatingTextDrawingPreview mGestureFloatingTextDrawingPreview;
private final GestureTrailsPreview mGestureTrailsPreview; private final GestureTrailsDrawingPreview mGestureTrailsDrawingPreview;
private final SlidingKeyInputPreview mSlidingKeyInputPreview; private final SlidingKeyInputDrawingPreview mSlidingKeyInputDrawingPreview;
// Key preview // Key preview
private static final boolean FADE_OUT_KEY_TOP_LETTER_WHEN_KEY_IS_PRESSED = false; private static final boolean FADE_OUT_KEY_TOP_LETTER_WHEN_KEY_IS_PRESSED = false;
@ -212,7 +212,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
public MainKeyboardView(final Context context, final AttributeSet attrs, final int defStyle) { public MainKeyboardView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
mPreviewPlacerView = new PreviewPlacerView(context, attrs); mDrawingPreviewPlacerView = new DrawingPreviewPlacerView(context, attrs);
final TypedArray mainKeyboardViewAttr = context.obtainStyledAttributes( final TypedArray mainKeyboardViewAttr = context.obtainStyledAttributes(
attrs, R.styleable.MainKeyboardView, defStyle, R.style.MainKeyboardView); attrs, R.styleable.MainKeyboardView, defStyle, R.style.MainKeyboardView);
@ -290,17 +290,17 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
mGestureFloatingPreviewTextLingerTimeout = mainKeyboardViewAttr.getInt( mGestureFloatingPreviewTextLingerTimeout = mainKeyboardViewAttr.getInt(
R.styleable.MainKeyboardView_gestureFloatingPreviewTextLingerTimeout, 0); R.styleable.MainKeyboardView_gestureFloatingPreviewTextLingerTimeout, 0);
mGestureFloatingPreviewText = new GestureFloatingPreviewText( mGestureFloatingTextDrawingPreview = new GestureFloatingTextDrawingPreview(
mPreviewPlacerView, mainKeyboardViewAttr); mDrawingPreviewPlacerView, mainKeyboardViewAttr);
mPreviewPlacerView.addPreview(mGestureFloatingPreviewText); mDrawingPreviewPlacerView.addPreview(mGestureFloatingTextDrawingPreview);
mGestureTrailsPreview = new GestureTrailsPreview( mGestureTrailsDrawingPreview = new GestureTrailsDrawingPreview(
mPreviewPlacerView, mainKeyboardViewAttr); mDrawingPreviewPlacerView, mainKeyboardViewAttr);
mPreviewPlacerView.addPreview(mGestureTrailsPreview); mDrawingPreviewPlacerView.addPreview(mGestureTrailsDrawingPreview);
mSlidingKeyInputPreview = new SlidingKeyInputPreview( mSlidingKeyInputDrawingPreview = new SlidingKeyInputDrawingPreview(
mPreviewPlacerView, mainKeyboardViewAttr); mDrawingPreviewPlacerView, mainKeyboardViewAttr);
mPreviewPlacerView.addPreview(mSlidingKeyInputPreview); mDrawingPreviewPlacerView.addPreview(mSlidingKeyInputDrawingPreview);
mainKeyboardViewAttr.recycle(); mainKeyboardViewAttr.recycle();
mMoreKeysKeyboardContainer = LayoutInflater.from(getContext()) mMoreKeysKeyboardContainer = LayoutInflater.from(getContext())
@ -321,7 +321,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override @Override
public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) { public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) {
super.setHardwareAcceleratedDrawingEnabled(enabled); super.setHardwareAcceleratedDrawingEnabled(enabled);
mPreviewPlacerView.setHardwareAcceleratedDrawingEnabled(enabled); mDrawingPreviewPlacerView.setHardwareAcceleratedDrawingEnabled(enabled);
} }
private ObjectAnimator loadObjectAnimator(final int resId, final Object target) { private ObjectAnimator loadObjectAnimator(final int resId, final Object target) {
@ -460,7 +460,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
} }
private void locatePreviewPlacerView() { private void locatePreviewPlacerView() {
if (mPreviewPlacerView.getParent() != null) { if (mDrawingPreviewPlacerView.getParent() != null) {
return; return;
} }
final int width = getWidth(); final int width = getWidth();
@ -483,10 +483,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
final ViewGroup windowContentView = (ViewGroup)rootView.findViewById(android.R.id.content); final ViewGroup windowContentView = (ViewGroup)rootView.findViewById(android.R.id.content);
// Note: It'd be very weird if we get null by android.R.id.content. // Note: It'd be very weird if we get null by android.R.id.content.
if (windowContentView == null) { if (windowContentView == null) {
Log.w(TAG, "Cannot find android.R.id.content view to add PreviewPlacerView"); Log.w(TAG, "Cannot find android.R.id.content view to add DrawingPreviewPlacerView");
} else { } else {
windowContentView.addView(mPreviewPlacerView); windowContentView.addView(mDrawingPreviewPlacerView);
mPreviewPlacerView.setKeyboardViewGeometry(mOriginCoords, width, height); mDrawingPreviewPlacerView.setKeyboardViewGeometry(mOriginCoords, width, height);
} }
} }
@ -516,8 +516,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
previewTextView = new TextView(context); previewTextView = new TextView(context);
} }
locatePreviewPlacerView(); locatePreviewPlacerView();
mPreviewPlacerView.addView( mDrawingPreviewPlacerView.addView(
previewTextView, ViewLayoutUtils.newLayoutParam(mPreviewPlacerView, 0, 0)); previewTextView, ViewLayoutUtils.newLayoutParam(mDrawingPreviewPlacerView, 0, 0));
return previewTextView; return previewTextView;
} }
@ -757,31 +757,31 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
} }
public void setSlidingKeyInputPreviewEnabled(final boolean enabled) { public void setSlidingKeyInputPreviewEnabled(final boolean enabled) {
mSlidingKeyInputPreview.setPreviewEnabled(enabled); mSlidingKeyInputDrawingPreview.setPreviewEnabled(enabled);
} }
@Override @Override
public void showSlidingKeyInputPreview(final PointerTracker tracker) { public void showSlidingKeyInputPreview(final PointerTracker tracker) {
locatePreviewPlacerView(); locatePreviewPlacerView();
mSlidingKeyInputPreview.setPreviewPosition(tracker); mSlidingKeyInputDrawingPreview.setPreviewPosition(tracker);
} }
@Override @Override
public void dismissSlidingKeyInputPreview() { public void dismissSlidingKeyInputPreview() {
mSlidingKeyInputPreview.dismissSlidingKeyInputPreview(); mSlidingKeyInputDrawingPreview.dismissSlidingKeyInputPreview();
} }
private void setGesturePreviewMode(final boolean isGestureTrailEnabled, private void setGesturePreviewMode(final boolean isGestureTrailEnabled,
final boolean isGestureFloatingPreviewTextEnabled) { final boolean isGestureFloatingPreviewTextEnabled) {
mGestureFloatingPreviewText.setPreviewEnabled(isGestureFloatingPreviewTextEnabled); mGestureFloatingTextDrawingPreview.setPreviewEnabled(isGestureFloatingPreviewTextEnabled);
mGestureTrailsPreview.setPreviewEnabled(isGestureTrailEnabled); mGestureTrailsDrawingPreview.setPreviewEnabled(isGestureTrailEnabled);
} }
// Implements {@link DrawingHandler.Callbacks} method. // Implements {@link DrawingHandler.Callbacks} method.
@Override @Override
public void showGestureFloatingPreviewText(final SuggestedWords suggestedWords) { public void showGestureFloatingPreviewText(final SuggestedWords suggestedWords) {
locatePreviewPlacerView(); locatePreviewPlacerView();
mGestureFloatingPreviewText.setSuggetedWords(suggestedWords); mGestureFloatingTextDrawingPreview.setSuggetedWords(suggestedWords);
} }
public void dismissGestureFloatingPreviewText() { public void dismissGestureFloatingPreviewText() {
@ -794,9 +794,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
final boolean showsFloatingPreviewText) { final boolean showsFloatingPreviewText) {
locatePreviewPlacerView(); locatePreviewPlacerView();
if (showsFloatingPreviewText) { if (showsFloatingPreviewText) {
mGestureFloatingPreviewText.setPreviewPosition(tracker); mGestureFloatingTextDrawingPreview.setPreviewPosition(tracker);
} }
mGestureTrailsPreview.setPreviewPosition(tracker); mGestureTrailsDrawingPreview.setPreviewPosition(tracker);
} }
// Note that this method is called from a non-UI thread. // Note that this method is called from a non-UI thread.
@ -826,7 +826,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override @Override
protected void onDetachedFromWindow() { protected void onDetachedFromWindow() {
super.onDetachedFromWindow(); super.onDetachedFromWindow();
mPreviewPlacerView.removeAllViews(); mDrawingPreviewPlacerView.removeAllViews();
// Notify the ResearchLogger (development only diagnostics) that the keyboard view has // Notify the ResearchLogger (development only diagnostics) that the keyboard view has
// been detached. This is needed to invalidate the reference of {@link MainKeyboardView} // been detached. This is needed to invalidate the reference of {@link MainKeyboardView}
// to null. // to null.
@ -930,7 +930,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override @Override
public void onShowMoreKeysPanel(final MoreKeysPanel panel) { public void onShowMoreKeysPanel(final MoreKeysPanel panel) {
locatePreviewPlacerView(); locatePreviewPlacerView();
panel.showInParent(mPreviewPlacerView); panel.showInParent(mDrawingPreviewPlacerView);
mMoreKeysPanel = panel; mMoreKeysPanel = panel;
dimEntireKeyboard(true /* dimmed */); dimEntireKeyboard(true /* dimmed */);
} }
@ -1228,6 +1228,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override @Override
public void deallocateMemory() { public void deallocateMemory() {
super.deallocateMemory(); super.deallocateMemory();
mGestureTrailsPreview.deallocateMemory(); mGestureTrailsDrawingPreview.deallocateMemory();
} }
} }

View File

@ -22,8 +22,9 @@ import android.view.View;
import com.android.inputmethod.keyboard.PointerTracker; import com.android.inputmethod.keyboard.PointerTracker;
/** /**
* Abstract base class for previews that are drawn on PreviewPlacerView, e.g., * Abstract base class for previews that are drawn on DrawingPreviewPlacerView, e.g.,
* GestureFloatingPrevewText, GestureTrail, and SlidingKeyInputPreview. * GestureFloatingTextDrawingPreview, GestureTrailsDrawingPreview, and
* SlidingKeyInputDrawingPreview.
*/ */
public abstract class AbstractDrawingPreview { public abstract class AbstractDrawingPreview {
private final View mDrawingView; private final View mDrawingView;

View File

@ -29,12 +29,12 @@ import com.android.inputmethod.latin.utils.CoordinateUtils;
import java.util.ArrayList; import java.util.ArrayList;
public final class PreviewPlacerView extends RelativeLayout { public final class DrawingPreviewPlacerView extends RelativeLayout {
private final int[] mKeyboardViewOrigin = CoordinateUtils.newInstance(); private final int[] mKeyboardViewOrigin = CoordinateUtils.newInstance();
private final ArrayList<AbstractDrawingPreview> mPreviews = CollectionUtils.newArrayList(); private final ArrayList<AbstractDrawingPreview> mPreviews = CollectionUtils.newArrayList();
public PreviewPlacerView(final Context context, final AttributeSet attrs) { public DrawingPreviewPlacerView(final Context context, final AttributeSet attrs) {
super(context, attrs); super(context, attrs);
setWillNotDraw(false); setWillNotDraw(false);
} }

View File

@ -42,7 +42,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils;
* @attr ref R.styleable#KeyboardView_gestureFloatingPreviewVerticalPadding * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewVerticalPadding
* @attr ref R.styleable#KeyboardView_gestureFloatingPreviewRoundRadius * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewRoundRadius
*/ */
public class GestureFloatingPreviewText extends AbstractDrawingPreview { public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
protected static final class GesturePreviewTextParams { protected static final class GesturePreviewTextParams {
public final int mGesturePreviewTextOffset; public final int mGesturePreviewTextOffset;
public final int mGesturePreviewTextHeight; public final int mGesturePreviewTextHeight;
@ -100,7 +100,7 @@ public class GestureFloatingPreviewText extends AbstractDrawingPreview {
private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY; private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY;
private final int[] mLastPointerCoords = CoordinateUtils.newInstance(); private final int[] mLastPointerCoords = CoordinateUtils.newInstance();
public GestureFloatingPreviewText(final View drawingView, final TypedArray typedArray) { public GestureFloatingTextDrawingPreview(final View drawingView, final TypedArray typedArray) {
super(drawingView); super(drawingView);
mParams = new GesturePreviewTextParams(typedArray); mParams = new GesturePreviewTextParams(typedArray);
} }

View File

@ -36,7 +36,7 @@ import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
/** /**
* Draw gesture trail preview graphics during gesture. * Draw gesture trail preview graphics during gesture.
*/ */
public final class GestureTrailsPreview extends AbstractDrawingPreview { public final class GestureTrailsDrawingPreview extends AbstractDrawingPreview {
private final SparseArray<GestureTrail> mGestureTrails = CollectionUtils.newSparseArray(); private final SparseArray<GestureTrail> mGestureTrails = CollectionUtils.newSparseArray();
private final Params mGestureTrailParams; private final Params mGestureTrailParams;
private final Paint mGesturePaint; private final Paint mGesturePaint;
@ -52,12 +52,12 @@ public final class GestureTrailsPreview extends AbstractDrawingPreview {
private final DrawingHandler mDrawingHandler; private final DrawingHandler mDrawingHandler;
private static final class DrawingHandler private static final class DrawingHandler
extends LeakGuardHandlerWrapper<GestureTrailsPreview> { extends LeakGuardHandlerWrapper<GestureTrailsDrawingPreview> {
private static final int MSG_UPDATE_GESTURE_TRAIL = 0; private static final int MSG_UPDATE_GESTURE_TRAIL = 0;
private final Params mGestureTrailParams; private final Params mGestureTrailParams;
public DrawingHandler(final GestureTrailsPreview ownerInstance, public DrawingHandler(final GestureTrailsDrawingPreview ownerInstance,
final Params gestureTrailParams) { final Params gestureTrailParams) {
super(ownerInstance); super(ownerInstance);
mGestureTrailParams = gestureTrailParams; mGestureTrailParams = gestureTrailParams;
@ -65,7 +65,7 @@ public final class GestureTrailsPreview extends AbstractDrawingPreview {
@Override @Override
public void handleMessage(final Message msg) { public void handleMessage(final Message msg) {
final GestureTrailsPreview preview = getOwnerInstance(); final GestureTrailsDrawingPreview preview = getOwnerInstance();
if (preview == null) { if (preview == null) {
return; return;
} }
@ -83,7 +83,8 @@ public final class GestureTrailsPreview extends AbstractDrawingPreview {
} }
} }
public GestureTrailsPreview(final View drawingView, final TypedArray mainKeyboardViewAttr) { public GestureTrailsDrawingPreview(final View drawingView,
final TypedArray mainKeyboardViewAttr) {
super(drawingView); super(drawingView);
mGestureTrailParams = new Params(mainKeyboardViewAttr); mGestureTrailParams = new Params(mainKeyboardViewAttr);
mDrawingHandler = new DrawingHandler(this, mGestureTrailParams); mDrawingHandler = new DrawingHandler(this, mGestureTrailParams);

View File

@ -29,7 +29,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils;
/** /**
* Draw rubber band preview graphics during sliding key input. * Draw rubber band preview graphics during sliding key input.
*/ */
public final class SlidingKeyInputPreview extends AbstractDrawingPreview { public final class SlidingKeyInputDrawingPreview extends AbstractDrawingPreview {
private final float mPreviewBodyRadius; private final float mPreviewBodyRadius;
private boolean mShowsSlidingKeyInputPreview; private boolean mShowsSlidingKeyInputPreview;
@ -40,7 +40,8 @@ public final class SlidingKeyInputPreview extends AbstractDrawingPreview {
private final RoundedLine mRoundedLine = new RoundedLine(); private final RoundedLine mRoundedLine = new RoundedLine();
private final Paint mPaint = new Paint(); private final Paint mPaint = new Paint();
public SlidingKeyInputPreview(final View drawingView, final TypedArray mainKeyboardViewAttr) { public SlidingKeyInputDrawingPreview(final View drawingView,
final TypedArray mainKeyboardViewAttr) {
super(drawingView); super(drawingView);
final int previewColor = mainKeyboardViewAttr.getColor( final int previewColor = mainKeyboardViewAttr.getColor(
R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0); R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0);