Update DragShadow states to UX spec.
There was an attempt to use LevelListDrawable for the different levels
of background of DocumentHolder, but that resulted in a weird state. Can
revisit that on another attempt.
Bug: 31182423
Change-Id: I74af77557790b1d30e316fa167ffed577eaf9032
diff --git a/src/com/android/documentsui/ItemDragListener.java b/src/com/android/documentsui/ItemDragListener.java
index 79f71d9..87c1274 100644
--- a/src/com/android/documentsui/ItemDragListener.java
+++ b/src/com/android/documentsui/ItemDragListener.java
@@ -68,7 +68,7 @@
return true;
case DragEvent.ACTION_DRAG_EXITED:
case DragEvent.ACTION_DRAG_ENDED:
- handleExitedEndedEvent(v);
+ handleExitedEndedEvent(v, event);
return true;
case DragEvent.ACTION_DROP:
return handleDropEvent(v, event);
@@ -80,10 +80,10 @@
private void handleEnteredEvent(View v, DragEvent event) {
mDragHost.onDragEntered(v, event.getLocalState());
@Nullable TimerTask task = createOpenTask(v, event);
+ mDragHost.setDropTargetHighlight(v, event.getLocalState(), true);
if (task == null) {
return;
}
- mDragHost.setDropTargetHighlight(v, true);
v.setTag(R.id.drag_hovering_tag, task);
mHoverTimer.schedule(task, SPRING_TIMEOUT);
}
@@ -95,8 +95,8 @@
}
}
- private void handleExitedEndedEvent(View v) {
- mDragHost.setDropTargetHighlight(v, false);
+ private void handleExitedEndedEvent(View v, DragEvent event) {
+ mDragHost.setDropTargetHighlight(v, event.getLocalState(), false);
TimerTask task = (TimerTask) v.getTag(R.id.drag_hovering_tag);
if (task != null) {
@@ -154,9 +154,10 @@
/**
* Highlights/unhighlights the view to visually indicate this view is being hovered.
* @param v the view being hovered
+ * @param localState the Local state object given by DragEvent
* @param highlight true if highlight the view; false if unhighlight it
*/
- void setDropTargetHighlight(View v, boolean highlight);
+ void setDropTargetHighlight(View v, Object localState, boolean highlight);
/**
* Notifies hovering timeout has elapsed