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

Commit ac1e9d62 authored by Steve McKay's avatar Steve McKay Committed by Android (Google) Code Review
Browse files

Merge "Don't start BandselectManager in single-select mode."

parents 3991985e a698d636
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ public final class MultiSelectManager {
    private Adapter<?> mAdapter;
    private MultiSelectHelper mHelper;
    private boolean mSingleSelect;
    private BandSelectManager mBandManager;

    @Nullable private BandSelectManager mBandManager;

    /**
     * @param recyclerView
@@ -92,7 +93,9 @@ public final class MultiSelectManager {
                new RuntimeRecyclerViewHelper(recyclerView),
                mode);

        if (mode == MODE_MULTIPLE) {
            mBandManager = new BandSelectManager((RuntimeRecyclerViewHelper) mHelper);
        }

        GestureDetector.SimpleOnGestureListener listener =
                new GestureDetector.SimpleOnGestureListener() {
@@ -121,6 +124,10 @@ public final class MultiSelectManager {
                    public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
                        detector.onTouchEvent(e);

                        if (mBandManager == null) {
                            return false;
                        }

                        // b/23793622 notes the fact that we *never* receiver ACTION_DOWN
                        // events in onTouchEvent. Where it not for this issue, we'd
                        // push start handling down into handleInputEvent.
@@ -141,6 +148,7 @@ public final class MultiSelectManager {
                            mBandManager.handleInputEvent(
                                    new MotionInputEvent(e, recyclerView));
                        }

                        return mBandManager.isActive();
                    }

@@ -278,8 +286,10 @@ public final class MultiSelectManager {
    }

    public void handleLayoutChanged() {
        if (mBandManager != null) {
            mBandManager.handleLayoutChanged();
        }
    }

    /**
     * Clears the selection, without notifying anyone.
@@ -1233,7 +1243,7 @@ public final class MultiSelectManager {
            checkArgument(input.isMouseEvent());

            if (shouldStop(input)) {
                mBandManager.endBandSelect();
                endBandSelect();
                return;
            }