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

Commit 35d1ff17 authored by Ben Lin's avatar Ben Lin
Browse files

Stop de-selection when drag and drop starts.

Bug: 31347153
Change-Id: Ib14b09d3e572b4fdb595679184967555c3050925
parent d471fea3
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -35,9 +35,7 @@ class DirectoryDragListener extends ItemDragListener<DirectoryFragment> {
    public boolean onDrag(View v, DragEvent event) {
        final boolean result = super.onDrag(v, event);

        if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) {
            mDragHost.dragStarted();
        } else if (event.getAction() == DragEvent.ACTION_DRAG_ENDED) {
        if (event.getAction() == DragEvent.ACTION_DRAG_ENDED) {
            // getResult() is true if drag was accepted
            mDragHost.dragStopped(event.getResult());
        }
+1 −13
Original line number Diff line number Diff line
@@ -1000,18 +1000,6 @@ public class DirectoryFragment extends Fragment
        }
    }

    void dragStarted() {
        // When files are selected for dragging, ActionMode is started. This obscures the breadcrumb
        // with an ActionBar. In order to make drag and drop to the breadcrumb possible, we first
        // end ActionMode so the breadcrumb is visible to the user.
        //
        // mActionModeController is null when dragStarted() is called on spring loaded
        // folders/roots.
        if (mActionModeController != null) {
            mActionModeController.finishActionMode();
        }
    }

    void dragStopped(boolean result) {
        if (result) {
            mSelectionMgr.clearSelection();
@@ -1117,7 +1105,7 @@ public class DirectoryFragment extends Fragment
        if (v.getParent() == mRecView) {
            RecyclerView.ViewHolder vh = mRecView.getChildViewHolder(v);
            if (vh instanceof DocumentHolder) {
                ((DocumentHolder) vh).setHighlighted(highlight);
                ((DocumentHolder) vh).setDroppableHighlight(highlight);
            }
        }
    }
+7 −2
Original line number Diff line number Diff line
@@ -106,10 +106,15 @@ public abstract class DocumentHolder
    }

    /**
     * Highlights the associated item view.
     * Highlights the associated item view to indicate it's droppable.
     * @param highlighted
     */
    public void setHighlighted(boolean highlighted) {
    public void setDroppableHighlight(boolean highlighted) {
        // If item is already selected, its droppable highlight should not be changed.
        if (itemView.isActivated()) {
            return;
        }

        itemView.setBackgroundColor(highlighted ? mSelectedBgColor : mDefaultBgColor);
    }