|
@@ -47,6 +47,7 @@ public class FileMenuFilter {
|
|
|
private ComponentsGetter mComponentsGetter;
|
|
|
private Account mAccount;
|
|
|
private Context mContext;
|
|
|
+ private boolean mMultiSelect;
|
|
|
|
|
|
/**
|
|
|
* Constructor
|
|
@@ -56,15 +57,30 @@ public class FileMenuFilter {
|
|
|
* @param cg Accessor to app components, needed to access the
|
|
|
* {@link FileUploader} and {@link FileDownloader} services
|
|
|
* @param context Android {@link Context}, needed to access build setup resources.
|
|
|
+ * @param multiSelect Flag that indicates if a multiSelect mode is activated.
|
|
|
*/
|
|
|
public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg,
|
|
|
- Context context) {
|
|
|
+ Context context, boolean multiSelect) {
|
|
|
mFile = targetFile;
|
|
|
mAccount = account;
|
|
|
mComponentsGetter = cg;
|
|
|
mContext = context;
|
|
|
+ mMultiSelect = multiSelect;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Constructor
|
|
|
+ *
|
|
|
+ * @param targetFile {@link OCFile} target of the action to filter in the {@link Menu}.
|
|
|
+ * @param account ownCloud {@link Account} holding targetFile.
|
|
|
+ * @param cg Accessor to app components, needed to access the
|
|
|
+ * {@link FileUploader} and {@link FileDownloader} services
|
|
|
+ * @param context Android {@link Context}, needed to access build setup resources.
|
|
|
+ */
|
|
|
+ public FileMenuFilter(OCFile targetFile, Account account, ComponentsGetter cg,
|
|
|
+ Context context) {
|
|
|
+ this(targetFile, account, cg, context, false);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Filters out the file actions available in the passed {@link Menu} taken into account
|
|
@@ -132,7 +148,7 @@ public class FileMenuFilter {
|
|
|
}
|
|
|
|
|
|
// RENAME
|
|
|
- if (mFile == null || synchronizing) {
|
|
|
+ if (mFile == null || synchronizing || mMultiSelect) {
|
|
|
toHide.add(R.id.action_rename_file);
|
|
|
|
|
|
} else {
|
|
@@ -157,7 +173,7 @@ public class FileMenuFilter {
|
|
|
}
|
|
|
|
|
|
// OPEN WITH (different to preview!)
|
|
|
- if (mFile == null || mFile.isFolder() || !mFile.isDown() || synchronizing) {
|
|
|
+ if (mFile == null || mFile.isFolder() || !mFile.isDown() || synchronizing || mMultiSelect) {
|
|
|
toHide.add(R.id.action_open_file_with);
|
|
|
|
|
|
} else {
|
|
@@ -191,14 +207,14 @@ public class FileMenuFilter {
|
|
|
(capability.getFilesSharingApiEnabled().isTrue() ||
|
|
|
capability.getFilesSharingApiEnabled().isUnknown()
|
|
|
);
|
|
|
- if ((!shareViaLinkAllowed && !shareWithUsersAllowed) || mFile == null || !shareApiEnabled) {
|
|
|
+ if ((!shareViaLinkAllowed && !shareWithUsersAllowed) || mFile == null || !shareApiEnabled || mMultiSelect) {
|
|
|
toHide.add(R.id.action_share_file);
|
|
|
} else {
|
|
|
toShow.add(R.id.action_share_file);
|
|
|
}
|
|
|
|
|
|
// SEE DETAILS
|
|
|
- if (mFile == null || mFile.isFolder()) {
|
|
|
+ if (mFile == null || mFile.isFolder() || mMultiSelect) {
|
|
|
toHide.add(R.id.action_see_details);
|
|
|
} else {
|
|
|
toShow.add(R.id.action_see_details);
|
|
@@ -207,21 +223,21 @@ public class FileMenuFilter {
|
|
|
// SEND
|
|
|
boolean sendAllowed = (mContext != null &&
|
|
|
mContext.getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on"));
|
|
|
- if (mFile == null || !sendAllowed || mFile.isFolder() || synchronizing) {
|
|
|
+ if (mFile == null || !sendAllowed || mFile.isFolder() || synchronizing || mMultiSelect) {
|
|
|
toHide.add(R.id.action_send_file);
|
|
|
} else {
|
|
|
toShow.add(R.id.action_send_file);
|
|
|
}
|
|
|
|
|
|
// FAVORITES
|
|
|
- if (mFile == null || synchronizing || mFile.isFolder() || mFile.isFavorite()) {
|
|
|
+ if (mFile == null || synchronizing || mFile.isFolder() || mFile.isFavorite() || mMultiSelect) {
|
|
|
toHide.add(R.id.action_favorite_file);
|
|
|
} else {
|
|
|
toShow.add(R.id.action_favorite_file);
|
|
|
}
|
|
|
|
|
|
// UNFAVORITES
|
|
|
- if (mFile == null || synchronizing || mFile.isFolder() || !mFile.isFavorite()) {
|
|
|
+ if (mFile == null || synchronizing || mFile.isFolder() || !mFile.isFavorite() || mMultiSelect) {
|
|
|
toHide.add(R.id.action_unfavorite_file);
|
|
|
} else {
|
|
|
toShow.add(R.id.action_unfavorite_file);
|