update file via remote id

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-06-29 13:53:15 +02:00
parent b0a3fba221
commit d0e99aeb2d
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 14 additions and 2 deletions

View file

@ -141,6 +141,17 @@ public class FileDataStorageManager {
return file;
}
public @Nullable
OCFile getFileByRemoteId(String remoteId) {
Cursor c = getFileCursorForValue(ProviderTableMeta.FILE_REMOTE_ID, remoteId);
OCFile file = null;
if (c.moveToFirst()) {
file = createFileInstance(c);
}
c.close();
return file;
}
public boolean fileExists(long id) {
return fileExists(ProviderTableMeta._ID, String.valueOf(id));
}

View file

@ -1521,8 +1521,9 @@ public class FileDisplayActivity extends HookActivity
}
if (mWaitingToSend != null) {
mWaitingToSend = getStorageManager().getFileByPath(mWaitingToSend.getRemotePath());
if (mWaitingToSend.isDown() && downloadBehaviour != null) {
// update file after downloading
mWaitingToSend = getStorageManager().getFileByRemoteId(mWaitingToSend.getRemoteId());
if (mWaitingToSend != null && mWaitingToSend.isDown() && downloadBehaviour != null) {
switch (downloadBehaviour) {
case OCFileListFragment.DOWNLOAD_SEND:
String packageName = intent.getStringExtra(SendShareDialog.PACKAGE_NAME);