mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 10:18:59 +03:00
Added cancelation for each synchronizeFolderOperation when canceling download folder
This commit is contained in:
parent
0c8d508a61
commit
f22693cd4e
1 changed files with 5 additions and 2 deletions
|
@ -27,6 +27,7 @@ import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.files.services.FileDownloader;
|
import com.owncloud.android.files.services.FileDownloader;
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||||
import com.owncloud.android.lib.common.operations.OperationCancelledException;
|
import com.owncloud.android.lib.common.operations.OperationCancelledException;
|
||||||
|
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||||
|
@ -145,6 +146,10 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
||||||
|
|
||||||
synchronized(mCancellationRequested) {
|
synchronized(mCancellationRequested) {
|
||||||
if (mCancellationRequested.get()) {
|
if (mCancellationRequested.get()) {
|
||||||
|
// Cancel each operation in mFoldersToWalkDown
|
||||||
|
for (SyncOperation synchOp: mFoldersToWalkDown) {
|
||||||
|
((SynchronizeFolderOperation) synchOp).cancel();
|
||||||
|
}
|
||||||
return new RemoteOperationResult(new OperationCancelledException());
|
return new RemoteOperationResult(new OperationCancelledException());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,8 +507,6 @@ public class SynchronizeFolderOperation extends SyncOperation {
|
||||||
* Cancel operation
|
* Cancel operation
|
||||||
*/
|
*/
|
||||||
public void cancel(){
|
public void cancel(){
|
||||||
// WIP Cancel the sync operation
|
|
||||||
mCancellationRequested.set(true);
|
mCancellationRequested.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue