am 265083c8: am 737e9150: Merge "Show gesture floating preview text at oldest finger" into jb-mr1-dev

* commit '265083c85a656b4abfa1ec2470c61a12d967e8c9':
  Show gesture floating preview text at oldest finger
main
Tadashi G. Takaoka 2012-09-13 14:11:25 -07:00 committed by Android Git Automerger
commit f41b836a13
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();
}