Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b685e53 authored by Ben Kwa's avatar Ben Kwa
Browse files

Clean up after a drop event.

- Clear the drop target highlight.
- Exit selection mode.

BUG=27296889

Change-Id: I869bd01cb49555b28b19164638b4c0af48ca8583
parent e3dfebf8
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1065,10 +1065,10 @@ public class DirectoryFragment extends Fragment

                // TODO: Expand drop target directory on hover?
                case DragEvent.ACTION_DRAG_ENTERED:
                    highlightDropTarget(v, true);
                    setDropTargetHighlight(v, true);
                    return true;
                case DragEvent.ACTION_DRAG_EXITED:
                    highlightDropTarget(v, false);
                    setDropTargetHighlight(v, false);
                    return true;

                case DragEvent.ACTION_DRAG_LOCATION:
@@ -1085,12 +1085,15 @@ public class DirectoryFragment extends Fragment
                        // TODO: Do not drop into the directory where the documents came from.
                    }
                    copyFromClipData(event.getClipData(), dstDir);
                    // Clean up the UI.
                    setDropTargetHighlight(v, false);
                    mSelectionManager.clearSelection();
                    return true;
            }
            return false;
        }

        private void highlightDropTarget(View v, boolean highlight) {
        private void setDropTargetHighlight(View v, boolean highlight) {
            // Note: use exact comparison - this code is searching for views which are children of
            // the RecyclerView instance in the UI.
            if (v.getParent() == mRecView) {