Show gesture floating preview text at oldest finger

Bug: 7119032
Change-Id: Iddb26ba1a595e472fde0982d744b5652d5fbda3e
main
Tadashi G. Takaoka 2012-09-13 12:38:08 +09:00
parent 71fcf0f5ec
commit f0e83046f0
4 changed files with 17 additions and 9 deletions

View File

@ -855,9 +855,10 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
@Override
public void showGesturePreviewTrail(final PointerTracker tracker) {
public void showGesturePreviewTrail(final PointerTracker tracker,
final boolean isOldestTracker) {
locatePreviewPlacerView();
mPreviewPlacerView.invalidatePointer(tracker);
mPreviewPlacerView.invalidatePointer(tracker, isOldestTracker);
}
@Override

View File

@ -80,7 +80,7 @@ public class PointerTracker implements PointerTrackerQueue.Element {
public void invalidateKey(Key key);
public void showKeyPreview(PointerTracker tracker);
public void dismissKeyPreview(PointerTracker tracker);
public void showGesturePreviewTrail(PointerTracker tracker);
public void showGesturePreviewTrail(PointerTracker tracker, boolean isOldestTracker);
}
public interface TimerProxy {
@ -550,7 +550,7 @@ public class PointerTracker implements PointerTrackerQueue.Element {
}
sInGesture = true;
mListener.onStartBatchInput();
mDrawingProxy.showGesturePreviewTrail(this);
mDrawingProxy.showGesturePreviewTrail(this, true /* isOldestTracker */);
}
private void updateBatchInput(final long eventTime) {
@ -567,7 +567,8 @@ public class PointerTracker implements PointerTrackerQueue.Element {
mListener.onUpdateBatchInput(sAggregratedPointers);
}
}
mDrawingProxy.showGesturePreviewTrail(this);
final boolean isOldestTracker = sPointerTrackerQueue.getOldestElement() == this;
mDrawingProxy.showGesturePreviewTrail(this, isOldestTracker);
}
private void endBatchInput() {
@ -584,7 +585,7 @@ public class PointerTracker implements PointerTrackerQueue.Element {
clearBatchInputPointsOfAllPointerTrackers();
}
}
mDrawingProxy.showGesturePreviewTrail(this);
mDrawingProxy.showGesturePreviewTrail(this, true /* isOldestTracker */);
}
private static void abortBatchInput() {

View File

@ -73,6 +73,10 @@ public class PointerTrackerQueue {
mArraySize = newSize;
}
public synchronized Element getOldestElement() {
return (mArraySize == 0) ? null : mExpandableArrayOfActivePointers.get(0);
}
public synchronized void releaseAllPointersOlderThan(final Element pointer,
final long eventTime) {
if (DEBUG) {

View File

@ -188,7 +188,7 @@ public class PreviewPlacerView extends RelativeLayout {
mDrawsGestureFloatingPreviewText = drawsGestureFloatingPreviewText;
}
public void invalidatePointer(final PointerTracker tracker) {
public void invalidatePointer(final PointerTracker tracker, final boolean isOldestTracker) {
GesturePreviewTrail trail;
synchronized (mGesturePreviewTrails) {
trail = mGesturePreviewTrails.get(tracker.mPointerId);
@ -199,8 +199,10 @@ public class PreviewPlacerView extends RelativeLayout {
}
trail.addStroke(tracker.getGestureStrokeWithPreviewTrail(), tracker.getDownTime());
mLastPointerX = tracker.getLastX();
mLastPointerY = tracker.getLastY();
if (isOldestTracker) {
mLastPointerX = tracker.getLastX();
mLastPointerY = tracker.getLastY();
}
// TODO: Should narrow the invalidate region.
invalidate();
}