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

Commit fa8105c0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move BandController out of MultiSelectManager."

parents 3abcd439 716912e7
Loading
Loading
Loading
Loading
+1255 −0

File added.

Preview size limit exceeded, changes collapsed.

+9 −1
Original line number Diff line number Diff line
@@ -177,6 +177,8 @@ public class DirectoryFragment extends Fragment
    // Save selection found during creation so it can be restored during directory loading.
    private Selection mSelection = null;
    private boolean mSearchMode = false;

    private @Nullable BandController mBandController;
    private @Nullable ActionMode mActionMode;

    private DirectoryDragListener mOnDragListener;
@@ -299,6 +301,10 @@ public class DirectoryFragment extends Fragment
                    : MultiSelectManager.MODE_SINGLE,
                null);

        if (state.allowMultiple) {
            mBandController = new BandController(mRecView, mAdapter, mSelectionManager);
        }

        mSelectionManager.addCallback(new SelectionModeListener());

        mModel = new Model();
@@ -451,7 +457,9 @@ public class DirectoryFragment extends Fragment
        int pad = getDirectoryPadding(mode);
        mRecView.setPadding(pad, pad, pad, pad);
        mRecView.requestLayout();
        mSelectionManager.handleLayoutChanged();  // RecyclerView doesn't do this for us
        if (mBandController != null) {
            mBandController.handleLayoutChanged();
        }
        mIconHelper.setViewMode(mode);
    }

+9 −1169

File changed.

Preview size limit exceeded, changes collapsed.

+4 −4
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.documentsui.dirlist;

import static com.android.documentsui.dirlist.MultiSelectManager.GridModel.NOT_SET;
import static com.android.documentsui.dirlist.BandController.GridModel.NOT_SET;

import android.graphics.Point;
import android.graphics.Rect;
@@ -24,14 +24,14 @@ import android.support.v7.widget.RecyclerView.OnScrollListener;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;

import com.android.documentsui.dirlist.MultiSelectManager.GridModel;
import com.android.documentsui.dirlist.BandController.GridModel;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@SmallTest
public class MultiSelectManager_GridModelTest extends AndroidTestCase {
public class BandController_GridModelTest extends AndroidTestCase {

    private static final int VIEW_PADDING_PX = 5;
    private static final int CHILD_VIEW_EDGE_PX = 100;
@@ -279,7 +279,7 @@ public class MultiSelectManager_GridModelTest extends AndroidTestCase {
        model.onScrolled(null, 0, dy);
    }

    private static final class TestEnvironment implements MultiSelectManager.SelectionEnvironment {
    private static final class TestEnvironment implements BandController.SelectionEnvironment {

        private final int mNumColumns;
        private final int mNumRows;
+5 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.SparseBooleanArray;

import com.android.documentsui.TestInputEvent;
import com.android.documentsui.dirlist.MultiSelectManager.Selection;

import com.google.common.collect.Lists;

import java.util.ArrayList;
@@ -43,14 +44,12 @@ public class MultiSelectManagerTest extends AndroidTestCase {

    private MultiSelectManager mManager;
    private TestCallback mCallback;
    private TestSelectionEnvironment mEnv;
    private TestDocumentsAdapter mAdapter;

    public void setUp() throws Exception {
        mCallback = new TestCallback();
        mEnv = new TestSelectionEnvironment(items);
        mAdapter = new TestDocumentsAdapter(items);
        mManager = new MultiSelectManager(mEnv, mAdapter, MultiSelectManager.MODE_MULTIPLE, null);
        mManager = new MultiSelectManager(mAdapter, MultiSelectManager.MODE_MULTIPLE, null);
        mManager.addCallback(mCallback);
    }

@@ -174,7 +173,7 @@ public class MultiSelectManagerTest extends AndroidTestCase {
    }

    public void testSingleSelectMode() {
        mManager = new MultiSelectManager(mEnv, mAdapter, MultiSelectManager.MODE_SINGLE, null);
        mManager = new MultiSelectManager(mAdapter, MultiSelectManager.MODE_SINGLE, null);
        mManager.addCallback(mCallback);
        longPress(20);
        tap(13);
@@ -182,7 +181,7 @@ public class MultiSelectManagerTest extends AndroidTestCase {
    }

    public void testSingleSelectMode_ShiftTap() {
        mManager = new MultiSelectManager(mEnv, mAdapter, MultiSelectManager.MODE_SINGLE, null);
        mManager = new MultiSelectManager(mAdapter, MultiSelectManager.MODE_SINGLE, null);
        mManager.addCallback(mCallback);
        longPress(13);
        shiftTap(20);
@@ -229,7 +228,7 @@ public class MultiSelectManagerTest extends AndroidTestCase {
    }

    public void testRangeSelection_singleSelect() {
        mManager = new MultiSelectManager(mEnv, mAdapter, MultiSelectManager.MODE_SINGLE, null);
        mManager = new MultiSelectManager(mAdapter, MultiSelectManager.MODE_SINGLE, null);
        mManager.addCallback(mCallback);
        mManager.startRangeSelection(11);
        mManager.snapRangeSelection(19);
Loading