MenuItem item = menu.findItem(R.id.action_unshare_file);
// Options shareLink
- if (!getFile().isShareByLink()) {
+ OCFile file = ((FileActivity) getSherlockActivity()).getFile();
+ if (!file.isShareByLink()) {
item.setVisible(false);
item.setEnabled(false);
} else {
seeDetails();
return true;
}
+ case R.id.action_send_file: {
+ shareFile();
+ return true;
+ }
default:
return false;
}
}
+
+ private void shareFile(){
+ Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
+ // set MimeType
+ sharingIntent.setType(getFile().getMimetype());
+ sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+getFile().getStoragePath()));
+ startActivity(Intent.createChooser(sharingIntent, "Share via"));
+ }