|
@@ -21,7 +21,6 @@
|
|
|
|
|
|
package com.owncloud.android.files;
|
|
|
|
|
|
-import android.accounts.Account;
|
|
|
import android.content.ContentResolver;
|
|
|
import android.content.Context;
|
|
|
import android.os.Build;
|
|
@@ -63,7 +62,6 @@ public class FileMenuFilter {
|
|
|
private int numberOfAllFiles;
|
|
|
private Collection<OCFile> files;
|
|
|
private ComponentsGetter componentsGetter;
|
|
|
- private Account account;
|
|
|
private Context context;
|
|
|
private boolean overflowMenu;
|
|
|
private DeviceInfo deviceInfo;
|
|
@@ -74,14 +72,14 @@ public class FileMenuFilter {
|
|
|
*
|
|
|
* @param numberOfAllFiles Number of all displayed files
|
|
|
* @param files Collection of {@link OCFile} file targets of the action to filter in the {@link Menu}.
|
|
|
- * @param account ownCloud {@link Account} holding targetFile.
|
|
|
* @param componentsGetter Accessor to app components, needed to access synchronization services
|
|
|
* @param context Android {@link Context}, needed to access build setup resources.
|
|
|
* @param overflowMenu true if the overflow menu items are being filtered
|
|
|
+ * @param deviceInfo Device information provider
|
|
|
+ * @param user currently active user
|
|
|
*/
|
|
|
public FileMenuFilter(int numberOfAllFiles,
|
|
|
Collection<OCFile> files,
|
|
|
- Account account,
|
|
|
ComponentsGetter componentsGetter,
|
|
|
Context context,
|
|
|
boolean overflowMenu,
|
|
@@ -90,7 +88,6 @@ public class FileMenuFilter {
|
|
|
) {
|
|
|
this.numberOfAllFiles = numberOfAllFiles;
|
|
|
this.files = files;
|
|
|
- this.account = account;
|
|
|
this.componentsGetter = componentsGetter;
|
|
|
this.context = context;
|
|
|
this.overflowMenu = overflowMenu;
|
|
@@ -102,20 +99,19 @@ public class FileMenuFilter {
|
|
|
* Constructor
|
|
|
*
|
|
|
* @param file {@link OCFile} target of the action to filter in the {@link Menu}.
|
|
|
- * @param account ownCloud {@link Account} holding targetFile.
|
|
|
* @param componentsGetter Accessor to app components, needed to access synchronization services
|
|
|
* @param context Android {@link Context}, needed to access build setup resources.
|
|
|
* @param overflowMenu true if the overflow menu items are being filtered
|
|
|
+ * @param user currently active user
|
|
|
*/
|
|
|
public FileMenuFilter(OCFile file,
|
|
|
- Account account,
|
|
|
ComponentsGetter componentsGetter,
|
|
|
Context context,
|
|
|
boolean overflowMenu,
|
|
|
DeviceInfo deviceInfo,
|
|
|
User user
|
|
|
) {
|
|
|
- this(1, Collections.singletonList(file), account, componentsGetter, context, overflowMenu, deviceInfo, user);
|
|
|
+ this(1, Collections.singletonList(file), componentsGetter, context, overflowMenu, deviceInfo, user);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -193,7 +189,7 @@ public class FileMenuFilter {
|
|
|
boolean inSingleFileFragment,
|
|
|
boolean isMediaSupported) {
|
|
|
boolean synchronizing = anyFileSynchronizing();
|
|
|
- OCCapability capability = componentsGetter.getStorageManager().getCapability(account.name);
|
|
|
+ OCCapability capability = componentsGetter.getStorageManager().getCapability(user.getAccountName());
|
|
|
boolean endToEndEncryptionEnabled = capability.getEndToEndEncryption().isTrue();
|
|
|
|
|
|
filterEdit(toShow, toHide, capability);
|
|
@@ -433,7 +429,7 @@ public class FileMenuFilter {
|
|
|
|
|
|
private boolean anyFileSynchronizing() {
|
|
|
boolean synchronizing = false;
|
|
|
- if (componentsGetter != null && !files.isEmpty() && account != null) {
|
|
|
+ if (componentsGetter != null && !files.isEmpty() && user != null) {
|
|
|
OperationsServiceBinder opsBinder = componentsGetter.getOperationsServiceBinder();
|
|
|
FileUploaderBinder uploaderBinder = componentsGetter.getFileUploaderBinder();
|
|
|
FileDownloaderBinder downloaderBinder = componentsGetter.getFileDownloaderBinder();
|
|
@@ -448,7 +444,7 @@ public class FileMenuFilter {
|
|
|
boolean synchronizing = false;
|
|
|
if (opsBinder != null) {
|
|
|
for (Iterator<OCFile> iterator = files.iterator(); !synchronizing && iterator.hasNext(); ) {
|
|
|
- synchronizing = opsBinder.isSynchronizing(account, iterator.next());
|
|
|
+ synchronizing = opsBinder.isSynchronizing(user, iterator.next());
|
|
|
}
|
|
|
}
|
|
|
return synchronizing;
|
|
@@ -458,7 +454,7 @@ public class FileMenuFilter {
|
|
|
boolean downloading = false;
|
|
|
if (downloaderBinder != null) {
|
|
|
for (Iterator<OCFile> iterator = files.iterator(); !downloading && iterator.hasNext(); ) {
|
|
|
- downloading = downloaderBinder.isDownloading(account, iterator.next());
|
|
|
+ downloading = downloaderBinder.isDownloading(user, iterator.next());
|
|
|
}
|
|
|
}
|
|
|
return downloading;
|
|
@@ -468,7 +464,7 @@ public class FileMenuFilter {
|
|
|
boolean uploading = false;
|
|
|
if (uploaderBinder != null) {
|
|
|
for (Iterator<OCFile> iterator = files.iterator(); !uploading && iterator.hasNext(); ) {
|
|
|
- uploading = uploaderBinder.isUploading(account, iterator.next());
|
|
|
+ uploading = uploaderBinder.isUploading(user, iterator.next());
|
|
|
}
|
|
|
}
|
|
|
return uploading;
|