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

Commit 19edf343 authored by Ben Lin's avatar Ben Lin
Browse files

Allow Band selection in list mode.

Bug: 31347153
Change-Id: Ie1564553f6488c3ddf3c9412b06d252ac89a1b90
parent a8d2fdbf
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -71,10 +71,10 @@ public final class Events {
     * @return
     */
    public static boolean isMouseDragEvent(InputEvent e) {
        return e.isOverItem()
                && e.isMouseEvent()
        return e.isMouseEvent()
                && e.isActionMove()
                && e.isPrimaryButtonPressed();
                && e.isPrimaryButtonPressed()
                && e.isOverDragHotspot();
    }

    /**
@@ -152,6 +152,9 @@ public final class Events {
         */
        boolean isOverModelItem();

        /** Returns true if the event is over an area that can be dragged via touch */
        boolean isOverDragHotspot();

        /** Returns the adapter position of the item under the finger/cursor. */
        int getItemPosition();

@@ -275,6 +278,11 @@ public final class Events {
            return mEvent.getRawY();
        }

        @Override
        public boolean isOverDragHotspot() {
            return isOverItem() ? getDocumentDetails().isInDragHotspot(this) : false;
        }

        @Override
        public boolean isOverItem() {
            return getItemPosition() != RecyclerView.NO_POSITION;
+1 −1
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ public class BandController extends OnScrollListener {
        return !isActive()
                && e.isActionMove()  // the initial button move via mouse-touch (ie. down press)
                && mAdapter.getItemCount() > 0
                && e.getItemPosition() == RecyclerView.NO_ID;  // in empty space
                && !e.isOverDragHotspot();
    }

    public boolean shouldStop(InputEvent input) {
+1 −0
Original line number Diff line number Diff line
@@ -26,4 +26,5 @@ public interface DocumentDetails {
    String getModelId();
    int getAdapterPosition();
    boolean isInSelectionHotspot(InputEvent event);
    boolean isInDragHotspot(InputEvent event);
}
+9 −3
Original line number Diff line number Diff line
@@ -148,9 +148,15 @@ public abstract class DocumentHolder
        return rect.contains((int) event.getRawX(), (int) event.getRawY());
    }

    @Override
    public boolean isInDragHotspot(InputEvent event) {
        return false;
    }

    static void setEnabledRecursive(View itemView, boolean enabled) {
        if (itemView == null) return;
        if (itemView.isEnabled() == enabled) return;
        if (itemView == null || itemView.isEnabled() == enabled) {
            return;
        }
        itemView.setEnabled(enabled);

        if (itemView instanceof ViewGroup) {
+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.widget.TextView;

import com.android.documentsui.R;
import com.android.documentsui.State;
import com.android.documentsui.Events.InputEvent;

final class GridDirectoryHolder extends DocumentHolder {

@@ -57,6 +58,12 @@ final class GridDirectoryHolder extends DocumentHolder {
        }
    }

    @Override
    public boolean isInDragHotspot(InputEvent event) {
        // Entire grid box should be draggable
        return true;
    }

    /**
     * Bind this view to the given document for display.
     * @param cursor Pointing to the item to be bound.
Loading