diff --git a/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt index f2d21614b5..f7e4c6b439 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/sync/SyncWorker.kt @@ -32,6 +32,8 @@ class SyncWorker( const val FILE_PATHS = "FILE_PATHS" const val TOP_PARENT_PATH = "TOP_PARENT_PATH" + + const val SYNC_WORKER_COMPLETION_BROADCAST = "SYNC_WORKER_COMPLETION_BROADCAST" const val FILE_DOWNLOAD_COMPLETION_BROADCAST = "FILE_DOWNLOAD_COMPLETION_BROADCAST" const val FILE_PATH = "FILE_PATH" @@ -94,13 +96,13 @@ class SyncWorker( } } - // TODO add cancel only one file download withContext(Dispatchers.Main) { notificationManager.showCompletionMessage(result) } if (result) { downloadingFilePaths.remove(topParentPath) + sendSyncWorkerCompletionBroadcast() Log_OC.d(TAG, "SyncWorker completed") Result.success() } else { @@ -117,4 +119,9 @@ class SyncWorker( LocalBroadcastManager.getInstance(context).sendBroadcast(intent) } + + private fun sendSyncWorkerCompletionBroadcast() { + val intent = Intent(SYNC_WORKER_COMPLETION_BROADCAST) + LocalBroadcastManager.getInstance(context).sendBroadcast(intent) + } } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index 11380fec4e..e9f56e88a7 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -200,12 +200,28 @@ public class OCFileListAdapter extends RecyclerView.Adapter