diff --git a/app/src/androidTest/java/com/nextcloud/client/files/downloader/DownloaderServiceTest.kt b/app/src/androidTest/java/com/nextcloud/client/files/downloader/DownloaderServiceTest.kt index 86029131b3dc..3e01188ca8b4 100644 --- a/app/src/androidTest/java/com/nextcloud/client/files/downloader/DownloaderServiceTest.kt +++ b/app/src/androidTest/java/com/nextcloud/client/files/downloader/DownloaderServiceTest.kt @@ -22,6 +22,7 @@ package com.nextcloud.client.files.downloader import androidx.test.core.app.ApplicationProvider.getApplicationContext import androidx.test.rule.ServiceTestRule import com.nextcloud.client.account.MockUser +import com.nextcloud.client.files.transfer.FileTransferService import io.mockk.MockKAnnotations import org.junit.Assert.assertTrue import org.junit.Before diff --git a/app/src/androidTest/java/com/nextcloud/client/files/downloader/RegistryTest.kt b/app/src/androidTest/java/com/nextcloud/client/files/downloader/RegistryTest.kt index 21f39a484f0d..b4018d7ad477 100644 --- a/app/src/androidTest/java/com/nextcloud/client/files/downloader/RegistryTest.kt +++ b/app/src/androidTest/java/com/nextcloud/client/files/downloader/RegistryTest.kt @@ -20,6 +20,11 @@ package com.nextcloud.client.files.downloader import com.nextcloud.client.account.User +import com.nextcloud.client.files.DownloadRequest +import com.nextcloud.client.files.Registry +import com.nextcloud.client.files.Request +import com.nextcloud.client.files.transfer.Transfer +import com.nextcloud.client.files.transfer.TransferState import com.owncloud.android.datamodel.OCFile import io.mockk.CapturingSlot import io.mockk.MockKAnnotations diff --git a/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerConnectionTest.kt b/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerConnectionTest.kt index d5bbe707058c..b33fa175f4b4 100644 --- a/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerConnectionTest.kt +++ b/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerConnectionTest.kt @@ -22,6 +22,12 @@ package com.nextcloud.client.files.downloader import android.content.ComponentName import android.content.Context import com.nextcloud.client.account.MockUser +import com.nextcloud.client.files.DownloadRequest +import com.nextcloud.client.files.transfer.FileTransferService +import com.nextcloud.client.files.transfer.Transfer +import com.nextcloud.client.files.transfer.TransferManager +import com.nextcloud.client.files.transfer.TransferManagerConnection +import com.nextcloud.client.files.transfer.TransferState import com.owncloud.android.datamodel.OCFile import io.mockk.MockKAnnotations import io.mockk.every diff --git a/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerTest.kt b/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerTest.kt index aa69648e8be3..ef5e692d8084 100644 --- a/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerTest.kt +++ b/app/src/androidTest/java/com/nextcloud/client/files/downloader/TransferManagerTest.kt @@ -23,6 +23,12 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.nextcloud.client.account.User import com.nextcloud.client.core.ManualAsyncRunner import com.nextcloud.client.core.OnProgressCallback +import com.nextcloud.client.files.DownloadRequest +import com.nextcloud.client.files.Request +import com.nextcloud.client.files.transfer.Transfer +import com.nextcloud.client.files.transfer.TransferManagerImpl +import com.nextcloud.client.files.transfer.TransferState +import com.nextcloud.client.files.upload.UploadTask import com.owncloud.android.datamodel.OCFile import com.owncloud.android.lib.common.OwnCloudClient import io.mockk.MockKAnnotations @@ -101,7 +107,7 @@ class TransferManagerTest { private fun createMockTask(): DownloadTask { val task = mockk() - every { task.download(any(), any(), any()) } answers { + every { task.download(any()) } answers { taskProgress.forEach { arg>(1).invoke(it) } diff --git a/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt b/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt index e031d92ccafe..5e48d0b9647d 100644 --- a/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt +++ b/app/src/androidTest/java/com/owncloud/android/files/FileMenuFilterIT.kt @@ -23,7 +23,7 @@ package com.owncloud.android.files import androidx.test.core.app.launchActivity import androidx.test.ext.junit.runners.AndroidJUnit4 import com.nextcloud.client.account.User -import com.nextcloud.client.files.downloader.FilesDownloadWorker +import com.nextcloud.client.files.downloader.FileDownloadWorker import com.nextcloud.test.TestActivity import com.nextcloud.utils.EditorUtils import com.owncloud.android.AbstractIT @@ -62,7 +62,7 @@ class FileMenuFilterIT : AbstractIT() { private lateinit var mockFileUploaderBinder: FileUploader.FileUploaderBinder @MockK - private lateinit var mockFileDownloaderBinder: FilesDownloadWorker.FileDownloaderBinder + private lateinit var mockFileDownloaderBinder: FileDownloadWorker.FileDownloaderBinder @MockK private lateinit var mockOperationsServiceBinder: OperationsService.OperationsServiceBinder diff --git a/app/src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityIT.java b/app/src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityIT.java index dbcda37ecc96..67ede342a2a2 100644 --- a/app/src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityIT.java +++ b/app/src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityIT.java @@ -22,7 +22,6 @@ */ import android.content.Intent; -import android.view.View; import com.owncloud.android.AbstractIT; import com.owncloud.android.R; diff --git a/app/src/debug/java/com/nextcloud/test/TestActivity.kt b/app/src/debug/java/com/nextcloud/test/TestActivity.kt index 90c4ecc19a82..ec98df551af0 100644 --- a/app/src/debug/java/com/nextcloud/test/TestActivity.kt +++ b/app/src/debug/java/com/nextcloud/test/TestActivity.kt @@ -25,7 +25,7 @@ import android.os.Bundle import android.view.View import androidx.fragment.app.Fragment import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import com.nextcloud.client.files.downloader.FilesDownloadWorker +import com.nextcloud.client.files.downloader.FileDownloadWorker import com.nextcloud.client.network.Connectivity import com.nextcloud.client.network.ConnectivityService import com.nextcloud.utils.EditorUtils @@ -130,7 +130,7 @@ class TestActivity : return null } - override fun getFileDownloaderBinder(): FilesDownloadWorker.FileDownloaderBinder? { + override fun getFileDownloaderBinder(): FileDownloadWorker.FileDownloaderBinder? { return null } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0dd8a60198d6..f6f2d17c719f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -383,7 +383,7 @@ android:name=".services.OperationsService" android:exported="false" /> . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files enum class Direction { DOWNLOAD, diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/Registry.kt b/app/src/main/java/com/nextcloud/client/files/Registry.kt similarity index 94% rename from app/src/main/java/com/nextcloud/client/files/downloader/Registry.kt rename to app/src/main/java/com/nextcloud/client/files/Registry.kt index e33ef4d1852b..1d6d582a759d 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/Registry.kt +++ b/app/src/main/java/com/nextcloud/client/files/Registry.kt @@ -1,8 +1,9 @@ /* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2020 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,10 +16,12 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files +import com.nextcloud.client.files.transfer.Transfer +import com.nextcloud.client.files.transfer.TransferState import com.owncloud.android.datamodel.OCFile import java.util.UUID import kotlin.math.max diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/Request.kt b/app/src/main/java/com/nextcloud/client/files/Request.kt similarity index 95% rename from app/src/main/java/com/nextcloud/client/files/downloader/Request.kt rename to app/src/main/java/com/nextcloud/client/files/Request.kt index 5cf6a26d6397..56ab3d7430c7 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/Request.kt +++ b/app/src/main/java/com/nextcloud/client/files/Request.kt @@ -1,8 +1,9 @@ /* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2021 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,13 +16,15 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files import android.os.Parcel import android.os.Parcelable import com.nextcloud.client.account.User +import com.nextcloud.client.files.upload.PostUploadAction +import com.nextcloud.client.files.upload.UploadTrigger import com.owncloud.android.datamodel.OCFile import com.owncloud.android.datamodel.UploadsStorageManager import com.owncloud.android.db.OCUpload diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/DownloadTask.kt b/app/src/main/java/com/nextcloud/client/files/downloader/DownloadTask.kt index b8f61045a969..46a1d2e590f7 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/DownloadTask.kt +++ b/app/src/main/java/com/nextcloud/client/files/downloader/DownloadTask.kt @@ -21,7 +21,7 @@ package com.nextcloud.client.files.downloader import android.content.ContentResolver import android.content.Context -import com.nextcloud.client.core.IsCancelled +import com.nextcloud.client.files.DownloadRequest import com.owncloud.android.datamodel.FileDataStorageManager import com.owncloud.android.datamodel.OCFile import com.owncloud.android.lib.common.OwnCloudClient @@ -37,9 +37,9 @@ import java.io.File * This design can be regarded as intermediary refactoring step. */ class DownloadTask( - val context: Context, - val contentResolver: ContentResolver, - val clientProvider: () -> OwnCloudClient + private val context: Context, + private val contentResolver: ContentResolver, + private val clientProvider: () -> OwnCloudClient ) { data class Result(val file: OCFile, val success: Boolean) @@ -62,39 +62,46 @@ class DownloadTask( } } - fun download(request: DownloadRequest, progress: (Int) -> Unit, isCancelled: IsCancelled): Result { + fun download(request: DownloadRequest): Result { val op = DownloadFileOperation(request.user, request.file, context) val client = clientProvider.invoke() val result = op.execute(client) - if (result.isSuccess) { + + return if (result.isSuccess) { val storageManager = FileDataStorageManager( request.user, contentResolver ) val file = saveDownloadedFile(op, storageManager) - return Result(file, true) + Result(file, true) } else { - return Result(request.file, false) + Result(request.file, false) } } private fun saveDownloadedFile(op: DownloadFileOperation, storageManager: FileDataStorageManager): OCFile { - val file = storageManager.getFileById(op.getFile().getFileId()) as OCFile - val syncDate = System.currentTimeMillis() - file.lastSyncDateForProperties = syncDate - file.lastSyncDateForData = syncDate - file.isUpdateThumbnailNeeded = true - file.modificationTimestamp = op.getModificationTimestamp() - file.modificationTimestampAtLastSyncForData = op.getModificationTimestamp() - file.etag = op.getEtag() - file.mimeType = op.getMimeType() - file.storagePath = op.getSavePath() - file.fileLength = File(op.getSavePath()).length() - file.remoteId = op.getFile().getRemoteId() + val file = storageManager.getFileById(op.file.fileId) as OCFile + + file.apply { + val syncDate = System.currentTimeMillis() + lastSyncDateForProperties = syncDate + lastSyncDateForData = syncDate + isUpdateThumbnailNeeded = true + modificationTimestamp = op.modificationTimestamp + modificationTimestampAtLastSyncForData = op.modificationTimestamp + etag = op.etag + mimeType = op.mimeType + storagePath = op.savePath + fileLength = File(op.savePath).length() + remoteId = op.file.remoteId + } + storageManager.saveFile(file) - if (MimeTypeUtil.isMedia(op.getMimeType())) { + + if (MimeTypeUtil.isMedia(op.mimeType)) { FileDataStorageManager.triggerMediaScan(file.storagePath) } + return file } } diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadHelper.kt b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadHelper.kt similarity index 99% rename from app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadHelper.kt rename to app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadHelper.kt index 328d4b4b164d..bd8b8417d9ea 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadHelper.kt +++ b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadHelper.kt @@ -33,7 +33,7 @@ import com.owncloud.android.utils.MimeTypeUtil import java.io.File import javax.inject.Inject -class FilesDownloadHelper { +class FileDownloadHelper { @Inject lateinit var backgroundJobManager: BackgroundJobManager diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadIntents.kt b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadIntents.kt similarity index 77% rename from app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadIntents.kt rename to app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadIntents.kt index d8d6e67a2c8f..9725bbd69dda 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadIntents.kt +++ b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadIntents.kt @@ -32,16 +32,16 @@ import com.owncloud.android.ui.fragment.OCFileListFragment import com.owncloud.android.ui.preview.PreviewImageActivity import com.owncloud.android.ui.preview.PreviewImageFragment -class FilesDownloadIntents(private val context: Context) { +class FileDownloadIntents(private val context: Context) { fun newDownloadIntent( download: DownloadFileOperation, linkedToRemotePath: String ): Intent { - return Intent(FilesDownloadWorker.getDownloadAddedMessage()).apply { - putExtra(FilesDownloadWorker.ACCOUNT_NAME, download.user.accountName) - putExtra(FilesDownloadWorker.EXTRA_REMOTE_PATH, download.remotePath) - putExtra(FilesDownloadWorker.EXTRA_LINKED_TO_PATH, linkedToRemotePath) + return Intent(FileDownloadWorker.getDownloadAddedMessage()).apply { + putExtra(FileDownloadWorker.ACCOUNT_NAME, download.user.accountName) + putExtra(FileDownloadWorker.EXTRA_REMOTE_PATH, download.remotePath) + putExtra(FileDownloadWorker.EXTRA_LINKED_TO_PATH, linkedToRemotePath) setPackage(context.packageName) } } @@ -51,15 +51,15 @@ class FilesDownloadIntents(private val context: Context) { downloadResult: RemoteOperationResult<*>, unlinkedFromRemotePath: String? ): Intent { - return Intent(FilesDownloadWorker.getDownloadFinishMessage()).apply { - putExtra(FilesDownloadWorker.EXTRA_DOWNLOAD_RESULT, downloadResult.isSuccess) - putExtra(FilesDownloadWorker.ACCOUNT_NAME, download.user.accountName) - putExtra(FilesDownloadWorker.EXTRA_REMOTE_PATH, download.remotePath) + return Intent(FileDownloadWorker.getDownloadFinishMessage()).apply { + putExtra(FileDownloadWorker.EXTRA_DOWNLOAD_RESULT, downloadResult.isSuccess) + putExtra(FileDownloadWorker.ACCOUNT_NAME, download.user.accountName) + putExtra(FileDownloadWorker.EXTRA_REMOTE_PATH, download.remotePath) putExtra(OCFileListFragment.DOWNLOAD_BEHAVIOUR, download.behaviour) putExtra(SendShareDialog.ACTIVITY_NAME, download.activityName) putExtra(SendShareDialog.PACKAGE_NAME, download.packageName) if (unlinkedFromRemotePath != null) { - putExtra(FilesDownloadWorker.EXTRA_LINKED_TO_PATH, unlinkedFromRemotePath) + putExtra(FileDownloadWorker.EXTRA_LINKED_TO_PATH, unlinkedFromRemotePath) } setPackage(context.packageName) } diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadWorker.kt b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt similarity index 97% rename from app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadWorker.kt rename to app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt index 79bd327cc50a..65afdab5f26c 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/FilesDownloadWorker.kt +++ b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt @@ -55,7 +55,7 @@ import java.util.AbstractList import java.util.Vector @Suppress("LongParameterList") -class FilesDownloadWorker( +class FileDownloadWorker( private val viewThemeUtils: ViewThemeUtils, private val accountManager: UserAccountManager, private val uploadsStorageManager: UploadsStorageManager, @@ -65,7 +65,7 @@ class FilesDownloadWorker( ) : Worker(context, params), OnAccountsUpdateListener, OnDatatransferProgressListener { companion object { - private val TAG = FilesDownloadWorker::class.java.simpleName + private val TAG = FileDownloadWorker::class.java.simpleName const val USER_NAME = "USER" const val FILE = "FILE" @@ -82,23 +82,23 @@ class FilesDownloadWorker( const val ACCOUNT_NAME = "ACCOUNT_NAME" fun getDownloadAddedMessage(): String { - return FilesDownloadWorker::class.java.name + "DOWNLOAD_ADDED" + return FileDownloadWorker::class.java.name + "DOWNLOAD_ADDED" } fun getDownloadFinishMessage(): String { - return FilesDownloadWorker::class.java.name + "DOWNLOAD_FINISH" + return FileDownloadWorker::class.java.name + "DOWNLOAD_FINISH" } } private var currentDownload: DownloadFileOperation? = null private var conflictUploadId: Long? = null private var lastPercent = 0 - private val intents = FilesDownloadIntents(context) + private val intents = FileDownloadIntents(context) private val notificationManager = DownloadNotificationManager(context, viewThemeUtils) private val pendingDownloads = IndexedForest() private var downloadBinder: IBinder = FileDownloaderBinder() private var currentUser = Optional.empty() - private val helper = FilesDownloadHelper() + private val helper = FileDownloadHelper() private var startedDownload = false private var storageManager: FileDataStorageManager? = null private var downloadClient: OwnCloudClient? = null diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/FileTransferService.kt b/app/src/main/java/com/nextcloud/client/files/transfer/FileTransferService.kt similarity index 93% rename from app/src/main/java/com/nextcloud/client/files/downloader/FileTransferService.kt rename to app/src/main/java/com/nextcloud/client/files/transfer/FileTransferService.kt index c9b2f7c300b6..daa240c4e7fa 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/FileTransferService.kt +++ b/app/src/main/java/com/nextcloud/client/files/transfer/FileTransferService.kt @@ -1,8 +1,9 @@ /* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2021 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,9 +16,9 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.transfer import android.app.Service import android.content.Context @@ -27,6 +28,10 @@ import com.nextcloud.client.account.User import com.nextcloud.client.core.AsyncRunner import com.nextcloud.client.core.LocalBinder import com.nextcloud.client.device.PowerManagementService +import com.nextcloud.client.files.Direction +import com.nextcloud.client.files.Request +import com.nextcloud.client.files.downloader.DownloadTask +import com.nextcloud.client.files.upload.UploadTask import com.nextcloud.client.logger.Logger import com.nextcloud.client.network.ClientFactory import com.nextcloud.client.network.ConnectivityService diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/Transfer.kt b/app/src/main/java/com/nextcloud/client/files/transfer/Transfer.kt similarity index 73% rename from app/src/main/java/com/nextcloud/client/files/downloader/Transfer.kt rename to app/src/main/java/com/nextcloud/client/files/transfer/Transfer.kt index fff6c420f730..4b5524b093b0 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/Transfer.kt +++ b/app/src/main/java/com/nextcloud/client/files/transfer/Transfer.kt @@ -1,8 +1,9 @@ -/** +/* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2021 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,10 +16,14 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.transfer +import com.nextcloud.client.files.Direction +import com.nextcloud.client.files.DownloadRequest +import com.nextcloud.client.files.Request +import com.nextcloud.client.files.UploadRequest import com.owncloud.android.datamodel.OCFile import java.util.UUID @@ -48,8 +53,9 @@ data class Transfer( */ val isFinished: Boolean get() = state == TransferState.COMPLETED || state == TransferState.FAILED - val direction: Direction get() = when (request) { - is DownloadRequest -> Direction.DOWNLOAD - is UploadRequest -> Direction.UPLOAD - } + val direction: Direction + get() = when (request) { + is DownloadRequest -> Direction.DOWNLOAD + is UploadRequest -> Direction.UPLOAD + } } diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManager.kt b/app/src/main/java/com/nextcloud/client/files/transfer/TransferManager.kt similarity index 91% rename from app/src/main/java/com/nextcloud/client/files/downloader/TransferManager.kt rename to app/src/main/java/com/nextcloud/client/files/transfer/TransferManager.kt index 957e4928771d..d5a96440a45c 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManager.kt +++ b/app/src/main/java/com/nextcloud/client/files/transfer/TransferManager.kt @@ -1,8 +1,9 @@ -/** +/* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2021 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,10 +16,11 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.transfer +import com.nextcloud.client.files.Request import com.owncloud.android.datamodel.OCFile import java.util.UUID diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerConnection.kt b/app/src/main/java/com/nextcloud/client/files/transfer/TransferManagerConnection.kt similarity index 94% rename from app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerConnection.kt rename to app/src/main/java/com/nextcloud/client/files/transfer/TransferManagerConnection.kt index be2ea7fe45ef..e4cd701e2f72 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerConnection.kt +++ b/app/src/main/java/com/nextcloud/client/files/transfer/TransferManagerConnection.kt @@ -1,8 +1,9 @@ -/** +/* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2020 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,15 +16,16 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.transfer import android.content.Context import android.content.Intent import android.os.IBinder import com.nextcloud.client.account.User import com.nextcloud.client.core.LocalConnection +import com.nextcloud.client.files.Request import com.owncloud.android.datamodel.OCFile import java.util.UUID diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt b/app/src/main/java/com/nextcloud/client/files/transfer/TransferManagerImpl.kt similarity index 92% rename from app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt rename to app/src/main/java/com/nextcloud/client/files/transfer/TransferManagerImpl.kt index c7869ef368de..8ff6fa24822d 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/TransferManagerImpl.kt +++ b/app/src/main/java/com/nextcloud/client/files/transfer/TransferManagerImpl.kt @@ -1,8 +1,9 @@ /* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2020 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,14 +16,20 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.transfer import com.nextcloud.client.core.AsyncRunner import com.nextcloud.client.core.IsCancelled import com.nextcloud.client.core.OnProgressCallback import com.nextcloud.client.core.TaskFunction +import com.nextcloud.client.files.DownloadRequest +import com.nextcloud.client.files.Registry +import com.nextcloud.client.files.Request +import com.nextcloud.client.files.UploadRequest +import com.nextcloud.client.files.downloader.DownloadTask +import com.nextcloud.client.files.upload.UploadTask import com.owncloud.android.datamodel.OCFile import com.owncloud.android.operations.UploadFileOperation import java.util.UUID @@ -131,8 +138,8 @@ class TransferManagerImpl( } } else { val downloadTask = downloadTaskFactory.create() - val wrapper: TaskFunction = { progress: ((Int) -> Unit), isCancelled -> - downloadTask.download(request, progress, isCancelled) + val wrapper: TaskFunction = { _: ((Int) -> Unit), _ -> + downloadTask.download(request) } wrapper } @@ -150,7 +157,7 @@ class TransferManagerImpl( } } else { val uploadTask = uploadTaskFactory.create() - val wrapper: TaskFunction = { progress: ((Int) -> Unit), isCancelled -> + val wrapper: TaskFunction = { _: ((Int) -> Unit), _ -> uploadTask.upload(request.user, request.upload) } wrapper diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/TransferState.kt b/app/src/main/java/com/nextcloud/client/files/transfer/TransferState.kt similarity index 95% rename from app/src/main/java/com/nextcloud/client/files/downloader/TransferState.kt rename to app/src/main/java/com/nextcloud/client/files/transfer/TransferState.kt index 0ea69b6cead1..0b9b5a1040b9 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/TransferState.kt +++ b/app/src/main/java/com/nextcloud/client/files/transfer/TransferState.kt @@ -17,7 +17,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.transfer enum class TransferState { PENDING, diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/PostUploadAction.kt b/app/src/main/java/com/nextcloud/client/files/upload/PostUploadAction.kt similarity index 96% rename from app/src/main/java/com/nextcloud/client/files/downloader/PostUploadAction.kt rename to app/src/main/java/com/nextcloud/client/files/upload/PostUploadAction.kt index 0a670eb5b259..91576c379a40 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/PostUploadAction.kt +++ b/app/src/main/java/com/nextcloud/client/files/upload/PostUploadAction.kt @@ -17,7 +17,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.upload import com.owncloud.android.files.services.FileUploader diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/UploadTask.kt b/app/src/main/java/com/nextcloud/client/files/upload/UploadTask.kt similarity index 94% rename from app/src/main/java/com/nextcloud/client/files/downloader/UploadTask.kt rename to app/src/main/java/com/nextcloud/client/files/upload/UploadTask.kt index 6c13436a5438..f7011a470c3f 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/UploadTask.kt +++ b/app/src/main/java/com/nextcloud/client/files/upload/UploadTask.kt @@ -1,8 +1,9 @@ /* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2021 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,9 +16,9 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.upload import android.content.Context import com.nextcloud.client.account.User diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/UploadTrigger.kt b/app/src/main/java/com/nextcloud/client/files/upload/UploadTrigger.kt similarity index 87% rename from app/src/main/java/com/nextcloud/client/files/downloader/UploadTrigger.kt rename to app/src/main/java/com/nextcloud/client/files/upload/UploadTrigger.kt index c71802229bb9..a285d9b09168 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/UploadTrigger.kt +++ b/app/src/main/java/com/nextcloud/client/files/upload/UploadTrigger.kt @@ -1,8 +1,9 @@ /* * Nextcloud Android client application * - * @author Chris Narkiewicz - * Copyright (C) 2021 Chris Narkiewicz + * @author Alper Ozturk + * Copyright (C) 2023 Alper Ozturk + * Copyright (C) 2023 Nextcloud GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,9 +16,9 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ -package com.nextcloud.client.files.downloader +package com.nextcloud.client.files.upload import com.owncloud.android.operations.UploadFileOperation diff --git a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt index 38debc763eed..865b787d5312 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobFactory.kt @@ -34,7 +34,7 @@ import com.nextcloud.client.device.DeviceInfo import com.nextcloud.client.device.PowerManagementService import com.nextcloud.client.documentscan.GeneratePDFUseCase import com.nextcloud.client.documentscan.GeneratePdfFromImagesWork -import com.nextcloud.client.files.downloader.FilesDownloadWorker +import com.nextcloud.client.files.downloader.FileDownloadWorker import com.nextcloud.client.integrations.deck.DeckApi import com.nextcloud.client.logger.Logger import com.nextcloud.client.network.ConnectivityService @@ -103,7 +103,7 @@ class BackgroundJobFactory @Inject constructor( CalendarImportWork::class -> createCalendarImportWork(context, workerParameters) FilesExportWork::class -> createFilesExportWork(context, workerParameters) FilesUploadWorker::class -> createFilesUploadWorker(context, workerParameters) - FilesDownloadWorker::class -> createFilesDownloadWorker(context, workerParameters) + FileDownloadWorker::class -> createFilesDownloadWorker(context, workerParameters) GeneratePdfFromImagesWork::class -> createPDFGenerateWork(context, workerParameters) HealthStatusWork::class -> createHealthStatusWork(context, workerParameters) TestJob::class -> createTestJob(context, workerParameters) @@ -255,8 +255,8 @@ class BackgroundJobFactory @Inject constructor( ) } - private fun createFilesDownloadWorker(context: Context, params: WorkerParameters): FilesDownloadWorker { - return FilesDownloadWorker( + private fun createFilesDownloadWorker(context: Context, params: WorkerParameters): FileDownloadWorker { + return FileDownloadWorker( viewThemeUtils.get(), accountManager, uploadsStorageManager, diff --git a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt index f31f41722311..8e815432c97a 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt @@ -39,7 +39,7 @@ import com.nextcloud.client.account.User import com.nextcloud.client.core.Clock import com.nextcloud.client.di.Injectable import com.nextcloud.client.documentscan.GeneratePdfFromImagesWork -import com.nextcloud.client.files.downloader.FilesDownloadWorker +import com.nextcloud.client.files.downloader.FileDownloadWorker import com.nextcloud.client.preferences.AppPreferences import com.owncloud.android.datamodel.OCFile import com.owncloud.android.operations.DownloadType @@ -521,16 +521,16 @@ internal class BackgroundJobManagerImpl( val gson = Gson() val data = workDataOf( - FilesDownloadWorker.USER_NAME to user.accountName, - FilesDownloadWorker.FILE to gson.toJson(ocFile), - FilesDownloadWorker.BEHAVIOUR to behaviour, - FilesDownloadWorker.DOWNLOAD_TYPE to downloadType.toString(), - FilesDownloadWorker.ACTIVITY_NAME to activityName, - FilesDownloadWorker.PACKAGE_NAME to packageName, - FilesDownloadWorker.CONFLICT_UPLOAD_ID to conflictUploadId + FileDownloadWorker.USER_NAME to user.accountName, + FileDownloadWorker.FILE to gson.toJson(ocFile), + FileDownloadWorker.BEHAVIOUR to behaviour, + FileDownloadWorker.DOWNLOAD_TYPE to downloadType.toString(), + FileDownloadWorker.ACTIVITY_NAME to activityName, + FileDownloadWorker.PACKAGE_NAME to packageName, + FileDownloadWorker.CONFLICT_UPLOAD_ID to conflictUploadId ) - val request = oneTimeRequestBuilder(FilesDownloadWorker::class, JOB_FILES_DOWNLOAD, user) + val request = oneTimeRequestBuilder(FileDownloadWorker::class, JOB_FILES_DOWNLOAD, user) .setInputData(data) .build() diff --git a/app/src/main/java/com/nextcloud/client/jobs/ContactsBackupWork.kt b/app/src/main/java/com/nextcloud/client/jobs/ContactsBackupWork.kt index e3f7b708b303..8a09e0799750 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/ContactsBackupWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/ContactsBackupWork.kt @@ -35,10 +35,10 @@ import androidx.work.Worker import androidx.work.WorkerParameters import com.nextcloud.client.account.User import com.nextcloud.client.account.UserAccountManager -import com.nextcloud.client.files.downloader.PostUploadAction -import com.nextcloud.client.files.downloader.TransferManagerConnection -import com.nextcloud.client.files.downloader.UploadRequest -import com.nextcloud.client.files.downloader.UploadTrigger +import com.nextcloud.client.files.UploadRequest +import com.nextcloud.client.files.transfer.TransferManagerConnection +import com.nextcloud.client.files.upload.PostUploadAction +import com.nextcloud.client.files.upload.UploadTrigger import com.owncloud.android.R import com.owncloud.android.datamodel.ArbitraryDataProvider import com.owncloud.android.datamodel.FileDataStorageManager diff --git a/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt b/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt index 797cea1969e4..c5f82cc89df2 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt @@ -33,7 +33,7 @@ import androidx.core.app.NotificationCompat import androidx.work.Worker import androidx.work.WorkerParameters import com.nextcloud.client.account.User -import com.nextcloud.client.files.downloader.FilesDownloadHelper +import com.nextcloud.client.files.downloader.FileDownloadHelper import com.owncloud.android.R import com.owncloud.android.datamodel.FileDataStorageManager import com.owncloud.android.datamodel.OCFile @@ -111,7 +111,7 @@ class FilesExportWork( } private fun downloadFile(ocFile: OCFile) { - FilesDownloadHelper().downloadFile( + FileDownloadHelper().downloadFile( user, ocFile, DownloadType.EXPORT diff --git a/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java index e1d9ead64139..f3da5e4b807c 100644 --- a/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java +++ b/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java @@ -31,7 +31,7 @@ import com.nextcloud.android.files.FileLockingHelper; import com.nextcloud.client.account.User; import com.nextcloud.client.editimage.EditImageActivity; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.utils.EditorUtils; import com.owncloud.android.R; import com.owncloud.android.datamodel.FileDataStorageManager; @@ -380,7 +380,7 @@ private boolean anyFileSynchronizing() { if (componentsGetter != null && !files.isEmpty() && user != null) { OperationsServiceBinder opsBinder = componentsGetter.getOperationsServiceBinder(); FileUploaderBinder uploaderBinder = componentsGetter.getFileUploaderBinder(); - FilesDownloadWorker.FileDownloaderBinder downloaderBinder = componentsGetter.getFileDownloaderBinder(); + FileDownloadWorker.FileDownloaderBinder downloaderBinder = componentsGetter.getFileDownloaderBinder(); synchronizing = anyFileSynchronizing(opsBinder) || // comparing local and remote anyFileDownloading(downloaderBinder) || anyFileUploading(uploaderBinder); @@ -398,7 +398,7 @@ private boolean anyFileSynchronizing(OperationsServiceBinder opsBinder) { return synchronizing; } - private boolean anyFileDownloading(FilesDownloadWorker.FileDownloaderBinder downloaderBinder) { + private boolean anyFileDownloading(FileDownloadWorker.FileDownloaderBinder downloaderBinder) { boolean downloading = false; if (downloaderBinder != null) { for (Iterator iterator = files.iterator(); !downloading && iterator.hasNext(); ) { diff --git a/app/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java b/app/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java index 1d9228dab52d..48b7aa9b701f 100644 --- a/app/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/SynchronizeFileOperation.java @@ -25,7 +25,7 @@ import android.text.TextUtils; import com.nextcloud.client.account.User; -import com.nextcloud.client.files.downloader.FilesDownloadHelper; +import com.nextcloud.client.files.downloader.FileDownloadHelper; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.FileUploader; @@ -316,7 +316,7 @@ private void requestForUpload(OCFile file) { * @param file OCFile object representing the file to download */ private void requestForDownload(OCFile file) { - FilesDownloadHelper downloadHelper = new FilesDownloadHelper(); + FileDownloadHelper downloadHelper = new FileDownloadHelper(); downloadHelper.downloadFile( mUser, diff --git a/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java b/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java index 8aa1e07a765e..cf60dacea912 100644 --- a/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java @@ -25,7 +25,7 @@ import android.text.TextUtils; import com.nextcloud.client.account.User; -import com.nextcloud.client.files.downloader.FilesDownloadHelper; +import com.nextcloud.client.files.downloader.FileDownloadHelper; import com.owncloud.android.datamodel.DecryptedFolderMetadata; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; @@ -452,7 +452,7 @@ private void startDirectDownloads() throws OperationCancelledException { throw new OperationCancelledException(); } - FilesDownloadHelper downloadHelper = new FilesDownloadHelper(); + FileDownloadHelper downloadHelper = new FileDownloadHelper(); downloadHelper.downloadFile(user, file); } diff --git a/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java b/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java index a7f10ffac956..24887f50587e 100644 --- a/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java +++ b/app/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java @@ -307,7 +307,7 @@ private boolean hasServerChange(Document document) throws FileNotFoundException /** * Updates the OC File after a successful download. * - * TODO unify with code from {@link com.nextcloud.client.files.downloader.FilesDownloadWorker} and {@link DownloadTask}. + * TODO unify with code from {@link com.nextcloud.client.files.downloader.FileDownloadWorker} and {@link DownloadTask}. */ private void saveDownloadedFile(FileDataStorageManager storageManager, DownloadFileOperation dfo, OCFile file) { long syncDate = System.currentTimeMillis(); diff --git a/app/src/main/java/com/owncloud/android/services/SyncFolderHandler.java b/app/src/main/java/com/owncloud/android/services/SyncFolderHandler.java index 18329af5dc5d..c91702076d5b 100644 --- a/app/src/main/java/com/owncloud/android/services/SyncFolderHandler.java +++ b/app/src/main/java/com/owncloud/android/services/SyncFolderHandler.java @@ -28,7 +28,7 @@ import android.util.Pair; import com.nextcloud.client.account.User; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.files.services.IndexedForest; import com.owncloud.android.lib.common.OwnCloudAccount; @@ -169,9 +169,9 @@ public void cancel(Account account, OCFile file){ * this is a fast and ugly patch. */ private void sendBroadcastNewSyncFolder(Account account, String remotePath) { - Intent added = new Intent(FilesDownloadWorker.Companion.getDownloadAddedMessage()); - added.putExtra(FilesDownloadWorker.ACCOUNT_NAME, account.name); - added.putExtra(FilesDownloadWorker.EXTRA_REMOTE_PATH, remotePath); + Intent added = new Intent(FileDownloadWorker.Companion.getDownloadAddedMessage()); + added.putExtra(FileDownloadWorker.ACCOUNT_NAME, account.name); + added.putExtra(FileDownloadWorker.EXTRA_REMOTE_PATH, remotePath); added.setPackage(mService.getPackageName()); LocalBroadcastManager.getInstance(mService.getApplicationContext()).sendBroadcast(added); } @@ -182,10 +182,10 @@ private void sendBroadcastNewSyncFolder(Account account, String remotePath) { */ private void sendBroadcastFinishedSyncFolder(Account account, String remotePath, boolean success) { - Intent finished = new Intent(FilesDownloadWorker.Companion.getDownloadFinishMessage()); - finished.putExtra(FilesDownloadWorker.ACCOUNT_NAME, account.name); - finished.putExtra(FilesDownloadWorker.EXTRA_REMOTE_PATH, remotePath); - finished.putExtra(FilesDownloadWorker.EXTRA_DOWNLOAD_RESULT, success); + Intent finished = new Intent(FileDownloadWorker.Companion.getDownloadFinishMessage()); + finished.putExtra(FileDownloadWorker.ACCOUNT_NAME, account.name); + finished.putExtra(FileDownloadWorker.EXTRA_REMOTE_PATH, remotePath); + finished.putExtra(FileDownloadWorker.EXTRA_DOWNLOAD_RESULT, success); finished.setPackage(mService.getPackageName()); LocalBroadcastManager.getInstance(mService.getApplicationContext()).sendBroadcast(finished); } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ComponentsGetter.java b/app/src/main/java/com/owncloud/android/ui/activity/ComponentsGetter.java index 9ae88f3c7248..48cc4986a99e 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ComponentsGetter.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ComponentsGetter.java @@ -20,7 +20,7 @@ package com.owncloud.android.ui.activity; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.files.services.FileUploader.FileUploaderBinder; import com.owncloud.android.services.OperationsService.OperationsServiceBinder; @@ -32,7 +32,7 @@ public interface ComponentsGetter { * To be invoked when the parent activity is fully created to get a reference * to the FileDownloadWorker. */ - public FilesDownloadWorker.FileDownloaderBinder getFileDownloaderBinder(); + public FileDownloadWorker.FileDownloaderBinder getFileDownloaderBinder(); /** diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt index 5d18e9698380..0a1f8d3bffbe 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/ConflictsResolveActivity.kt @@ -21,7 +21,7 @@ import android.content.Intent import android.os.Bundle import android.widget.Toast import com.nextcloud.client.account.User -import com.nextcloud.client.files.downloader.FilesDownloadHelper +import com.nextcloud.client.files.downloader.FileDownloadHelper import com.nextcloud.model.HTTPStatusCodes import com.nextcloud.utils.extensions.getParcelableArgument import com.owncloud.android.R @@ -115,7 +115,7 @@ class ConflictsResolveActivity : FileActivity(), OnConflictDecisionMadeListener Decision.KEEP_SERVER -> if (!shouldDeleteLocal()) { // Overwrite local file file?.let { - FilesDownloadHelper().downloadFile( + FileDownloadHelper().downloadFile( getUser().orElseThrow { RuntimeException() }, file, conflictUploadId diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java index e36c0e9ed2ca..f0c1573cc293 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java @@ -43,8 +43,8 @@ import com.google.android.material.snackbar.Snackbar; import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; -import com.nextcloud.client.files.downloader.FilesDownloadHelper; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadHelper; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.network.ConnectivityService; import com.nextcloud.utils.EditorUtils; @@ -166,7 +166,7 @@ public abstract class FileActivity extends DrawerActivity private boolean mResumed; - protected FilesDownloadWorker.FileDownloaderBinder mDownloaderBinder; + protected FileDownloadWorker.FileDownloaderBinder mDownloaderBinder; protected FileUploaderBinder mUploaderBinder; private ServiceConnection mUploadServiceConnection; @@ -234,7 +234,7 @@ protected void onCreate(Bundle savedInstanceState) { Context.BIND_AUTO_CREATE); if (user != null) { - new FilesDownloadHelper().downloadFile(user, mFile); + new FileDownloadHelper().downloadFile(user, mFile); } mUploadServiceConnection = newTransferenceServiceConnection(); @@ -612,7 +612,7 @@ public void onServiceDisconnected(ComponentName component) { } @Override - public FilesDownloadWorker.FileDownloaderBinder getFileDownloaderBinder() { + public FileDownloadWorker.FileDownloaderBinder getFileDownloaderBinder() { return mDownloaderBinder; } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index 58092869ff71..c856e0e811ef 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -65,8 +65,8 @@ import com.nextcloud.client.di.Injectable; import com.nextcloud.client.editimage.EditImageActivity; import com.nextcloud.client.files.DeepLinkHandler; -import com.nextcloud.client.files.downloader.FilesDownloadHelper; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadHelper; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.client.media.PlayerServiceConnection; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.client.network.ConnectivityService; @@ -681,12 +681,12 @@ protected void refreshDetailsFragmentIfVisible(String downloadEvent, String down // the user browsed to other file ; forget the automatic preview mWaitingToPreview = null; - } else if (downloadEvent.equals(FilesDownloadWorker.Companion.getDownloadAddedMessage())) { + } else if (downloadEvent.equals(FileDownloadWorker.Companion.getDownloadAddedMessage())) { // grant that the details fragment updates the progress bar detailsFragment.listenForTransferProgress(); detailsFragment.updateFileDetails(true, false); - } else if (downloadEvent.equals(FilesDownloadWorker.Companion.getDownloadFinishMessage())) { + } else if (downloadEvent.equals(FileDownloadWorker.Companion.getDownloadFinishMessage())) { // update the details panel boolean detailsFragmentChanged = false; if (waitedPreview) { @@ -1112,8 +1112,8 @@ protected void onResume() { localBroadcastManager.registerReceiver(mUploadFinishReceiver, uploadIntentFilter); // Listen for download messages - IntentFilter downloadIntentFilter = new IntentFilter(FilesDownloadWorker.Companion.getDownloadAddedMessage()); - downloadIntentFilter.addAction(FilesDownloadWorker.Companion.getDownloadFinishMessage()); + IntentFilter downloadIntentFilter = new IntentFilter(FileDownloadWorker.Companion.getDownloadAddedMessage()); + downloadIntentFilter.addAction(FileDownloadWorker.Companion.getDownloadFinishMessage()); mDownloadFinishReceiver = new DownloadFinishReceiver(); localBroadcastManager.registerReceiver(mDownloadFinishReceiver, downloadIntentFilter); @@ -1414,7 +1414,7 @@ private boolean isAscendant(String linkedToRemotePath) { /** - * Class waiting for broadcast events from the {@link FilesDownloadWorker} service. + * Class waiting for broadcast events from the {@link FileDownloadWorker} service. *

* Updates the UI when a download is started or finished, provided that it is relevant for the current folder. */ @@ -1423,16 +1423,16 @@ private class DownloadFinishReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { boolean sameAccount = isSameAccount(intent); - String downloadedRemotePath = intent.getStringExtra(FilesDownloadWorker.EXTRA_REMOTE_PATH); + String downloadedRemotePath = intent.getStringExtra(FileDownloadWorker.EXTRA_REMOTE_PATH); String downloadBehaviour = intent.getStringExtra(OCFileListFragment.DOWNLOAD_BEHAVIOUR); boolean isDescendant = isDescendant(downloadedRemotePath); if (sameAccount && isDescendant) { - String linkedToRemotePath = intent.getStringExtra(FilesDownloadWorker.EXTRA_LINKED_TO_PATH); + String linkedToRemotePath = intent.getStringExtra(FileDownloadWorker.EXTRA_LINKED_TO_PATH); if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) { updateListOfFilesFragment(false); } - refreshDetailsFragmentIfVisible(intent.getAction(), downloadedRemotePath, intent.getBooleanExtra(FilesDownloadWorker.EXTRA_DOWNLOAD_RESULT, false)); + refreshDetailsFragmentIfVisible(intent.getAction(), downloadedRemotePath, intent.getBooleanExtra(FileDownloadWorker.EXTRA_DOWNLOAD_RESULT, false)); } if (mWaitingToSend != null) { @@ -1465,7 +1465,7 @@ private boolean isAscendant(String linkedToRemotePath) { } private boolean isSameAccount(Intent intent) { - String accountName = intent.getStringExtra(FilesDownloadWorker.ACCOUNT_NAME); + String accountName = intent.getStringExtra(FileDownloadWorker.ACCOUNT_NAME); return accountName != null && getAccount() != null && accountName.equals(getAccount().name); } } @@ -1567,9 +1567,9 @@ private class ListServiceConnection implements ServiceConnection { @Override public void onServiceConnected(ComponentName component, IBinder service) { - if (component.equals(new ComponentName(FileDisplayActivity.this, FilesDownloadWorker.class))) { + if (component.equals(new ComponentName(FileDisplayActivity.this, FileDownloadWorker.class))) { Log_OC.d(TAG, "Download service connected"); - mDownloaderBinder = (FilesDownloadWorker.FileDownloaderBinder) service; + mDownloaderBinder = (FileDownloadWorker.FileDownloaderBinder) service; if (mWaitingToPreview != null && getStorageManager() != null) { // update the file mWaitingToPreview = getStorageManager().getFileById(mWaitingToPreview.getFileId()); @@ -1600,7 +1600,7 @@ public void onServiceConnected(ComponentName component, IBinder service) { @Override public void onServiceDisconnected(ComponentName component) { - if (component.equals(new ComponentName(FileDisplayActivity.this, FilesDownloadWorker.class))) { + if (component.equals(new ComponentName(FileDisplayActivity.this, FileDownloadWorker.class))) { Log_OC.d(TAG, "Download service disconnected"); mDownloaderBinder = null; } else if (component.equals(new ComponentName(FileDisplayActivity.this, FileUploader.class))) { @@ -1890,7 +1890,7 @@ private void requestForDownload() { User user = getUser().orElseThrow(RuntimeException::new); //if (!mWaitingToPreview.isDownloading()) { if (!mDownloaderBinder.isDownloading(user, mWaitingToPreview)) { - new FilesDownloadHelper().downloadFile(user, mWaitingToPreview); + new FileDownloadHelper().downloadFile(user, mWaitingToPreview); } } @@ -1962,7 +1962,7 @@ public void run() { private void requestForDownload(OCFile file, String downloadBehaviour, String packageName, String activityName) { final User currentUser = getUser().orElseThrow(RuntimeException::new); if (!mDownloaderBinder.isDownloading(currentUser, mWaitingToPreview)) { - new FilesDownloadHelper().downloadFile(currentUser, file, downloadBehaviour, DownloadType.DOWNLOAD, activityName, packageName, null); + new FileDownloadHelper().downloadFile(currentUser, file, downloadBehaviour, DownloadType.DOWNLOAD, activityName, packageName, null); } } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java index 24622e11414a..b0d200277393 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java @@ -41,7 +41,7 @@ import com.google.common.collect.Sets; import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.onboarding.FirstRunActivity; import com.nextcloud.java.util.Optional; @@ -525,8 +525,8 @@ private class ManageAccountsServiceConnection implements ServiceConnection { @Override public void onServiceConnected(ComponentName component, IBinder service) { - if (component.equals(new ComponentName(ManageAccountsActivity.this, FilesDownloadWorker.class))) { - mDownloaderBinder = (FilesDownloadWorker.FileDownloaderBinder) service; + if (component.equals(new ComponentName(ManageAccountsActivity.this, FileDownloadWorker.class))) { + mDownloaderBinder = (FileDownloadWorker.FileDownloaderBinder) service; } else if (component.equals(new ComponentName(ManageAccountsActivity.this, FileUploader.class))) { Log_OC.d(TAG, "Upload service connected"); @@ -536,7 +536,7 @@ public void onServiceConnected(ComponentName component, IBinder service) { @Override public void onServiceDisconnected(ComponentName component) { - if (component.equals(new ComponentName(ManageAccountsActivity.this, FilesDownloadWorker.class))) { + if (component.equals(new ComponentName(ManageAccountsActivity.this, FileDownloadWorker.class))) { Log_OC.d(TAG, "Download service suddenly disconnected"); mDownloaderBinder = null; } else if (component.equals(new ComponentName(ManageAccountsActivity.this, FileUploader.class))) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 9f16f82dd003..45bebf359d68 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -44,7 +44,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.client.network.ConnectivityService; @@ -502,7 +502,7 @@ public void updateFileDetails(OCFile file, User user) { * TODO Remove parameter when the transferring state of files is kept in database. * * @param transferring Flag signaling if the file should be considered as downloading or uploading, although - * {@link com.nextcloud.client.files.downloader.FilesDownloadWorker.FileDownloaderBinder#isDownloading(User, OCFile)} and + * {@link com.nextcloud.client.files.downloader.FileDownloadWorker.FileDownloaderBinder#isDownloading(User, OCFile)} and * {@link FileUploaderBinder#isUploading(User, OCFile)} return false. * @param refresh If 'true', try to refresh the whole file from the database */ @@ -534,7 +534,7 @@ public void updateFileDetails(boolean transferring, boolean refresh) { setFavoriteIconStatus(file.isFavorite()); // configure UI for depending upon local state of the file - FilesDownloadWorker.FileDownloaderBinder downloaderBinder = containerActivity.getFileDownloaderBinder(); + FileDownloadWorker.FileDownloaderBinder downloaderBinder = containerActivity.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = containerActivity.getFileUploaderBinder(); if (transferring || (downloaderBinder != null && downloaderBinder.isDownloading(user, file)) @@ -659,7 +659,7 @@ private void setButtonsForTransferring() { // show the progress bar for the transfer binding.progressBlock.setVisibility(View.VISIBLE); binding.progressText.setVisibility(View.VISIBLE); - FilesDownloadWorker.FileDownloaderBinder downloaderBinder = containerActivity.getFileDownloaderBinder(); + FileDownloadWorker.FileDownloaderBinder downloaderBinder = containerActivity.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = containerActivity.getFileUploaderBinder(); //if (getFile().isDownloading()) { if (downloaderBinder != null && downloaderBinder.isDownloading(user, getFile())) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileFragment.java index e64dd05f2390..34b0d0cbdf58 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileFragment.java @@ -21,7 +21,6 @@ package com.owncloud.android.ui.fragment; -import android.accounts.Account; import android.app.Activity; import android.os.Bundle; diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java index 5e1a38e38951..8aad8525c676 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java @@ -38,11 +38,11 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; -import com.nextcloud.client.files.downloader.DownloadRequest; -import com.nextcloud.client.files.downloader.Request; -import com.nextcloud.client.files.downloader.Transfer; -import com.nextcloud.client.files.downloader.TransferManagerConnection; -import com.nextcloud.client.files.downloader.TransferState; +import com.nextcloud.client.files.DownloadRequest; +import com.nextcloud.client.files.Request; +import com.nextcloud.client.files.transfer.Transfer; +import com.nextcloud.client.files.transfer.TransferManagerConnection; +import com.nextcloud.client.files.transfer.TransferState; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.network.ClientFactory; import com.nextcloud.utils.extensions.BundleExtensionsKt; diff --git a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java index 8700a80c61f1..08e7416512bf 100755 --- a/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java +++ b/app/src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java @@ -47,7 +47,7 @@ import com.nextcloud.client.account.CurrentAccountProvider; import com.nextcloud.client.account.User; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.network.ConnectivityService; import com.nextcloud.java.util.Optional; @@ -997,7 +997,7 @@ public void cancelTransference(OCFile file) { } // for both files and folders - FilesDownloadWorker.FileDownloaderBinder downloaderBinder = fileActivity.getFileDownloaderBinder(); + FileDownloadWorker.FileDownloaderBinder downloaderBinder = fileActivity.getFileDownloaderBinder(); if (downloaderBinder != null && downloaderBinder.isDownloading(currentUser, file)) { downloaderBinder.cancelPendingOrCurrentDownloads(currentUser.toPlatformAccount(), file); } diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java index fe11f92933fc..13363d231fd2 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -37,8 +37,8 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.di.Injectable; import com.nextcloud.client.editimage.EditImageActivity; -import com.nextcloud.client.files.downloader.FilesDownloadHelper; -import com.nextcloud.client.files.downloader.FilesDownloadWorker; +import com.nextcloud.client.files.downloader.FileDownloadHelper; +import com.nextcloud.client.files.downloader.FileDownloadWorker; import com.nextcloud.client.preferences.AppPreferences; import com.nextcloud.java.util.Optional; import com.nextcloud.utils.extensions.IntentExtensionsKt; @@ -311,8 +311,8 @@ private class PreviewImageServiceConnection implements ServiceConnection { public void onServiceConnected(ComponentName component, IBinder service) { if (component.equals(new ComponentName(PreviewImageActivity.this, - FilesDownloadWorker.class))) { - mDownloaderBinder = (FilesDownloadWorker.FileDownloaderBinder) service; + FileDownloadWorker.class))) { + mDownloaderBinder = (FileDownloadWorker.FileDownloaderBinder) service; if (mRequestWaitingForBinder) { mRequestWaitingForBinder = false; Log_OC.d(TAG, "Simulating reselection of current page after connection " + @@ -331,7 +331,7 @@ public void onServiceConnected(ComponentName component, IBinder service) { @Override public void onServiceDisconnected(ComponentName component) { if (component.equals(new ComponentName(PreviewImageActivity.this, - FilesDownloadWorker.class))) { + FileDownloadWorker.class))) { Log_OC.d(TAG, "Download service suddenly disconnected"); mDownloaderBinder = null; } else if (component.equals(new ComponentName(PreviewImageActivity.this, @@ -359,7 +359,7 @@ protected void onResume() { super.onResume(); mDownloadFinishReceiver = new DownloadFinishReceiver(); - IntentFilter downloadIntentFilter = new IntentFilter(FilesDownloadWorker.Companion.getDownloadFinishMessage()); + IntentFilter downloadIntentFilter = new IntentFilter(FileDownloadWorker.Companion.getDownloadFinishMessage()); localBroadcastManager.registerReceiver(mDownloadFinishReceiver, downloadIntentFilter); mUploadFinishReceiver = new UploadFinishReceiver(); @@ -413,7 +413,7 @@ public void requestForDownload(OCFile file, String downloadBehaviour) { } else if (!mDownloaderBinder.isDownloading(getUserAccountManager().getUser(), file)) { final User user = getUser().orElseThrow(RuntimeException::new); - new FilesDownloadHelper().downloadFile(user, file, downloadBehaviour); + new FileDownloadHelper().downloadFile(user, file, downloadBehaviour); } } @@ -478,7 +478,7 @@ public void onPageScrolled(int position, float positionOffset, int positionOffse } /** - * Class waiting for broadcast events from the {@link FilesDownloadWorker} service. + * Class waiting for broadcast events from the {@link FileDownloadWorker} service. * * Updates the UI when a download is started or finished, provided that it is relevant for the * folder displayed in the gallery. @@ -498,12 +498,12 @@ public void onReceive(Context context, Intent intent) { } private void previewNewImage(Intent intent) { - String accountName = intent.getStringExtra(FilesDownloadWorker.ACCOUNT_NAME); - String downloadedRemotePath = intent.getStringExtra(FilesDownloadWorker.EXTRA_REMOTE_PATH); + String accountName = intent.getStringExtra(FileDownloadWorker.ACCOUNT_NAME); + String downloadedRemotePath = intent.getStringExtra(FileDownloadWorker.EXTRA_REMOTE_PATH); String downloadBehaviour = intent.getStringExtra(OCFileListFragment.DOWNLOAD_BEHAVIOUR); if (getAccount().name.equals(accountName) && downloadedRemotePath != null) { OCFile file = getStorageManager().getFileByPath(downloadedRemotePath); - boolean downloadWasFine = intent.getBooleanExtra(FilesDownloadWorker.EXTRA_DOWNLOAD_RESULT, false); + boolean downloadWasFine = intent.getBooleanExtra(FileDownloadWorker.EXTRA_DOWNLOAD_RESULT, false); if (EditImageActivity.OPEN_IMAGE_EDITOR.equals(downloadBehaviour)) { startImageEditor(file); diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java index e2e58d1a86b5..2336881e797c 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -56,7 +56,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.account.UserAccountManager; import com.nextcloud.client.di.Injectable; -import com.nextcloud.client.files.downloader.FilesDownloadHelper; +import com.nextcloud.client.files.downloader.FileDownloadHelper; import com.nextcloud.client.jobs.BackgroundJobManager; import com.nextcloud.client.media.ExoplayerListener; import com.nextcloud.client.media.NextcloudExoPlayer; @@ -494,7 +494,7 @@ public void onFileActionChosen(final int itemId) { backgroundJobManager); } else if (itemId == R.id.action_download_file) { if (!containerActivity.getFileDownloaderBinder().isDownloading(user, getFile())) { - new FilesDownloadHelper().downloadFile(user, getFile()); + new FileDownloadHelper().downloadFile(user, getFile()); } } } diff --git a/app/src/main/java/third_parties/sufficientlysecure/SaveCalendar.java b/app/src/main/java/third_parties/sufficientlysecure/SaveCalendar.java index fcdf8ffc960a..5a3101d9329a 100644 --- a/app/src/main/java/third_parties/sufficientlysecure/SaveCalendar.java +++ b/app/src/main/java/third_parties/sufficientlysecure/SaveCalendar.java @@ -42,11 +42,11 @@ import android.widget.EditText; import com.nextcloud.client.account.User; -import com.nextcloud.client.files.downloader.PostUploadAction; -import com.nextcloud.client.files.downloader.Request; -import com.nextcloud.client.files.downloader.TransferManagerConnection; -import com.nextcloud.client.files.downloader.UploadRequest; -import com.nextcloud.client.files.downloader.UploadTrigger; +import com.nextcloud.client.files.Request; +import com.nextcloud.client.files.UploadRequest; +import com.nextcloud.client.files.transfer.TransferManagerConnection; +import com.nextcloud.client.files.upload.PostUploadAction; +import com.nextcloud.client.files.upload.UploadTrigger; import com.nextcloud.client.preferences.AppPreferences; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile;