浏览代码

Hide select and deselect all on preview and details fragments, fix #1574

This change makes select/deselect menu items invisible on fragments where they should be invisible. To do this, first was needed to "split" two different "select all" actions into different ones, so they are not overlapped. For that, one of them was changed from "action_select_all" to "action_select_all_action_menu". Second, in method filter() that decides which menu items are visible, "inSingleFileFragment" bool is pushed. This is how we decide are we under some listing, or showing single file (either details or any preview fragment).
Branko Kokanovic 7 年之前
父节点
当前提交
49223db14e

+ 7 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java

@@ -296,6 +296,13 @@ public class PreviewImageFragment extends FileFragment {
             item.setEnabled(false);
         }
 
+        // additional restriction for this fragment
+        item = menu.findItem(R.id.action_select_all);
+        if (item != null) {
+            item.setVisible(false);
+            item.setEnabled(false);
+        }
+
         // additional restriction for this fragment
         item = menu.findItem(R.id.action_move);
         if (item != null) {

+ 7 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java

@@ -388,6 +388,13 @@ public class PreviewMediaFragment extends FileFragment implements
             item.setEnabled(false);
         }
 
+        // additional restriction for this fragment
+        item = menu.findItem(R.id.action_select_all);
+        if (item != null) {
+            item.setVisible(false);
+            item.setEnabled(false);
+        }
+
         // additional restriction for this fragment
         item = menu.findItem(R.id.action_move);
         if (item != null) {

+ 7 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -297,6 +297,13 @@ public class PreviewTextFragment extends FileFragment {
             item.setEnabled(false);
         }
 
+        // additional restriction for this fragment
+        item = menu.findItem(R.id.action_select_all);
+        if (item != null) {
+            item.setVisible(false);
+            item.setEnabled(false);
+        }
+
         // additional restriction for this fragment
         item = menu.findItem(R.id.action_move);
         if (item != null) {