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

* commit '737e9150935e1058b2d7d6adcd1b7857fa7c37ca':
  Show gesture floating preview text at oldest finger
This commit is contained in:
Tadashi G. Takaoka 2012-09-13 02:33:58 -07:00 committed by Android Git Automerger
commit 265083c85a
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();
}