private boolean mNeedsUpdateThumbnail;
+ private boolean mIsDownloading;
+
/**
* Create new {@link OCFile} with given path.
mPermissions = source.readString();
mRemoteId = source.readString();
mNeedsUpdateThumbnail = source.readInt() == 0;
+ mIsDownloading = source.readInt() == 0;
}
dest.writeString(mPermissions);
dest.writeString(mRemoteId);
dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
+ dest.writeInt(mIsDownloading ? 1 : 0);
}
/**
mPermissions = null;
mRemoteId = null;
mNeedsUpdateThumbnail = false;
+ mIsDownloading = false;
}
/**
this.mRemoteId = remoteId;
}
- public boolean isSynchronizing() {
- // TODO real implementation
- return false;
+ public boolean isDownloading() {
+ return mIsDownloading;
}
- public boolean isDownloading() {
+ public void setDownloading(boolean isDownloading) {
+ this.mIsDownloading = isDownloading;
+ }
+
++ public boolean isSynchronizing() {
+ // TODO real implementation
+ return false;
+ }
-
}
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) {
* @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);
}
}
}
+ */
/**
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());
}