Search in sources :

Example 6 with TransferRequester

use of com.owncloud.android.files.services.TransferRequester in project android by owncloud.

the class UploadListActivity method onRemoteOperationFinish.

/**
 * @param operation Operation performed.
 * @param result    Result of the removal.
 */
@Override
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
    if (operation instanceof CheckCurrentCredentialsOperation) {
        // Do not call super in this case; more refactoring needed around onRemoteOperationFinish :'(
        getFileOperationsHelper().setOpIdWaitingFor(Long.MAX_VALUE);
        dismissLoadingDialog();
        Account account = ((RemoteOperationResult<Account>) result).getData();
        if (!result.isSuccess()) {
            requestCredentialsUpdate();
        } else {
            // already updated -> just retry!
            TransferRequester requester = new TransferRequester();
            requester.retryFailedUploads(this, account, UploadResult.CREDENTIAL_ERROR, false);
        }
    } else {
        super.onRemoteOperationFinish(operation, result);
    }
}
Also used : Account(android.accounts.Account) TransferRequester(com.owncloud.android.files.services.TransferRequester) RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) CheckCurrentCredentialsOperation(com.owncloud.android.operations.CheckCurrentCredentialsOperation)

Example 7 with TransferRequester

use of com.owncloud.android.files.services.TransferRequester in project android by owncloud.

the class ConflictsResolveActivity method conflictDecisionMade.

@Override
public void conflictDecisionMade(Decision decision) {
    Integer behaviour = null;
    Boolean forceOverwrite = null;
    switch(decision) {
        case CANCEL:
            finish();
            return;
        case OVERWRITE:
            // use local version -> overwrite on server
            forceOverwrite = true;
            break;
        case KEEP_BOTH:
            behaviour = FileUploader.LOCAL_BEHAVIOUR_MOVE;
            break;
        case SERVER:
            // use server version -> delete local, request download
            Intent intent = new Intent(this, FileDownloader.class);
            intent.putExtra(FileDownloader.KEY_ACCOUNT, getAccount());
            intent.putExtra(FileDownloader.KEY_FILE, getFile());
            startService(intent);
            finish();
            return;
        default:
            Timber.e("Unhandled conflict decision %s", decision);
            return;
    }
    TransferRequester requester = new TransferRequester();
    requester.uploadUpdate(this, getAccount(), getFile(), behaviour, forceOverwrite, false);
    finish();
}
Also used : TransferRequester(com.owncloud.android.files.services.TransferRequester) Intent(android.content.Intent)

Example 8 with TransferRequester

use of com.owncloud.android.files.services.TransferRequester in project android by owncloud.

the class CopyAndUploadContentUrisTask method requestUpload.

private void requestUpload(Account account, String localPath, String remotePath, int behaviour, String mimeType) {
    TransferRequester requester = new TransferRequester();
    requester.uploadNewFile(mAppContext, account, localPath, remotePath, behaviour, mimeType, // do not create parent folder if not existent
    false, UploadFileOperation.CREATED_BY_USER);
}
Also used : TransferRequester(com.owncloud.android.files.services.TransferRequester)

Aggregations

TransferRequester (com.owncloud.android.files.services.TransferRequester)8 Account (android.accounts.Account)3 UploadsStorageManager (com.owncloud.android.datamodel.UploadsStorageManager)2 Context (android.content.Context)1 Intent (android.content.Intent)1 DataSetObserver (android.database.DataSetObserver)1 Bitmap (android.graphics.Bitmap)1 Uri (android.net.Uri)1 DateUtils (android.text.format.DateUtils)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 ViewGroup (android.view.ViewGroup)1 BaseExpandableListAdapter (android.widget.BaseExpandableListAdapter)1 ExpandableListView (android.widget.ExpandableListView)1 ImageButton (android.widget.ImageButton)1 ImageView (android.widget.ImageView)1 ProgressBar (android.widget.ProgressBar)1 TextView (android.widget.TextView)1 AppCompatButton (androidx.appcompat.widget.AppCompatButton)1