Cancel the transfers of an account when the account is deleted: Cancel current upload

This commit is contained in:
masensio 2015-02-05 09:40:09 +01:00
parent beb7d352f9
commit 3ff42b6220

View file

@ -76,7 +76,7 @@ public class UploadFileOperation extends RemoteOperation {
private String mOriginalStoragePath = null; private String mOriginalStoragePath = null;
PutMethod mPutMethod = null; PutMethod mPutMethod = null;
private Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>(); private Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>();
private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false); private AtomicBoolean mCancellationRequested = new AtomicBoolean(false);
private Context mContext; private Context mContext;
private UploadRemoteFileOperation mUploadOperation; private UploadRemoteFileOperation mUploadOperation;
@ -443,7 +443,9 @@ public class UploadFileOperation extends RemoteOperation {
} }
public void cancel() { public void cancel() {
if (mUploadOperation != null) mCancellationRequested = new AtomicBoolean(true);
if (mUploadOperation != null) {
mUploadOperation.cancel(); mUploadOperation.cancel();
}
} }
} }