Start selection mode with single mouse click...

Double clicking an item opens it.
BandSelectManager tells MultiSelectManager where its selection begins
    so Shift+Click behavior can be complimentary.
BandSelectManager more actively manages selection...so it doesn't
    clear existing selection on mouse down.

Change-Id: Ibe65e793e84463d333a19f363dfb0d42c37480e3
diff --git a/src/com/android/documentsui/DirectoryFragment.java b/src/com/android/documentsui/DirectoryFragment.java
index 308375e..9468cfd 100644
--- a/src/com/android/documentsui/DirectoryFragment.java
+++ b/src/com/android/documentsui/DirectoryFragment.java
@@ -286,6 +286,11 @@
                     public boolean onSingleTapUp(MotionEvent e) {
                         return DirectoryFragment.this.onSingleTapUp(e);
                     }
+                    @Override
+                    public boolean onDoubleTap(MotionEvent e) {
+                        Log.d(TAG, "Handling double tap.");
+                        return DirectoryFragment.this.onDoubleTap(e);
+                    }
                 };
 
         mSelectionManager = new MultiSelectManager(mRecView, listener);
@@ -425,20 +430,37 @@
     }
 
     private boolean onSingleTapUp(MotionEvent e) {
-        int position = getEventAdapterPosition(e);
-
-        if (position != RecyclerView.NO_POSITION) {
-            final Cursor cursor = mAdapter.getItem(position);
-            checkNotNull(cursor, "Cursor cannot be null.");
-            final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
-            final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
-            if (isDocumentEnabled(docMimeType, docFlags)) {
-                final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
-                ((BaseActivity) getActivity()).onDocumentPicked(doc);
-                return true;
+        if (!Events.isMouseEvent(e)) {
+            int position = getEventAdapterPosition(e);
+            if (position != RecyclerView.NO_POSITION) {
+                return handleViewItem(position);
             }
         }
+        return false;
+    }
 
+    protected boolean onDoubleTap(MotionEvent e) {
+        if (Events.isMouseEvent(e)) {
+            Log.d(TAG, "Handling double tap from mouse.");
+            int position = getEventAdapterPosition(e);
+            if (position != RecyclerView.NO_POSITION) {
+                return handleViewItem(position);
+            }
+        }
+        return false;
+    }
+
+    private boolean handleViewItem(int position) {
+        final Cursor cursor = mAdapter.getItem(position);
+        checkNotNull(cursor, "Cursor cannot be null.");
+        final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
+        final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
+        if (isDocumentEnabled(docMimeType, docFlags)) {
+            final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
+            ((BaseActivity) getActivity()).onDocumentPicked(doc);
+            mSelectionManager.clearSelection();
+            return true;
+        }
         return false;
     }