- public void shareFileWithLink(OCFile file) {
- if (file != null) {
-
- //CreateShareOperation createShare = new CreateShareOperation(file.getRemotePath(), ShareType.PUBLIC_LINK, "", false, "", 1);
- //createShare.execute(getAccount(), this, this, mHandler, this);
-
- String link = "https://fake.url.lolo";
- Intent chooserIntent = null;
- List<Intent> targetedShareIntents = new ArrayList<Intent>();
- List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(createShareWithLinkIntent(link), PackageManager.MATCH_DEFAULT_ONLY);
- String myPackageName = getPackageName();
- if (!resInfo.isEmpty()) {
- for (ResolveInfo info : resInfo) {
- if (!info.activityInfo.packageName.equalsIgnoreCase(myPackageName)) {
- Intent targetedShare = createTargetedShare(link, info.activityInfo.applicationInfo.packageName, info.activityInfo.name);
- targetedShareIntents.add(targetedShare);
- }
- }
- }
- if (targetedShareIntents.size() > 0) {
- Intent firstTargeted = targetedShareIntents.remove(0);
- chooserIntent = Intent.createChooser(firstTargeted, getString(R.string.action_share_file));
- chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[] {}));
- } else {
- // to show standard message
- chooserIntent = Intent.createChooser(null, getString(R.string.action_share_file));
- }
- startActivity(chooserIntent);
+ public FileOperationsHelper getFileOperationsHelper() {
+ return mFileOperationsHelper;
+ }
+
+ /**
+ *
+ * @param operation Removal operation performed.
+ * @param result Result of the removal.
+ */
+ @Override
+ public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+ Log_OC.d(TAG, "Received result of operation in FileActivity - common behaviour for all the FileActivities ");
+ if (operation instanceof CreateShareOperation) {
+ onCreateShareOperationFinish((CreateShareOperation) operation, result);
+ }
+ }
+
+ private void onCreateShareOperationFinish(CreateShareOperation operation, RemoteOperationResult result) {
+ dismissLoadingDialog();
+ if (result.isSuccess()) {
+ Intent sendIntent = operation.getSendIntent();
+ startActivity(sendIntent);