|
@@ -44,8 +44,9 @@ import com.google.android.material.tabs.TabLayout;
|
|
import com.nextcloud.client.account.User;
|
|
import com.nextcloud.client.account.User;
|
|
import com.nextcloud.client.account.UserAccountManager;
|
|
import com.nextcloud.client.account.UserAccountManager;
|
|
import com.nextcloud.client.di.Injectable;
|
|
import com.nextcloud.client.di.Injectable;
|
|
-import com.nextcloud.client.files.downloader.FileDownloadHelper;
|
|
|
|
import com.nextcloud.client.jobs.BackgroundJobManager;
|
|
import com.nextcloud.client.jobs.BackgroundJobManager;
|
|
|
|
+import com.nextcloud.client.jobs.download.FileDownloadHelper;
|
|
|
|
+import com.nextcloud.client.jobs.upload.FileUploadHelper;
|
|
import com.nextcloud.client.network.ClientFactory;
|
|
import com.nextcloud.client.network.ClientFactory;
|
|
import com.nextcloud.client.network.ConnectivityService;
|
|
import com.nextcloud.client.network.ConnectivityService;
|
|
import com.nextcloud.client.preferences.AppPreferences;
|
|
import com.nextcloud.client.preferences.AppPreferences;
|
|
@@ -58,7 +59,6 @@ import com.owncloud.android.databinding.FileDetailsFragmentBinding;
|
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.datamodel.OCFile;
|
|
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
|
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
|
|
-import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
|
|
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
|
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
|
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
|
@@ -233,7 +233,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
|
} else {
|
|
} else {
|
|
binding.emptyList.emptyListView.setVisibility(View.GONE);
|
|
binding.emptyList.emptyListView.setVisibility(View.GONE);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
Context context = getContext();
|
|
Context context = getContext();
|
|
if (context == null) {
|
|
if (context == null) {
|
|
return null;
|
|
return null;
|
|
@@ -506,7 +506,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
|
*
|
|
*
|
|
* @param transferring Flag signaling if the file should be considered as downloading or uploading, although
|
|
* @param transferring Flag signaling if the file should be considered as downloading or uploading, although
|
|
* {@link FileDownloadHelper#isDownloading(User, OCFile)} and
|
|
* {@link FileDownloadHelper#isDownloading(User, OCFile)} and
|
|
- * {@link FileUploaderBinder#isUploading(User, OCFile)} return false.
|
|
|
|
|
|
+ * {@link FileUploadHelper#isUploading(User, OCFile)} return false.
|
|
* @param refresh If 'true', try to refresh the whole file from the database
|
|
* @param refresh If 'true', try to refresh the whole file from the database
|
|
*/
|
|
*/
|
|
public void updateFileDetails(boolean transferring, boolean refresh) {
|
|
public void updateFileDetails(boolean transferring, boolean refresh) {
|
|
@@ -537,10 +537,9 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
|
setFavoriteIconStatus(file.isFavorite());
|
|
setFavoriteIconStatus(file.isFavorite());
|
|
|
|
|
|
// configure UI for depending upon local state of the file
|
|
// configure UI for depending upon local state of the file
|
|
- FileUploaderBinder uploaderBinder = containerActivity.getFileUploaderBinder();
|
|
|
|
if (transferring
|
|
if (transferring
|
|
|| (FileDownloadHelper.Companion.instance().isDownloading(user, file))
|
|
|| (FileDownloadHelper.Companion.instance().isDownloading(user, file))
|
|
- || (uploaderBinder != null && uploaderBinder.isUploading(user, file))) {
|
|
|
|
|
|
+ || (FileUploadHelper.Companion.instance().isUploading(user, file))) {
|
|
setButtonsForTransferring();
|
|
setButtonsForTransferring();
|
|
|
|
|
|
} else if (file.isDown()) {
|
|
} else if (file.isDown()) {
|
|
@@ -661,11 +660,10 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
|
// show the progress bar for the transfer
|
|
// show the progress bar for the transfer
|
|
binding.progressBlock.setVisibility(View.VISIBLE);
|
|
binding.progressBlock.setVisibility(View.VISIBLE);
|
|
binding.progressText.setVisibility(View.VISIBLE);
|
|
binding.progressText.setVisibility(View.VISIBLE);
|
|
- FileUploaderBinder uploaderBinder = containerActivity.getFileUploaderBinder();
|
|
|
|
if (FileDownloadHelper.Companion.instance().isDownloading(user, getFile())) {
|
|
if (FileDownloadHelper.Companion.instance().isDownloading(user, getFile())) {
|
|
binding.progressText.setText(R.string.downloader_download_in_progress_ticker);
|
|
binding.progressText.setText(R.string.downloader_download_in_progress_ticker);
|
|
} else {
|
|
} else {
|
|
- if (uploaderBinder != null && uploaderBinder.isUploading(user, getFile())) {
|
|
|
|
|
|
+ if (FileUploadHelper.Companion.instance().isUploading(user, getFile())) {
|
|
binding.progressText.setText(R.string.uploader_upload_in_progress_ticker);
|
|
binding.progressText.setText(R.string.uploader_upload_in_progress_ticker);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -698,9 +696,15 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
|
containerActivity.getFileDownloadProgressListener().
|
|
containerActivity.getFileDownloadProgressListener().
|
|
addDataTransferProgressListener(progressListener, getFile());
|
|
addDataTransferProgressListener(progressListener, getFile());
|
|
}
|
|
}
|
|
- if (containerActivity.getFileUploaderBinder() != null) {
|
|
|
|
- containerActivity.getFileUploaderBinder().
|
|
|
|
- addDatatransferProgressListener(progressListener, user, getFile());
|
|
|
|
|
|
+
|
|
|
|
+ if (containerActivity.getFileUploaderHelper() != null) {
|
|
|
|
+ OCFile file = getFile();
|
|
|
|
+ if (user == null || file == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String targetKey = FileUploadHelper.Companion.buildRemoteName(user.getAccountName(), file.getRemotePath());
|
|
|
|
+ containerActivity.getFileUploaderHelper().addUploadTransferProgressListener(progressListener, targetKey);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
Log_OC.d(TAG, "progressListener == null");
|
|
Log_OC.d(TAG, "progressListener == null");
|
|
@@ -713,9 +717,15 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
|
|
containerActivity.getFileDownloadProgressListener().
|
|
containerActivity.getFileDownloadProgressListener().
|
|
removeDataTransferProgressListener(progressListener, getFile());
|
|
removeDataTransferProgressListener(progressListener, getFile());
|
|
}
|
|
}
|
|
- if (containerActivity.getFileUploaderBinder() != null) {
|
|
|
|
- containerActivity.getFileUploaderBinder().
|
|
|
|
- removeDatatransferProgressListener(progressListener, user, getFile());
|
|
|
|
|
|
+ if (containerActivity.getFileUploaderHelper() != null) {
|
|
|
|
+ OCFile file = getFile();
|
|
|
|
+
|
|
|
|
+ if (user == null || file == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String targetKey = FileUploadHelper.Companion.buildRemoteName(user.getAccountName(), file.getRemotePath());
|
|
|
|
+ containerActivity.getFileUploaderHelper().removeUploadTransferProgressListener(progressListener, targetKey);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|