From 3a527a8fe4eaabb59237fc7680fb2f3bf65cc0b0 Mon Sep 17 00:00:00 2001 From: masensio Date: Mon, 5 Oct 2015 09:43:30 +0200 Subject: [PATCH] Add 'Share with users/groups' to long press menu --- res/menu/file_actions_menu.xml | 8 ++++++++ res/values/strings.xml | 2 ++ src/com/owncloud/android/files/FileMenuFilter.java | 19 +++++++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/res/menu/file_actions_menu.xml b/res/menu/file_actions_menu.xml index 63fadbbc..83780bcc 100644 --- a/res/menu/file_actions_menu.xml +++ b/res/menu/file_actions_menu.xml @@ -29,6 +29,14 @@ android:icon="@android:drawable/ic_menu_share" android:orderInCategory="1" /> + + List Layout Share link Unshare link + Share with users + Unshare with users Yes No OK diff --git a/src/com/owncloud/android/files/FileMenuFilter.java b/src/com/owncloud/android/files/FileMenuFilter.java index 738ca7ef..f45d69f6 100644 --- a/src/com/owncloud/android/files/FileMenuFilter.java +++ b/src/com/owncloud/android/files/FileMenuFilter.java @@ -179,7 +179,7 @@ public class FileMenuFilter { 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")); @@ -189,7 +189,7 @@ public class FileMenuFilter { 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); @@ -197,6 +197,21 @@ public class FileMenuFilter { 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); -- 2.11.0