use of com.owncloud.android.files.services.FileUploader.FileUploaderBinder in project android by nextcloud.
the class FileOperationsHelper method cancelTransference.
/**
* Cancel the transference in downloads (files/folders) and file uploads
*
* @param file OCFile
*/
public void cancelTransference(OCFile file) {
Account account = mFileActivity.getAccount();
if (file.isFolder()) {
OperationsService.OperationsServiceBinder opsBinder = mFileActivity.getOperationsServiceBinder();
if (opsBinder != null) {
opsBinder.cancel(account, file);
}
}
// for both files and folders
FileDownloaderBinder downloaderBinder = mFileActivity.getFileDownloaderBinder();
if (downloaderBinder != null && downloaderBinder.isDownloading(account, file)) {
downloaderBinder.cancel(account, file);
}
FileUploaderBinder uploaderBinder = mFileActivity.getFileUploaderBinder();
if (uploaderBinder != null && uploaderBinder.isUploading(account, file)) {
uploaderBinder.cancel(account, file);
}
}
use of com.owncloud.android.files.services.FileUploader.FileUploaderBinder in project android by nextcloud.
the class FileMenuFilter method anyFileSynchronizing.
private boolean anyFileSynchronizing() {
boolean synchronizing = false;
if (mComponentsGetter != null && !mFiles.isEmpty() && mAccount != null) {
OperationsServiceBinder opsBinder = mComponentsGetter.getOperationsServiceBinder();
FileUploaderBinder uploaderBinder = mComponentsGetter.getFileUploaderBinder();
FileDownloaderBinder downloaderBinder = mComponentsGetter.getFileDownloaderBinder();
synchronizing = (// comparing local and remote
anyFileSynchronizing(opsBinder) || anyFileDownloading(downloaderBinder) || anyFileUploading(uploaderBinder));
}
return synchronizing;
}
use of com.owncloud.android.files.services.FileUploader.FileUploaderBinder in project android by owncloud.
the class FileDetailFragment method setButtonsForTransferring.
/**
* Enables or disables buttons for a file being downloaded
*/
private void setButtonsForTransferring() {
if (!isEmpty()) {
// show the progress bar for the transfer
getView().findViewById(R.id.fdProgressBlock).setVisibility(View.VISIBLE);
TextView progressText = getView().findViewById(R.id.fdProgressText);
progressText.setVisibility(View.VISIBLE);
FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
// if (getFile().isDownloading()) {
if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, getFile())) {
progressText.setText(R.string.downloader_download_in_progress_ticker);
} else {
if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, getFile())) {
progressText.setText(R.string.uploader_upload_in_progress_ticker);
}
}
}
}
use of com.owncloud.android.files.services.FileUploader.FileUploaderBinder in project android by owncloud.
the class FileDetailFragment method updateFileDetails.
/**
* Updates the view with all relevant details about that file.
*
* @param forcedTransferring Flag signaling if the file should be considered as downloading or uploading,
* although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and
* {@link FileUploaderBinder#isUploading(Account, OCFile)} return false.
* @param refresh If 'true', try to refresh the whole file from the database
*/
private void updateFileDetails(boolean forcedTransferring, boolean refresh) {
if (readyToShow()) {
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
if (refresh && storageManager != null) {
setFile(storageManager.getFileByPath(getFile().getRemotePath()));
}
OCFile file = getFile();
// set file details
setFilename(file.getFileName());
setFiletype(file);
setFilesize(file.getFileLength());
setTimeModified(file.getModificationTimestamp());
// configure UI for depending upon local state of the file
FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
if (forcedTransferring || (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) || (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file))) {
setButtonsForTransferring();
} else if (file.isDown()) {
setButtonsForDown();
} else {
// TODO load default preview image; when the local file is removed, the preview
// remains there
setButtonsForRemote();
}
}
getView().invalidate();
}
Aggregations