Browse Source

Merge pull request #755 from owncloud/OpenWithInContextMenu

"open with" in ContextMenu of downloaded files
jabarros 10 years ago
parent
commit
0b7c37671f
1 changed files with 6 additions and 8 deletions
  1. 6 8
      src/com/owncloud/android/ui/fragment/OCFileListFragment.java

+ 6 - 8
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -257,15 +257,9 @@ public class OCFileListFragment extends ExtendedListFragment {
                 );
                 mf.filter(menu);
             }
-            
-            /// additional restrictions for this fragment 
-            // TODO allow in the future 'open with' for previewable files
-            MenuItem item = menu.findItem(R.id.action_open_file_with);
-            if (item != null) {
-                item.setVisible(false);
-                item.setEnabled(false);
-            }
+                 
             /// TODO break this direct dependency on FileDisplayActivity... if possible
+            MenuItem item = menu.findItem(R.id.action_open_file_with);
             FileFragment frag = ((FileDisplayActivity)getSherlockActivity()).getSecondFragment();
             if (frag != null && frag instanceof FileDetailFragment && 
                     frag.getFile().getFileId() == targetFile.getFileId()) {
@@ -291,6 +285,10 @@ public class OCFileListFragment extends ExtendedListFragment {
                 mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile);
                 return true;
             }
+            case R.id.action_open_file_with: {
+                mContainerActivity.getFileOperationsHelper().openFile(mTargetFile);
+                return true;
+            }
             case R.id.action_unshare_file: {
                 mContainerActivity.getFileOperationsHelper().unshareFileWithLink(mTargetFile);
                 return true;