super.onActivityCreated(savedInstanceState);
if (mAccount != null) {
mStorageManager = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver());
+ OCFile file = mStorageManager.getFileByPath(getFile().getRemotePath());
+ if (file != null) {
+ setFile(file);
+ }
}
}
// Options shareLink
if (!file.isShareByLink()) {
toHide.add(R.id.action_unshare_file);
+ } else {
+ toShow.add(R.id.action_unshare_file);
}
MenuItem item = null;
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
+ case R.id.action_share_file: {
+ FileDisplayActivity activity = (FileDisplayActivity) getSherlockActivity();
+ activity.getFileOperationsHelper().shareFileWithLink(getFile(), activity);
+ return true;
+ }
+ case R.id.action_unshare_file: {
+ FileDisplayActivity activity = (FileDisplayActivity) getSherlockActivity();
+ activity.getFileOperationsHelper().unshareFileWithLink(getFile(), activity);
+ return true;
+ }
case R.id.action_open_file_with: {
- mContainerActivity.openFile(getFile());
+ FileDisplayActivity activity = (FileDisplayActivity) getSherlockActivity();
+ activity.getFileOperationsHelper().openFile(getFile(), activity);
return true;
}
case R.id.action_remove_file: {
synchronizeFile();
return true;
}
+ case R.id.action_send_file: {
+ FileDisplayActivity activity = (FileDisplayActivity) getSherlockActivity();
+ // Obtain the file
+ if (!getFile().isDown()) { // Download the file
+ //activity.showLoadingDialog();
+ Log_OC.d(TAG, getFile().getRemotePath() + " : File must be downloaded");
+ activity.startDownloadForSending(getFile());
+
+ } else {
+ activity.getFileOperationsHelper().sendDownloadedFile(getFile(), activity);
+ }
+ return true;
+ }
default:
return false;
}
}
-
+
@Override
public void onClick(View v) {
switch (v.getId()) {
}
}
-
private void removeFile() {
OCFile file = getFile();
ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(