X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/eb6ec5dcf3e70720009073169cc363cea825ce11..d8ac7b2241bc99df58b5f4be4c3c4d83fc9efaf6:/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..741e30a8 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) { @@ -253,6 +259,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis * @param account Owncloud account where the remote file is stored. * @param file A file that could be in the queue of downloads. */ + /* public boolean isDownloading(Account account, OCFile file) { if (account == null || file == null) return false; String targetKey = buildRemoteName(account, file); @@ -270,6 +277,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis } } } + */ /** @@ -415,6 +423,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()); }