From e50bc09321426513ad9a12267de066b131cb1017 Mon Sep 17 00:00:00 2001 From: masensio Date: Mon, 5 Oct 2015 15:17:39 +0200 Subject: [PATCH] Add new attribute to OCFile to know if this file is shared with users/groups --- src/com/owncloud/android/datamodel/OCFile.java | 12 ++++++++++++ src/com/owncloud/android/files/FileMenuFilter.java | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/com/owncloud/android/datamodel/OCFile.java b/src/com/owncloud/android/datamodel/OCFile.java index fcde054a..4b689860 100644 --- a/src/com/owncloud/android/datamodel/OCFile.java +++ b/src/com/owncloud/android/datamodel/OCFile.java @@ -75,6 +75,7 @@ public class OCFile implements Parcelable, Comparable { private boolean mIsDownloading; private String mEtagInConflict; // Save file etag in the server, when there is a conflict. No conflict = null + private boolean mShareWithUser; /** @@ -120,6 +121,7 @@ public class OCFile implements Parcelable, Comparable { mNeedsUpdateThumbnail = source.readInt() == 1; mIsDownloading = source.readInt() == 1; mEtagInConflict = source.readString(); + mShareWithUser = source.readInt() == 1; } @@ -146,6 +148,7 @@ public class OCFile implements Parcelable, Comparable { dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0); dest.writeInt(mIsDownloading ? 1 : 0); dest.writeString(mEtagInConflict); + dest.writeInt(mShareWithUser ? 1 : 0); } /** @@ -344,6 +347,7 @@ public class OCFile implements Parcelable, Comparable { mNeedsUpdateThumbnail = false; mIsDownloading = false; mEtagInConflict = null; + mShareWithUser = false; } /** @@ -591,4 +595,12 @@ public class OCFile implements Parcelable, Comparable { public void setEtagInConflict(String etagInConflict) { mEtagInConflict = etagInConflict; } + + public boolean isShareWithUser() { + return mShareWithUser; + } + + public void setShareWithUser(boolean shareWithUser) { + this.mShareWithUser = shareWithUser; + } } diff --git a/src/com/owncloud/android/files/FileMenuFilter.java b/src/com/owncloud/android/files/FileMenuFilter.java index 6d53c997..01ca41fd 100644 --- a/src/com/owncloud/android/files/FileMenuFilter.java +++ b/src/com/owncloud/android/files/FileMenuFilter.java @@ -209,7 +209,7 @@ public class FileMenuFilter { } // UNSHARE FILE, with Users - if ( !shareAllowed || !shareWithUsersEnable || (mFile == null || !mFile.isShareByLink())) { + if ( !shareAllowed || !shareWithUsersEnable || (mFile == null || !mFile.isShareWithUser())) { toHide.add(R.id.action_unshare_with_users); } else { toShow.add(R.id.action_unshare_with_users); -- 2.11.0