+
+ /*
+ public void shareFileWithLink(OCFile file) {
+ if (file != null) {
+
+ Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
+ intentToShareLink.putExtra(Intent.EXTRA_TEXT, "https://fake.url.lolo");
+ intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE);
+
+ Intent chooserIntent = Intent.createChooser(intentToShareLink, getString(R.string.action_share_file));
+ startActivity(chooserIntent);
+
+ } else {
+ Log_OC.wtf(TAG, "Trying to open a NULL OCFile");
+ }
+ }
+ */
+
+ public void shareFileWithLink(OCFile file) {
+ if (isSharedSupported()) {
+ if (file != null) {
+
+ // Create the Share - TODO integrate before or after the chooser menu
+ //CreateShareOperation createShare = new CreateShareOperation(file.getRemotePath(), ShareType.PUBLIC_LINK, "", false, "", 1);
+ //createShare.execute(getStorageManager(), this, this, mHandler, this);
+
+ // TODO Get the link --> when the operation is finished
+ String link = "https://fake.url.lolo";
+
+ Intent intent = createShareWithLinkIntent(link);
+ String[] packagesToExclude = new String[] { getPackageName() };
+ DialogFragment chooserDialog = ActivityChooserDialog.newInstance(intent, packagesToExclude);
+ chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
+
+ } else {
+ Log_OC.wtf(TAG, "Trying to open a NULL OCFile");
+ }
+
+ } else {
+ // Show a Message
+ Toast t = Toast.makeText(this, getString(R.string.share_link_no_support_share_api), Toast.LENGTH_LONG);
+ t.show();
+ }
+ }
+
+ private Intent createShareWithLinkIntent(String link) {
+ Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
+ intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
+ intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE);
+ return intentToShareLink;
+ }
+