am 7fb8b565: Include the local state obj in ACTION_DRAG_STARTED events

* commit '7fb8b565f9cd2ec6a63ff4d8a89f98f68a1a138c':
  Include the local state obj in ACTION_DRAG_STARTED events
This commit is contained in:
Christopher Tate
2011-01-20 17:05:57 -08:00
committed by Android Git Automerger
2 changed files with 8 additions and 6 deletions

View File

@@ -130,12 +130,13 @@ public static final int ACTION_DRAG_EXITED = 6;
} }
private void init(int action, float x, float y, ClipDescription description, ClipData data, private void init(int action, float x, float y, ClipDescription description, ClipData data,
boolean result) { Object localState, boolean result) {
mAction = action; mAction = action;
mX = x; mX = x;
mY = y; mY = y;
mClipDescription = description; mClipDescription = description;
mClipData = data; mClipData = data;
mLocalState = localState;
mDragResult = result; mDragResult = result;
} }
@@ -150,7 +151,7 @@ public static final int ACTION_DRAG_EXITED = 6;
synchronized (gRecyclerLock) { synchronized (gRecyclerLock) {
if (gRecyclerTop == null) { if (gRecyclerTop == null) {
ev = new DragEvent(); ev = new DragEvent();
ev.init(action, x, y, description, data, result); ev.init(action, x, y, description, data, localState, result);
return ev; return ev;
} }
ev = gRecyclerTop; ev = gRecyclerTop;
@@ -161,7 +162,7 @@ public static final int ACTION_DRAG_EXITED = 6;
ev.mRecycled = false; ev.mRecycled = false;
ev.mNext = null; ev.mNext = null;
ev.init(action, x, y, description, data, result); ev.init(action, x, y, description, data, localState, result);
return ev; return ev;
} }

View File

@@ -228,7 +228,7 @@ public final class ViewRoot extends Handler implements ViewParent,
/* Drag/drop */ /* Drag/drop */
ClipDescription mDragDescription; ClipDescription mDragDescription;
View mCurrentDragView; View mCurrentDragView;
Object mLocalDragState; volatile Object mLocalDragState;
final PointF mDragPoint = new PointF(); final PointF mDragPoint = new PointF();
final PointF mLastTouchPoint = new PointF(); final PointF mLastTouchPoint = new PointF();
@@ -2051,7 +2051,9 @@ public final class ViewRoot extends Handler implements ViewParent,
} break; } break;
case DISPATCH_DRAG_EVENT: case DISPATCH_DRAG_EVENT:
case DISPATCH_DRAG_LOCATION_EVENT: { case DISPATCH_DRAG_LOCATION_EVENT: {
handleDragEvent((DragEvent)msg.obj); DragEvent event = (DragEvent)msg.obj;
event.mLocalState = mLocalDragState; // only present when this app called startDrag()
handleDragEvent(event);
} break; } break;
} }
} }
@@ -3133,7 +3135,6 @@ public final class ViewRoot extends Handler implements ViewParent,
} else { } else {
what = DISPATCH_DRAG_EVENT; what = DISPATCH_DRAG_EVENT;
} }
event.mLocalState = mLocalDragState; // only present when this app called startDrag()
Message msg = obtainMessage(what, event); Message msg = obtainMessage(what, event);
sendMessage(msg); sendMessage(msg);
} }