*
*/
+import android.content.Context;
import android.content.Intent;
+import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
protected FileDataStorageManager mStorageManager;
+ private Context mContext;
private String mPath;
private ShareType mShareType;
private String mShareWith;
/**
* Constructor
+ * @param context The context that the share is coming from.
* @param path Full path of the file/folder being shared. Mandatory argument
* @param shareType 0 = user, 1 = group, 3 = Public link. Mandatory argument
* @param shareWith User/group ID with who the file should be shared. This is mandatory for shareType of 0 or 1
* To obtain combinations, add the desired values together.
* For instance, for Re-Share, delete, read, update, add 16+8+2+1 = 27.
*/
- public CreateShareOperation(String path, ShareType shareType, String shareWith, boolean publicUpload,
+ public CreateShareOperation(Context context, String path, ShareType shareType, String shareWith, boolean publicUpload,
String password, int permissions, Intent sendIntent) {
+ mContext = context;
mPath = path;
mShareType = shareType;
mShareWith = shareWith;
OCFile file = getStorageManager().getFileByPath(mPath);
if (file!=null) {
mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
- mSendIntent.putExtra(Intent.EXTRA_SUBJECT,
- getClient().getCredentials().getUsername() + " shared >>" + file.getFileName() + "<< with you");
+ mSendIntent.putExtra(Intent.EXTRA_SUBJECT, getClient().getCredentials().getUsername() + " " +
+ mContext.getString(R.string.shared_subject_header) + " >>" + file.getFileName() + "<< " +
+ mContext.getString(R.string.with_you_subject_header));
file.setPublicLink(share.getShareLink());
file.setShareByLink(true);
getStorageManager().saveFile(file);
String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
Intent sendIntent = operationIntent.getParcelableExtra(EXTRA_SEND_INTENT);
if (remotePath.length() > 0) {
- operation = new CreateShareOperation(remotePath, ShareType.PUBLIC_LINK,
+ operation = new CreateShareOperation(getApplicationContext(), remotePath, ShareType.PUBLIC_LINK,
"", false, "", 1, sendIntent);
}