Enable/disable share option in the menu: long press and details menu, using setup option

This commit is contained in:
masensio 2015-05-04 14:54:49 +02:00
parent a41c0b39f2
commit 05df07a362

View file

@ -216,7 +216,9 @@ public class FileMenuFilter {
// SHARE FILE // SHARE FILE
// TODO add check on SHARE available on server side? // TODO add check on SHARE available on server side?
if (mFile == null) { boolean shareAllowed = (mContext != null &&
mContext.getString(R.string.share_link).equalsIgnoreCase("on"));
if (!shareAllowed || mFile == null) {
toHide.add(R.id.action_share_file); toHide.add(R.id.action_share_file);
} else { } else {
toShow.add(R.id.action_share_file); toShow.add(R.id.action_share_file);
@ -224,13 +226,12 @@ public class FileMenuFilter {
// UNSHARE FILE // UNSHARE FILE
// TODO add check on SHARE available on server side? // TODO add check on SHARE available on server side?
if (mFile == null || !mFile.isShareByLink()) { if ( !shareAllowed || (mFile == null || !mFile.isShareByLink())) {
toHide.add(R.id.action_unshare_file); toHide.add(R.id.action_unshare_file);
} else { } else {
toShow.add(R.id.action_unshare_file); toShow.add(R.id.action_unshare_file);
} }
// SEE DETAILS // SEE DETAILS
if (mFile == null || mFile.isFolder()) { if (mFile == null || mFile.isFolder()) {
toHide.add(R.id.action_see_details); toHide.add(R.id.action_see_details);