From: jabarros Date: Tue, 20 Jan 2015 12:00:37 +0000 (+0100) Subject: Update unsuccessful downloaded file X-Git-Tag: oc-android-1.7.0_signed~23^2~8^2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/dea36157e7a2d7c99273d121046218220aa9bcd4 Update unsuccessful downloaded file --- diff --git a/src/com/owncloud/android/files/services/FileDownloader.java b/src/com/owncloud/android/files/services/FileDownloader.java index 741e30a8..61483af8 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -383,6 +383,8 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis downloadResult = mCurrentDownload.execute(mDownloadClient); if (downloadResult.isSuccess()) { saveDownloadedFile(); + } else { + updateUnsuccessfulDownloadedFile(); } } catch (AccountsException e) { @@ -428,6 +430,15 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis mStorageManager.triggerMediaScan(file.getStoragePath()); } + /** + * Update the OC File after a unsuccessful download + */ + private void updateUnsuccessfulDownloadedFile() { + OCFile file = mStorageManager.getFileById(mCurrentDownload.getFile().getFileId()); + file.setDownloading(false); + mStorageManager.saveFile(file); + } + /** * Creates a status notification to show the download progress