Add 'Share with users/groups' to long press menu
authormasensio <masensio@solidgear.es>
Mon, 5 Oct 2015 07:43:30 +0000 (09:43 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 30 Oct 2015 14:04:34 +0000 (15:04 +0100)
res/menu/file_actions_menu.xml
res/values/strings.xml
src/com/owncloud/android/files/FileMenuFilter.java

index 63fadbb..83780bc 100644 (file)
         android:icon="@android:drawable/ic_menu_share"
         android:orderInCategory="1" />
     <item
         android:icon="@android:drawable/ic_menu_share"
         android:orderInCategory="1" />
     <item
+        android:id="@+id/action_share_with_users"
+        android:title="@string/action_share_with_users"
+        android:orderInCategory="1" />
+    <item
+        android:id="@+id/action_unshare_with_users"
+        android:title="@string/action_unshare_with_users"
+        android:orderInCategory="1" />
+    <item
         android:id="@+id/action_open_file_with"
         android:title="@string/actionbar_open_with"
         android:icon="@android:drawable/ic_menu_set_as"
         android:id="@+id/action_open_file_with"
         android:title="@string/actionbar_open_with"
         android:icon="@android:drawable/ic_menu_set_as"
index 305a540..ef97701 100644 (file)
@@ -87,6 +87,8 @@
     <string name="list_layout">List Layout</string>
     <string name="action_share_file">Share link</string>
     <string name="action_unshare_file">Unshare link</string>
     <string name="list_layout">List Layout</string>
     <string name="action_share_file">Share link</string>
     <string name="action_unshare_file">Unshare link</string>
+    <string name="action_share_with_users">Share with users</string>
+    <string name="action_unshare_with_users">Unshare with users</string>
     <string name="common_yes">Yes</string>
     <string name="common_no">No</string>
     <string name="common_ok">OK</string>
     <string name="common_yes">Yes</string>
     <string name="common_no">No</string>
     <string name="common_ok">OK</string>
index 738ca7e..f45d69f 100644 (file)
@@ -179,7 +179,7 @@ public class FileMenuFilter {
             toShow.add(R.id.action_sync_file);
         }
 
             toShow.add(R.id.action_sync_file);
         }
 
-        // SHARE FILE 
+        // SHARE FILE
         // TODO add check on SHARE available on server side?
         boolean shareAllowed = (mContext != null  &&
                 mContext.getString(R.string.share_feature).equalsIgnoreCase("on"));
         // TODO add check on SHARE available on server side?
         boolean shareAllowed = (mContext != null  &&
                 mContext.getString(R.string.share_feature).equalsIgnoreCase("on"));
@@ -189,7 +189,7 @@ public class FileMenuFilter {
             toShow.add(R.id.action_share_file);
         }
 
             toShow.add(R.id.action_share_file);
         }
 
-        // UNSHARE FILE  
+        // UNSHARE FILE
         // TODO add check on SHARE available on server side?
         if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
             toHide.add(R.id.action_unshare_file);
         // TODO add check on SHARE available on server side?
         if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
             toHide.add(R.id.action_unshare_file);
@@ -197,6 +197,21 @@ public class FileMenuFilter {
             toShow.add(R.id.action_unshare_file);
         }
 
             toShow.add(R.id.action_unshare_file);
         }
 
+        // SHARE FILE, with Users
+        if (!shareAllowed || mFile == null) {
+            toHide.add(R.id.action_share_with_users);
+        } else {
+            toShow.add(R.id.action_share_with_users);
+        }
+
+        // UNSHARE FILE, with Users
+        // TODO add check on SHARE available on server side?
+        if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
+            toHide.add(R.id.action_unshare_with_users);
+        } else {
+            toShow.add(R.id.action_unshare_with_users);
+        }
+
         // SEE DETAILS
         if (mFile == null || mFile.isFolder()) {
             toHide.add(R.id.action_see_details);
         // SEE DETAILS
         if (mFile == null || mFile.isFolder()) {
             toHide.add(R.id.action_see_details);