From: jabarros Date: Thu, 8 Jan 2015 13:26:38 +0000 (+0100) Subject: Merge branch 'download_folder' into download_folder__fixing_recursive_cancellation X-Git-Tag: oc-android-1.7.0_signed~23^2~15^2~3 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/46d045fd62a7637baa84561ccf2ccb726a02f607?ds=inline;hp=-c Merge branch 'download_folder' into download_folder__fixing_recursive_cancellation --- 46d045fd62a7637baa84561ccf2ccb726a02f607 diff --combined src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 8bdc55e0,088c5788..6b62547e --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@@ -165,11 -165,6 +165,11 @@@ public class SynchronizeFolderOperatio sendBroadcastForNotifyingUIUpdate(result.isSuccess()); } } + + if (mCancellationRequested.get()) { + throw new OperationCancelledException(); + } + } catch (OperationCancelledException e) { result = new RemoteOperationResult(e); @@@ -177,14 -172,6 +177,14 @@@ for (SyncOperation synchOp: mFoldersToWalkDown) { ((SynchronizeFolderOperation) synchOp).cancel(); } + + /// cancellation of download needs to be done separately in any case; a SynchronizeFolderOperation + // may finish much sooner than the real download of the files in the folder + Intent intent = new Intent(mContext, FileDownloader.class); + intent.setAction(FileDownloader.ACTION_CANCEL_FILE_DOWNLOAD); + intent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); + intent.putExtra(FileDownloader.EXTRA_FILE, mLocalFolder); + mContext.startService(intent); } return result; @@@ -555,4 -542,12 +555,12 @@@ public void cancel() { mCancellationRequested.set(true); } + + public String getFolderPath() { + String path = mLocalFolder.getStoragePath(); + if (path != null && path.length() > 0) { + return path; + } + return FileStorageUtils.getDefaultSavePathFor(mAccount.name, mLocalFolder); + } }