Merge "Move BandController out of MultiSelectManager."
This commit is contained in:
committed by
Android (Google) Code Review
commit
fa8105c06b
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
@@ -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);
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.support.v7.widget.RecyclerView.OnScrollListener;
|
||||
|
||||
import com.android.documentsui.dirlist.MultiSelectManager.SelectionEnvironment;
|
||||
import com.android.documentsui.dirlist.BandController.SelectionEnvironment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user