Эх сурвалжийг харах

OC-3016: Add option 'send_files_to_other_apps' with default value 'on'

masensio 11 жил өмнө
parent
commit
8db07c67b6

+ 4 - 0
res/values/setup.xml

@@ -21,6 +21,10 @@
     <string name="auth_method_oauth2">off</string>
     <string name="auth_method_saml_web_sso">off</string>
     
+    <!-- Flags to enable/disable some features -->
+    <string name = "send_files_to_other_apps">on</string>
+    
+    
     <!-- Colors -->
     <color name="login_background_color">#FFFFFF</color>
     <color name="login_logo_background_color">#FFFFFF</color>

+ 11 - 0
src/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -252,6 +252,17 @@ public class FileDetailFragment extends FileFragment implements
             item.setVisible(false);
             item.setEnabled(false);
         }
+        
+        // Send file
+        item = menu.findItem(R.id.action_send_file);
+        boolean sendEnabled = getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on");
+        if (item != null  && sendEnabled) {
+            item.setVisible(true);
+            item.setEnabled(true);
+        } else {
+            item.setVisible(false);
+            item.setEnabled(false);
+        }
     }
 
     

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

@@ -263,6 +263,12 @@ public class OCFileListFragment extends ExtendedListFragment implements EditName
             toHide.add(R.id.action_unshare_file);
         }
 
+        // Send file
+        boolean sendEnabled = getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on");
+        if (!sendEnabled) {
+            toHide.add(R.id.action_send_file);
+        }
+        
         for (int i : toHide) {
             item = menu.findItem(i);
             if (item != null) {

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

@@ -250,6 +250,12 @@ public class PreviewImageFragment extends FileFragment implements   OnRemoteOper
             toHide.add(R.id.action_unshare_file);
         }
 
+        // Send file
+        boolean sendEnabled = getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on");
+        if (!sendEnabled) {
+            toHide.add(R.id.action_send_file);
+        }
+        
         for (int i : toHide) {
             item = menu.findItem(i);
             if (item != null) {

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

@@ -295,6 +295,12 @@ public class PreviewMediaFragment extends FileFragment implements
             toHide.add(R.id.action_unshare_file);
         }
         
+        // Send file
+        boolean sendEnabled = getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on");
+        if (!sendEnabled) {
+            toHide.add(R.id.action_send_file);
+        }
+        
         for (int i : toHide) {
             item = menu.findItem(i);
             if (item != null) {