remove unnecesary broadcast event

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-12-19 11:34:31 +01:00
parent 16c44cdf82
commit 455a86fd7f
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF
2 changed files with 2 additions and 18 deletions

View file

@ -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)
} }
} }

View file

@ -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)