瀏覽代碼

Fix. Allow set multiple files as 'Available offline'

jabarros 8 年之前
父節點
當前提交
460e187713
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      src/com/owncloud/android/files/FileMenuFilter.java

+ 10 - 6
src/com/owncloud/android/files/FileMenuFilter.java

@@ -173,7 +173,7 @@ public class FileMenuFilter {
         }
 
         // OPEN WITH (different to preview!)
-        if (!isFile() || !anyFileDown() || synchronizing) {
+        if (!isSingleFile() || !anyFileDown() || synchronizing) {
             toHide.add(R.id.action_open_file_with);
 
         } else {
@@ -214,7 +214,7 @@ public class FileMenuFilter {
         }
 
         // SEE DETAILS
-        if (!isFile()) {
+        if (!isSingleFile()) {
             toHide.add(R.id.action_see_details);
         } else {
             toShow.add(R.id.action_see_details);
@@ -223,21 +223,21 @@ public class FileMenuFilter {
         // SEND
         boolean sendAllowed = (mContext != null &&
                 mContext.getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on"));
-        if (!isFile() || !sendAllowed || synchronizing) {
+        if (!isSingleFile() || !sendAllowed || synchronizing) {
             toHide.add(R.id.action_send_file);
         } else {
             toShow.add(R.id.action_send_file);
         }
 
         // FAVORITES
-        if (!isFile() || synchronizing || allFavorites()) {
+        if (!allFiles() || synchronizing || allFavorites()) {
             toHide.add(R.id.action_favorite_file);
         } else {
             toShow.add(R.id.action_favorite_file);
         }
 
         // UNFAVORITES
-        if (!isFile() || synchronizing || allUnfavorites()) {
+        if (!allFiles() || synchronizing || allUnfavorites()) {
             toHide.add(R.id.action_unfavorite_file);
         } else {
             toShow.add(R.id.action_unfavorite_file);
@@ -249,10 +249,14 @@ public class FileMenuFilter {
         return mFiles.size() == SINGLE_SELECT_ITEMS;
     }
 
-    private boolean isFile() {
+    private boolean isSingleFile() {
         return isSingleSelect() && !mFiles.get(0).isFolder();
     }
 
+    private boolean allFiles() {
+        return mFiles != null && !containsFolder();
+    }
+
     private boolean containsFolder() {
         for(OCFile file: mFiles) {
             if(file.isFolder()) {