X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/46d045fd62a7637baa84561ccf2ccb726a02f607..05c236ba628b92972ccf7cc0f3c765d04f577b28:/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 eb870e1d..59982771 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -169,6 +169,12 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis newDownload.addDatatransferProgressListener(this); newDownload.addDatatransferProgressListener((FileDownloaderBinder) mBinder); requestedDownloads.add(downloadKey); + + // Store file on db with state 'downloading' + FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver()); + file.setDownloading(true); + storageManager.saveFile(file); + sendBroadcastNewDownload(newDownload); } catch (IllegalArgumentException e) { @@ -415,6 +421,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis file.setStoragePath(mCurrentDownload.getSavePath()); file.setFileLength((new File(mCurrentDownload.getSavePath()).length())); file.setRemoteId(mCurrentDownload.getFile().getRemoteId()); + file.setDownloading(false); mStorageManager.saveFile(file); mStorageManager.triggerMediaScan(file.getStoragePath()); }