From cf915ddc878699909365dd599a0e154552e244e2 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 24 Dec 2013 18:03:17 +0900 Subject: [PATCH] Rename classes related to AbstractDrawingPreview Change-Id: Ife2e2c08b2b6fbf9ec33cf259f276878816b291c --- .../keyboard/MainKeyboardView.java | 74 +++++++++---------- .../internal/AbstractDrawingPreview.java | 5 +- ...iew.java => DrawingPreviewPlacerView.java} | 4 +- ...=> GestureFloatingTextDrawingPreview.java} | 4 +- ....java => GestureTrailsDrawingPreview.java} | 11 +-- ...ava => SlidingKeyInputDrawingPreview.java} | 5 +- 6 files changed, 53 insertions(+), 50 deletions(-) rename java/src/com/android/inputmethod/keyboard/internal/{PreviewPlacerView.java => DrawingPreviewPlacerView.java} (94%) rename java/src/com/android/inputmethod/keyboard/internal/{GestureFloatingPreviewText.java => GestureFloatingTextDrawingPreview.java} (97%) rename java/src/com/android/inputmethod/keyboard/internal/{GestureTrailsPreview.java => GestureTrailsDrawingPreview.java} (94%) rename java/src/com/android/inputmethod/keyboard/internal/{SlidingKeyInputPreview.java => SlidingKeyInputDrawingPreview.java} (95%) diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 992603b43..07bd7a651 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -49,13 +49,13 @@ import com.android.inputmethod.accessibility.AccessibilityUtils; import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.annotations.ExternallyReferenced; import com.android.inputmethod.keyboard.internal.DrawingHandler; -import com.android.inputmethod.keyboard.internal.GestureFloatingPreviewText; -import com.android.inputmethod.keyboard.internal.GestureTrailsPreview; +import com.android.inputmethod.keyboard.internal.DrawingPreviewPlacerView; +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.KeyPreviewDrawParams; import com.android.inputmethod.keyboard.internal.NonDistinctMultitouchHelper; -import com.android.inputmethod.keyboard.internal.PreviewPlacerView; -import com.android.inputmethod.keyboard.internal.SlidingKeyInputPreview; +import com.android.inputmethod.keyboard.internal.SlidingKeyInputDrawingPreview; import com.android.inputmethod.keyboard.internal.TimerHandler; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.LatinImeLogger; @@ -152,12 +152,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack private final ObjectAnimator mAltCodeKeyWhileTypingFadeinAnimator; private int mAltCodeKeyWhileTypingAnimAlpha = Constants.Color.ALPHA_OPAQUE; - // Preview placer view - private final PreviewPlacerView mPreviewPlacerView; + // Drawing preview placer view + private final DrawingPreviewPlacerView mDrawingPreviewPlacerView; private final int[] mOriginCoords = CoordinateUtils.newInstance(); - private final GestureFloatingPreviewText mGestureFloatingPreviewText; - private final GestureTrailsPreview mGestureTrailsPreview; - private final SlidingKeyInputPreview mSlidingKeyInputPreview; + private final GestureFloatingTextDrawingPreview mGestureFloatingTextDrawingPreview; + private final GestureTrailsDrawingPreview mGestureTrailsDrawingPreview; + private final SlidingKeyInputDrawingPreview mSlidingKeyInputDrawingPreview; // Key preview 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) { super(context, attrs, defStyle); - mPreviewPlacerView = new PreviewPlacerView(context, attrs); + mDrawingPreviewPlacerView = new DrawingPreviewPlacerView(context, attrs); final TypedArray mainKeyboardViewAttr = context.obtainStyledAttributes( attrs, R.styleable.MainKeyboardView, defStyle, R.style.MainKeyboardView); @@ -290,17 +290,17 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mGestureFloatingPreviewTextLingerTimeout = mainKeyboardViewAttr.getInt( R.styleable.MainKeyboardView_gestureFloatingPreviewTextLingerTimeout, 0); - mGestureFloatingPreviewText = new GestureFloatingPreviewText( - mPreviewPlacerView, mainKeyboardViewAttr); - mPreviewPlacerView.addPreview(mGestureFloatingPreviewText); + mGestureFloatingTextDrawingPreview = new GestureFloatingTextDrawingPreview( + mDrawingPreviewPlacerView, mainKeyboardViewAttr); + mDrawingPreviewPlacerView.addPreview(mGestureFloatingTextDrawingPreview); - mGestureTrailsPreview = new GestureTrailsPreview( - mPreviewPlacerView, mainKeyboardViewAttr); - mPreviewPlacerView.addPreview(mGestureTrailsPreview); + mGestureTrailsDrawingPreview = new GestureTrailsDrawingPreview( + mDrawingPreviewPlacerView, mainKeyboardViewAttr); + mDrawingPreviewPlacerView.addPreview(mGestureTrailsDrawingPreview); - mSlidingKeyInputPreview = new SlidingKeyInputPreview( - mPreviewPlacerView, mainKeyboardViewAttr); - mPreviewPlacerView.addPreview(mSlidingKeyInputPreview); + mSlidingKeyInputDrawingPreview = new SlidingKeyInputDrawingPreview( + mDrawingPreviewPlacerView, mainKeyboardViewAttr); + mDrawingPreviewPlacerView.addPreview(mSlidingKeyInputDrawingPreview); mainKeyboardViewAttr.recycle(); mMoreKeysKeyboardContainer = LayoutInflater.from(getContext()) @@ -321,7 +321,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack @Override public void setHardwareAcceleratedDrawingEnabled(final boolean enabled) { super.setHardwareAcceleratedDrawingEnabled(enabled); - mPreviewPlacerView.setHardwareAcceleratedDrawingEnabled(enabled); + mDrawingPreviewPlacerView.setHardwareAcceleratedDrawingEnabled(enabled); } private ObjectAnimator loadObjectAnimator(final int resId, final Object target) { @@ -460,7 +460,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack } private void locatePreviewPlacerView() { - if (mPreviewPlacerView.getParent() != null) { + if (mDrawingPreviewPlacerView.getParent() != null) { return; } 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); // Note: It'd be very weird if we get null by android.R.id.content. 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 { - windowContentView.addView(mPreviewPlacerView); - mPreviewPlacerView.setKeyboardViewGeometry(mOriginCoords, width, height); + windowContentView.addView(mDrawingPreviewPlacerView); + mDrawingPreviewPlacerView.setKeyboardViewGeometry(mOriginCoords, width, height); } } @@ -516,8 +516,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack previewTextView = new TextView(context); } locatePreviewPlacerView(); - mPreviewPlacerView.addView( - previewTextView, ViewLayoutUtils.newLayoutParam(mPreviewPlacerView, 0, 0)); + mDrawingPreviewPlacerView.addView( + previewTextView, ViewLayoutUtils.newLayoutParam(mDrawingPreviewPlacerView, 0, 0)); return previewTextView; } @@ -757,31 +757,31 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack } public void setSlidingKeyInputPreviewEnabled(final boolean enabled) { - mSlidingKeyInputPreview.setPreviewEnabled(enabled); + mSlidingKeyInputDrawingPreview.setPreviewEnabled(enabled); } @Override public void showSlidingKeyInputPreview(final PointerTracker tracker) { locatePreviewPlacerView(); - mSlidingKeyInputPreview.setPreviewPosition(tracker); + mSlidingKeyInputDrawingPreview.setPreviewPosition(tracker); } @Override public void dismissSlidingKeyInputPreview() { - mSlidingKeyInputPreview.dismissSlidingKeyInputPreview(); + mSlidingKeyInputDrawingPreview.dismissSlidingKeyInputPreview(); } private void setGesturePreviewMode(final boolean isGestureTrailEnabled, final boolean isGestureFloatingPreviewTextEnabled) { - mGestureFloatingPreviewText.setPreviewEnabled(isGestureFloatingPreviewTextEnabled); - mGestureTrailsPreview.setPreviewEnabled(isGestureTrailEnabled); + mGestureFloatingTextDrawingPreview.setPreviewEnabled(isGestureFloatingPreviewTextEnabled); + mGestureTrailsDrawingPreview.setPreviewEnabled(isGestureTrailEnabled); } // Implements {@link DrawingHandler.Callbacks} method. @Override public void showGestureFloatingPreviewText(final SuggestedWords suggestedWords) { locatePreviewPlacerView(); - mGestureFloatingPreviewText.setSuggetedWords(suggestedWords); + mGestureFloatingTextDrawingPreview.setSuggetedWords(suggestedWords); } public void dismissGestureFloatingPreviewText() { @@ -794,9 +794,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack final boolean showsFloatingPreviewText) { locatePreviewPlacerView(); 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. @@ -826,7 +826,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - mPreviewPlacerView.removeAllViews(); + mDrawingPreviewPlacerView.removeAllViews(); // Notify the ResearchLogger (development only diagnostics) that the keyboard view has // been detached. This is needed to invalidate the reference of {@link MainKeyboardView} // to null. @@ -930,7 +930,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack @Override public void onShowMoreKeysPanel(final MoreKeysPanel panel) { locatePreviewPlacerView(); - panel.showInParent(mPreviewPlacerView); + panel.showInParent(mDrawingPreviewPlacerView); mMoreKeysPanel = panel; dimEntireKeyboard(true /* dimmed */); } @@ -1228,6 +1228,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack @Override public void deallocateMemory() { super.deallocateMemory(); - mGestureTrailsPreview.deallocateMemory(); + mGestureTrailsDrawingPreview.deallocateMemory(); } } diff --git a/java/src/com/android/inputmethod/keyboard/internal/AbstractDrawingPreview.java b/java/src/com/android/inputmethod/keyboard/internal/AbstractDrawingPreview.java index b814fc162..32352ce04 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/AbstractDrawingPreview.java +++ b/java/src/com/android/inputmethod/keyboard/internal/AbstractDrawingPreview.java @@ -22,8 +22,9 @@ import android.view.View; import com.android.inputmethod.keyboard.PointerTracker; /** - * Abstract base class for previews that are drawn on PreviewPlacerView, e.g., - * GestureFloatingPrevewText, GestureTrail, and SlidingKeyInputPreview. + * Abstract base class for previews that are drawn on DrawingPreviewPlacerView, e.g., + * GestureFloatingTextDrawingPreview, GestureTrailsDrawingPreview, and + * SlidingKeyInputDrawingPreview. */ public abstract class AbstractDrawingPreview { private final View mDrawingView; diff --git a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java b/java/src/com/android/inputmethod/keyboard/internal/DrawingPreviewPlacerView.java similarity index 94% rename from java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java rename to java/src/com/android/inputmethod/keyboard/internal/DrawingPreviewPlacerView.java index 4c8607da8..14baf35d2 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java +++ b/java/src/com/android/inputmethod/keyboard/internal/DrawingPreviewPlacerView.java @@ -29,12 +29,12 @@ import com.android.inputmethod.latin.utils.CoordinateUtils; import java.util.ArrayList; -public final class PreviewPlacerView extends RelativeLayout { +public final class DrawingPreviewPlacerView extends RelativeLayout { private final int[] mKeyboardViewOrigin = CoordinateUtils.newInstance(); private final ArrayList mPreviews = CollectionUtils.newArrayList(); - public PreviewPlacerView(final Context context, final AttributeSet attrs) { + public DrawingPreviewPlacerView(final Context context, final AttributeSet attrs) { super(context, attrs); setWillNotDraw(false); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java b/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingTextDrawingPreview.java similarity index 97% rename from java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java rename to java/src/com/android/inputmethod/keyboard/internal/GestureFloatingTextDrawingPreview.java index c6dd9e100..179031316 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingPreviewText.java +++ b/java/src/com/android/inputmethod/keyboard/internal/GestureFloatingTextDrawingPreview.java @@ -42,7 +42,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils; * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewVerticalPadding * @attr ref R.styleable#KeyboardView_gestureFloatingPreviewRoundRadius */ -public class GestureFloatingPreviewText extends AbstractDrawingPreview { +public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview { protected static final class GesturePreviewTextParams { public final int mGesturePreviewTextOffset; public final int mGesturePreviewTextHeight; @@ -100,7 +100,7 @@ public class GestureFloatingPreviewText extends AbstractDrawingPreview { private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY; private final int[] mLastPointerCoords = CoordinateUtils.newInstance(); - public GestureFloatingPreviewText(final View drawingView, final TypedArray typedArray) { + public GestureFloatingTextDrawingPreview(final View drawingView, final TypedArray typedArray) { super(drawingView); mParams = new GesturePreviewTextParams(typedArray); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureTrailsPreview.java b/java/src/com/android/inputmethod/keyboard/internal/GestureTrailsDrawingPreview.java similarity index 94% rename from java/src/com/android/inputmethod/keyboard/internal/GestureTrailsPreview.java rename to java/src/com/android/inputmethod/keyboard/internal/GestureTrailsDrawingPreview.java index 8b413e5e2..2d23ddb75 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/GestureTrailsPreview.java +++ b/java/src/com/android/inputmethod/keyboard/internal/GestureTrailsDrawingPreview.java @@ -36,7 +36,7 @@ import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper; /** * Draw gesture trail preview graphics during gesture. */ -public final class GestureTrailsPreview extends AbstractDrawingPreview { +public final class GestureTrailsDrawingPreview extends AbstractDrawingPreview { private final SparseArray mGestureTrails = CollectionUtils.newSparseArray(); private final Params mGestureTrailParams; private final Paint mGesturePaint; @@ -52,12 +52,12 @@ public final class GestureTrailsPreview extends AbstractDrawingPreview { private final DrawingHandler mDrawingHandler; private static final class DrawingHandler - extends LeakGuardHandlerWrapper { + extends LeakGuardHandlerWrapper { private static final int MSG_UPDATE_GESTURE_TRAIL = 0; private final Params mGestureTrailParams; - public DrawingHandler(final GestureTrailsPreview ownerInstance, + public DrawingHandler(final GestureTrailsDrawingPreview ownerInstance, final Params gestureTrailParams) { super(ownerInstance); mGestureTrailParams = gestureTrailParams; @@ -65,7 +65,7 @@ public final class GestureTrailsPreview extends AbstractDrawingPreview { @Override public void handleMessage(final Message msg) { - final GestureTrailsPreview preview = getOwnerInstance(); + final GestureTrailsDrawingPreview preview = getOwnerInstance(); if (preview == null) { 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); mGestureTrailParams = new Params(mainKeyboardViewAttr); mDrawingHandler = new DrawingHandler(this, mGestureTrailParams); diff --git a/java/src/com/android/inputmethod/keyboard/internal/SlidingKeyInputPreview.java b/java/src/com/android/inputmethod/keyboard/internal/SlidingKeyInputDrawingPreview.java similarity index 95% rename from java/src/com/android/inputmethod/keyboard/internal/SlidingKeyInputPreview.java rename to java/src/com/android/inputmethod/keyboard/internal/SlidingKeyInputDrawingPreview.java index 2787ebfb9..aaa4072c9 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/SlidingKeyInputPreview.java +++ b/java/src/com/android/inputmethod/keyboard/internal/SlidingKeyInputDrawingPreview.java @@ -29,7 +29,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils; /** * 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 boolean mShowsSlidingKeyInputPreview; @@ -40,7 +40,8 @@ public final class SlidingKeyInputPreview extends AbstractDrawingPreview { private final RoundedLine mRoundedLine = new RoundedLine(); private final Paint mPaint = new Paint(); - public SlidingKeyInputPreview(final View drawingView, final TypedArray mainKeyboardViewAttr) { + public SlidingKeyInputDrawingPreview(final View drawingView, + final TypedArray mainKeyboardViewAttr) { super(drawingView); final int previewColor = mainKeyboardViewAttr.getColor( R.styleable.MainKeyboardView_slidingKeyInputPreviewColor, 0);