Rename classes related to AbstractDrawingPreview
Change-Id: Ife2e2c08b2b6fbf9ec33cf259f276878816b291c
This commit is contained in:
parent
e82200787c
commit
cf915ddc87
6 changed files with 53 additions and 50 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<AbstractDrawingPreview> mPreviews = CollectionUtils.newArrayList();
|
||||
|
||||
public PreviewPlacerView(final Context context, final AttributeSet attrs) {
|
||||
public DrawingPreviewPlacerView(final Context context, final AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setWillNotDraw(false);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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<GestureTrail> 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<GestureTrailsPreview> {
|
||||
extends LeakGuardHandlerWrapper<GestureTrailsDrawingPreview> {
|
||||
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);
|
|
@ -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);
|
Loading…
Reference in a new issue