Loading src/com/android/documentsui/DirectoryReloadLock.java +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import android.annotation.Nullable; import android.util.Log; import com.android.documentsui.base.Shared; import com.android.documentsui.selection.BandController; import com.android.documentsui.selection.addons.BandController; /** * A lock used by {@link DirectoryLoader} and {@link BandController} to ensure refresh is blocked Loading src/com/android/documentsui/DocsSelectionManager.java +11 −6 Original line number Diff line number Diff line Loading @@ -115,18 +115,18 @@ public final class DocsSelectionManager implements SelectionManager { } @Override public void snapProvisionalRangeSelection(int pos) { mDelegate.snapProvisionalRangeSelection(pos); public void formNewSelectionRange(int startPos, int endPos) { mDelegate.formNewSelectionRange(startPos, endPos); } @Override public void formNewSelectionRange(int startPos, int endPos) { mDelegate.formNewSelectionRange(startPos, endPos); public void snapProvisionalRangeSelection(int pos) { mDelegate.snapProvisionalRangeSelection(pos); } @Override public void cancelProvisionalSelection() { mDelegate.cancelProvisionalSelection(); public void clearProvisionalSelection() { mDelegate.clearProvisionalSelection(); } @Override Loading @@ -134,6 +134,11 @@ public final class DocsSelectionManager implements SelectionManager { mDelegate.setProvisionalSelection(newSelection); } @Override public void mergeProvisionalSelection() { mDelegate.mergeProvisionalSelection(); } @Override public void endRangeSelection() { mDelegate.endRangeSelection(); Loading src/com/android/documentsui/Injector.java +5 −4 Original line number Diff line number Diff line Loading @@ -130,9 +130,10 @@ public class Injector<T extends ActionHandler> { /** * Obtains action handler and resets it if necessary. * @param reloadLock the lock held by {@link com.android.documentsui.selection.BandController} * to prevent loader from updating result during band selection. May be * {@code null} if called from * * @param reloadLock the lock held by * {@link com.android.documentsui.selection.addons.BandController} to prevent loader * from updating result during band selection. May be {@code null} if called from * {@link com.android.documentsui.sidebar.RootsFragment}. * @return the action handler */ Loading src/com/android/documentsui/dirlist/DirectoryFragment.java +33 −13 Original line number Diff line number Diff line Loading @@ -90,11 +90,11 @@ import com.android.documentsui.clipping.DocumentClipper; import com.android.documentsui.clipping.UrisSupplier; import com.android.documentsui.dirlist.AnimationView.AnimationType; import com.android.documentsui.picker.PickActivity; import com.android.documentsui.selection.BandController; import com.android.documentsui.selection.GestureSelector; import com.android.documentsui.selection.Selection; import com.android.documentsui.selection.SelectionManager; import com.android.documentsui.selection.SelectionManager.SelectionPredicate; import com.android.documentsui.selection.addons.BandController; import com.android.documentsui.selection.addons.GestureSelector; import com.android.documentsui.services.FileOperation; import com.android.documentsui.services.FileOperationService; import com.android.documentsui.services.FileOperationService.OpType; Loading Loading @@ -316,8 +316,33 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mModel.addUpdateListener(mAdapter.getModelUpdateListener()); mModel.addUpdateListener(mModelUpdateListener); SelectionManager.SelectionPredicate canSelect = this::canSetSelectionState; mSelectionMgr = mInjector.getSelectionManager(mAdapter, canSelect); SelectionPredicate selectionPredicate = new SelectionPredicate() { @Override public boolean canSetStateForId(String id, boolean nextState) { return canSetSelectionState(id, nextState); } @Override public boolean canSetStateAtPosition(int position, boolean nextState) { // This method features a nextState arg for symmetry. // But, there are no current uses for checking un-selecting state by position. // So rather than have some unsuspecting client think canSetState(int, false) // will ever do anything. Let's just be grumpy about it. assert nextState == true; // NOTE: Given that we have logic in some places disallowing selection, // it may be a bug that Band and Gesture based selections don't // also verify something can be unselected. // The band selection model only operates on documents and directories. // Exclude other types of adapter items like whitespace and dividers. RecyclerView.ViewHolder vh = mRecView.findViewHolderForAdapterPosition(position); return ModelBackedDocumentsAdapter.isContentType(vh.getItemViewType()); } }; mSelectionMgr = mInjector.getSelectionManager(mAdapter, selectionPredicate); mFocusManager = mInjector.getFocusManager(mRecView, mModel); mActions = mInjector.getActionHandler(mReloadLock); Loading @@ -332,16 +357,11 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On if (mState.allowMultiple) { mBandController = new BandController( mRecView, mAdapter, mAdapter, // stableIds provider. mSelectionMgr, canSelect, mReloadLock, (int pos) -> { // The band selection model only operates on documents and directories. // Exclude other types of adapter items like whitespace and dividers. RecyclerView.ViewHolder vh = mRecView.findViewHolderForAdapterPosition(pos); return ModelBackedDocumentsAdapter.isContentType(vh.getItemViewType()); }); selectionPredicate, mReloadLock); mBandSelectStarted = mFocusManager::clearFocus; mBandController.addBandSelectStartedListener(mBandSelectStarted); } Loading src/com/android/documentsui/dirlist/DocumentsAdapter.java +0 −4 Original line number Diff line number Diff line Loading @@ -68,10 +68,6 @@ public abstract class DocumentsAdapter throw new UnsupportedOperationException(); } public boolean hasModelIds() { return !getStableIds().isEmpty(); } static boolean isDirectory(Cursor cursor) { final String mimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE); return Document.MIME_TYPE_DIR.equals(mimeType); Loading Loading
src/com/android/documentsui/DirectoryReloadLock.java +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import android.annotation.Nullable; import android.util.Log; import com.android.documentsui.base.Shared; import com.android.documentsui.selection.BandController; import com.android.documentsui.selection.addons.BandController; /** * A lock used by {@link DirectoryLoader} and {@link BandController} to ensure refresh is blocked Loading
src/com/android/documentsui/DocsSelectionManager.java +11 −6 Original line number Diff line number Diff line Loading @@ -115,18 +115,18 @@ public final class DocsSelectionManager implements SelectionManager { } @Override public void snapProvisionalRangeSelection(int pos) { mDelegate.snapProvisionalRangeSelection(pos); public void formNewSelectionRange(int startPos, int endPos) { mDelegate.formNewSelectionRange(startPos, endPos); } @Override public void formNewSelectionRange(int startPos, int endPos) { mDelegate.formNewSelectionRange(startPos, endPos); public void snapProvisionalRangeSelection(int pos) { mDelegate.snapProvisionalRangeSelection(pos); } @Override public void cancelProvisionalSelection() { mDelegate.cancelProvisionalSelection(); public void clearProvisionalSelection() { mDelegate.clearProvisionalSelection(); } @Override Loading @@ -134,6 +134,11 @@ public final class DocsSelectionManager implements SelectionManager { mDelegate.setProvisionalSelection(newSelection); } @Override public void mergeProvisionalSelection() { mDelegate.mergeProvisionalSelection(); } @Override public void endRangeSelection() { mDelegate.endRangeSelection(); Loading
src/com/android/documentsui/Injector.java +5 −4 Original line number Diff line number Diff line Loading @@ -130,9 +130,10 @@ public class Injector<T extends ActionHandler> { /** * Obtains action handler and resets it if necessary. * @param reloadLock the lock held by {@link com.android.documentsui.selection.BandController} * to prevent loader from updating result during band selection. May be * {@code null} if called from * * @param reloadLock the lock held by * {@link com.android.documentsui.selection.addons.BandController} to prevent loader * from updating result during band selection. May be {@code null} if called from * {@link com.android.documentsui.sidebar.RootsFragment}. * @return the action handler */ Loading
src/com/android/documentsui/dirlist/DirectoryFragment.java +33 −13 Original line number Diff line number Diff line Loading @@ -90,11 +90,11 @@ import com.android.documentsui.clipping.DocumentClipper; import com.android.documentsui.clipping.UrisSupplier; import com.android.documentsui.dirlist.AnimationView.AnimationType; import com.android.documentsui.picker.PickActivity; import com.android.documentsui.selection.BandController; import com.android.documentsui.selection.GestureSelector; import com.android.documentsui.selection.Selection; import com.android.documentsui.selection.SelectionManager; import com.android.documentsui.selection.SelectionManager.SelectionPredicate; import com.android.documentsui.selection.addons.BandController; import com.android.documentsui.selection.addons.GestureSelector; import com.android.documentsui.services.FileOperation; import com.android.documentsui.services.FileOperationService; import com.android.documentsui.services.FileOperationService.OpType; Loading Loading @@ -316,8 +316,33 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mModel.addUpdateListener(mAdapter.getModelUpdateListener()); mModel.addUpdateListener(mModelUpdateListener); SelectionManager.SelectionPredicate canSelect = this::canSetSelectionState; mSelectionMgr = mInjector.getSelectionManager(mAdapter, canSelect); SelectionPredicate selectionPredicate = new SelectionPredicate() { @Override public boolean canSetStateForId(String id, boolean nextState) { return canSetSelectionState(id, nextState); } @Override public boolean canSetStateAtPosition(int position, boolean nextState) { // This method features a nextState arg for symmetry. // But, there are no current uses for checking un-selecting state by position. // So rather than have some unsuspecting client think canSetState(int, false) // will ever do anything. Let's just be grumpy about it. assert nextState == true; // NOTE: Given that we have logic in some places disallowing selection, // it may be a bug that Band and Gesture based selections don't // also verify something can be unselected. // The band selection model only operates on documents and directories. // Exclude other types of adapter items like whitespace and dividers. RecyclerView.ViewHolder vh = mRecView.findViewHolderForAdapterPosition(position); return ModelBackedDocumentsAdapter.isContentType(vh.getItemViewType()); } }; mSelectionMgr = mInjector.getSelectionManager(mAdapter, selectionPredicate); mFocusManager = mInjector.getFocusManager(mRecView, mModel); mActions = mInjector.getActionHandler(mReloadLock); Loading @@ -332,16 +357,11 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On if (mState.allowMultiple) { mBandController = new BandController( mRecView, mAdapter, mAdapter, // stableIds provider. mSelectionMgr, canSelect, mReloadLock, (int pos) -> { // The band selection model only operates on documents and directories. // Exclude other types of adapter items like whitespace and dividers. RecyclerView.ViewHolder vh = mRecView.findViewHolderForAdapterPosition(pos); return ModelBackedDocumentsAdapter.isContentType(vh.getItemViewType()); }); selectionPredicate, mReloadLock); mBandSelectStarted = mFocusManager::clearFocus; mBandController.addBandSelectStartedListener(mBandSelectStarted); } Loading
src/com/android/documentsui/dirlist/DocumentsAdapter.java +0 −4 Original line number Diff line number Diff line Loading @@ -68,10 +68,6 @@ public abstract class DocumentsAdapter throw new UnsupportedOperationException(); } public boolean hasModelIds() { return !getStableIds().isEmpty(); } static boolean isDirectory(Cursor cursor) { final String mimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE); return Document.MIME_TYPE_DIR.equals(mimeType); Loading