mirror of
https://github.com/nextcloud/android.git
synced 2024-12-20 16:02:01 +03:00
remove unnecesary broadcast event
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
16c44cdf82
commit
455a86fd7f
2 changed files with 2 additions and 18 deletions
|
@ -19,6 +19,7 @@ import com.owncloud.android.lib.common.OwnCloudClient
|
||||||
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
|
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC
|
import com.owncloud.android.lib.common.utils.Log_OC
|
||||||
import com.owncloud.android.operations.DownloadFileOperation
|
import com.owncloud.android.operations.DownloadFileOperation
|
||||||
|
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||||
import com.owncloud.android.ui.helpers.FileOperationsHelper
|
import com.owncloud.android.ui.helpers.FileOperationsHelper
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
@ -34,7 +35,6 @@ class SyncWorker(
|
||||||
|
|
||||||
const val FOLDER_ID = "FOLDER_ID"
|
const val FOLDER_ID = "FOLDER_ID"
|
||||||
|
|
||||||
const val SYNC_WORKER_COMPLETION_BROADCAST = "SYNC_WORKER_COMPLETION_BROADCAST"
|
|
||||||
const val FILE_DOWNLOAD_COMPLETION_BROADCAST = "FILE_DOWNLOAD_COMPLETION_BROADCAST"
|
const val FILE_DOWNLOAD_COMPLETION_BROADCAST = "FILE_DOWNLOAD_COMPLETION_BROADCAST"
|
||||||
const val FILE_PATH = "FILE_PATH"
|
const val FILE_PATH = "FILE_PATH"
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class SyncWorker(
|
||||||
* It is used to add a green tick icon next to the files after the download process is finished.
|
* It is used to add a green tick icon next to the files after the download process is finished.
|
||||||
*/
|
*/
|
||||||
private fun sendSyncWorkerCompletionBroadcast() {
|
private fun sendSyncWorkerCompletionBroadcast() {
|
||||||
val intent = Intent(SYNC_WORKER_COMPLETION_BROADCAST)
|
val intent = Intent(FileDisplayActivity.REFRESH_FOLDER_EVENT_RECEIVER)
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,28 +200,12 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||||
|
|
||||||
setHasStableIds(true);
|
setHasStableIds(true);
|
||||||
|
|
||||||
registerSyncWorkerCompletionReceiver();
|
|
||||||
registerFileDownloadCompletionReceiver();
|
registerFileDownloadCompletionReceiver();
|
||||||
|
|
||||||
// initialise thumbnails cache on background thread
|
// initialise thumbnails cache on background thread
|
||||||
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerSyncWorkerCompletionReceiver() {
|
|
||||||
LocalBroadcastManager
|
|
||||||
.getInstance(activity)
|
|
||||||
.registerReceiver(syncWorkerCompletionReceiver, new IntentFilter(SyncWorker.SYNC_WORKER_COMPLETION_BROADCAST));
|
|
||||||
}
|
|
||||||
|
|
||||||
private final BroadcastReceiver syncWorkerCompletionReceiver = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (activity instanceof FileDisplayActivity fda) {
|
|
||||||
fda.refreshList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void registerFileDownloadCompletionReceiver() {
|
private void registerFileDownloadCompletionReceiver() {
|
||||||
LocalBroadcastManager
|
LocalBroadcastManager
|
||||||
.getInstance(activity)
|
.getInstance(activity)
|
||||||
|
|
Loading…
Reference in a new issue