Loading src/com/android/documentsui/AbstractActionHandler.java +5 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA throw new UnsupportedOperationException("Can't open document."); } @Override public void openDocumentViewOnly(DocumentInfo doc) { throw new UnsupportedOperationException("Open doc not supported!"); } @Override public void showInspector(DocumentInfo doc) { throw new UnsupportedOperationException("Can't open properties."); Loading src/com/android/documentsui/ActionHandler.java +6 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,12 @@ public interface ActionHandler { */ boolean openItem(ItemDetails<String> doc, @ViewType int type, @ViewType int fallback); /** * Similar to openItem but takes DocumentInfo instead of DocumentItemDetails and uses * VIEW_TYPE_VIEW with no fallback. */ void openDocumentViewOnly(DocumentInfo doc); /** * This is called when user hovers over a doc for enough time during a drag n' drop, to open a * folder that accepts drop. We should only open a container that's not an archive, since archives Loading src/com/android/documentsui/MenuManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -427,7 +427,7 @@ public abstract class MenuManager { boolean canExtract(); boolean canOpenWith(); boolean canOpen(); boolean canViewInOwner(); } Loading src/com/android/documentsui/dirlist/DirectoryFragment.java +26 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.SharedMinimal.VERBOSE; import static com.android.documentsui.base.State.MODE_GRID; import static com.android.documentsui.base.State.MODE_LIST; import static com.android.documentsui.flags.Flags.desktopFileHandling; import android.app.ActivityManager; import android.content.BroadcastReceiver; Loading Loading @@ -924,7 +925,17 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mSelectionMgr.copySelection(selection); final int id = item.getItemId(); if (id == R.id.action_menu_select || id == R.id.dir_menu_open) { if (desktopFileHandling() && id == R.id.dir_menu_open) { // On desktop, "open" is displayed in file management mode (i.e. `files.MenuManager`). // This menu item behaves the same as double click on the menu item which is handled by // onItemActivated but since onItemActivated requires a RecylcerView ItemDetails, we're // using viewDocument that takes a Selection. viewDocument(selection); return true; } else if (id == R.id.action_menu_select || id == R.id.dir_menu_open) { // Note: this code path is never executed for `dir_menu_open`. The menu item is always // hidden unless the desktopFileHandling flag is enabled, in which case the menu item // will be handled by the condition above. openDocuments(selection); mActionModeController.finishActionMode(); return true; Loading Loading @@ -1082,6 +1093,20 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mActions.showChooserForDoc(doc); } private void viewDocument(final Selection<String> selected) { Metrics.logUserAction(MetricConsts.USER_ACTION_OPEN); if (selected.isEmpty()) { return; } assert selected.size() == 1; DocumentInfo doc = DocumentInfo.fromDirectoryCursor(mModel.getItem(selected.iterator().next())); mActions.openDocumentViewOnly(doc); } private void transferDocuments( final Selection<String> selected, @Nullable DocumentStack destination, final @OpType int mode) { Loading src/com/android/documentsui/dirlist/SelectionMetadata.java +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ public class SelectionMetadata extends SelectionObserver<String> } @Override public boolean canOpenWith() { public boolean canOpen() { return size() == 1 && mDirectoryCount == 0 && mInArchiveCount == 0 && mPartialCount == 0; } } Loading
src/com/android/documentsui/AbstractActionHandler.java +5 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA throw new UnsupportedOperationException("Can't open document."); } @Override public void openDocumentViewOnly(DocumentInfo doc) { throw new UnsupportedOperationException("Open doc not supported!"); } @Override public void showInspector(DocumentInfo doc) { throw new UnsupportedOperationException("Can't open properties."); Loading
src/com/android/documentsui/ActionHandler.java +6 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,12 @@ public interface ActionHandler { */ boolean openItem(ItemDetails<String> doc, @ViewType int type, @ViewType int fallback); /** * Similar to openItem but takes DocumentInfo instead of DocumentItemDetails and uses * VIEW_TYPE_VIEW with no fallback. */ void openDocumentViewOnly(DocumentInfo doc); /** * This is called when user hovers over a doc for enough time during a drag n' drop, to open a * folder that accepts drop. We should only open a container that's not an archive, since archives Loading
src/com/android/documentsui/MenuManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -427,7 +427,7 @@ public abstract class MenuManager { boolean canExtract(); boolean canOpenWith(); boolean canOpen(); boolean canViewInOwner(); } Loading
src/com/android/documentsui/dirlist/DirectoryFragment.java +26 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.SharedMinimal.VERBOSE; import static com.android.documentsui.base.State.MODE_GRID; import static com.android.documentsui.base.State.MODE_LIST; import static com.android.documentsui.flags.Flags.desktopFileHandling; import android.app.ActivityManager; import android.content.BroadcastReceiver; Loading Loading @@ -924,7 +925,17 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mSelectionMgr.copySelection(selection); final int id = item.getItemId(); if (id == R.id.action_menu_select || id == R.id.dir_menu_open) { if (desktopFileHandling() && id == R.id.dir_menu_open) { // On desktop, "open" is displayed in file management mode (i.e. `files.MenuManager`). // This menu item behaves the same as double click on the menu item which is handled by // onItemActivated but since onItemActivated requires a RecylcerView ItemDetails, we're // using viewDocument that takes a Selection. viewDocument(selection); return true; } else if (id == R.id.action_menu_select || id == R.id.dir_menu_open) { // Note: this code path is never executed for `dir_menu_open`. The menu item is always // hidden unless the desktopFileHandling flag is enabled, in which case the menu item // will be handled by the condition above. openDocuments(selection); mActionModeController.finishActionMode(); return true; Loading Loading @@ -1082,6 +1093,20 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mActions.showChooserForDoc(doc); } private void viewDocument(final Selection<String> selected) { Metrics.logUserAction(MetricConsts.USER_ACTION_OPEN); if (selected.isEmpty()) { return; } assert selected.size() == 1; DocumentInfo doc = DocumentInfo.fromDirectoryCursor(mModel.getItem(selected.iterator().next())); mActions.openDocumentViewOnly(doc); } private void transferDocuments( final Selection<String> selected, @Nullable DocumentStack destination, final @OpType int mode) { Loading
src/com/android/documentsui/dirlist/SelectionMetadata.java +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ public class SelectionMetadata extends SelectionObserver<String> } @Override public boolean canOpenWith() { public boolean canOpen() { return size() == 1 && mDirectoryCount == 0 && mInArchiveCount == 0 && mPartialCount == 0; } }