X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/20583912301fc6b0ec069ebfeeba50d52d435183..e93016d7e01ba4917fbf89193ac37373350dbb52:/src/com/owncloud/android/files/services/FileDownloader.java diff --git a/src/com/owncloud/android/files/services/FileDownloader.java b/src/com/owncloud/android/files/services/FileDownloader.java index 4ae3325d..efe271d8 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -235,7 +235,8 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis ); Log_OC.v( "NOW " + TAG + ", thread " + Thread.currentThread().getName(), "Removing download of " + file.getRemotePath());*/ - Pair removeResult = mPendingDownloads.remove(account, file.getRemotePath()); + Pair removeResult = + mPendingDownloads.remove(account, file.getRemotePath()); DownloadFileOperation download = removeResult.first; if (download != null) { /*Log_OC.v( "NOW " + TAG + ", thread " + Thread.currentThread().getName(), @@ -352,6 +353,17 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis boundListener.onTransferProgress(progressRate, totalTransferredSoFar, totalToTransfer, fileName); } } + + /** + * Review downloads and cancel it if its account doesn't exist + */ + public void reviewDownloads() { + if (mCurrentDownload != null && + !AccountUtils.exists(mCurrentDownload.getAccount(), getApplicationContext())) { + mCurrentDownload.cancel(); + } + // The rest of downloads are cancelled when they try to start + } }