- /* ownCloud Android client application
- * Copyright (C) 2014 ownCloud Inc.
+ /**
+ * ownCloud Android client application
+ *
+ * @author masensio
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
/**
* Creates a new share from a given file
- *
- * @author masensio
- *
*/
import android.content.Context;
RemoteOperationResult result = ((GetRemoteSharesForFileOperation)operation).execute(client);
if (!result.isSuccess() || result.getData().size() <= 0) {
- operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, mPassword, mPermissions);
+ operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload,
+ mPassword, mPermissions);
result = ((CreateRemoteShareOperation)operation).execute(client);
}
- /* ownCloud Android client application
- * Copyright (C) 2012-2014 ownCloud Inc.
+ /**
+ * ownCloud Android client application
+ *
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
Intent sendIntent = operationIntent.getParcelableExtra(EXTRA_SEND_INTENT);
if (remotePath.length() > 0) {
- operation = new CreateShareOperation(OperationsService.this, remotePath, ShareType.PUBLIC_LINK,
+ operation = new CreateShareOperation(OperationsService.this, remotePath,
+ ShareType.PUBLIC_LINK,
"", false, "", 1, sendIntent);
}
- /* ownCloud Android client application
+ /**
+ * ownCloud Android client application
+ *
+ * @author David A. Velasco
* Copyright (C) 2011 Bartek Przybylski
- * Copyright (C) 2012-2015 ownCloud Inc.
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import com.owncloud.android.operations.UnshareLinkOperation;
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
+import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.ui.dialog.LoadingDialog;
+import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
import com.owncloud.android.utils.ErrorMessageAdapter;
/**
* Activity with common behaviour for activities handling {@link OCFile}s in ownCloud {@link Account}s .
- *
- * @author David A. Velasco
*/
public class FileActivity extends SherlockFragmentActivity
implements OnRemoteOperationListener, ComponentsGetter {
private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
private static final String KEY_WAITING_FOR_OP_ID = "WAITING_FOR_OP_ID";
+ private static final String DIALOG_SHARE_PASSWORD = "DIALOG_SHARE_PASSWORD";
protected static final long DELAY_TO_REQUEST_OPERATION_ON_ACTIVITY_RESULTS = 200;
* a new ownCloud {@link Account} finished, successfully or not.
*
* At this moment, only called after the creation of the first account.
- *
- * @author David A. Velasco
*/
public class AccountCreationCallback implements AccountManagerCallback<Bundle> {
Intent sendIntent = operation.getSendIntent();
startActivity(sendIntent);
- } else {
- Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
- Toast.LENGTH_LONG);
- t.show();
+ } else {
+ // TODO Detect Failure (403) --> needs Password
+ if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
+ SharePasswordDialogFragment dialog =
+ SharePasswordDialogFragment.newInstance(getFile());
+ dialog.show(getSupportFragmentManager(), DIALOG_SHARE_PASSWORD);
+ } else {
+ Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
+ Toast.LENGTH_LONG);
+ t.show();
+ }
}
}