X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/dcc540358d6ebb37cd6c3800e3057965426fd201..61f36d2a93063602b13e5ff6dbdeda348e90bc44:/src/com/owncloud/android/ui/fragment/FileDetailFragment.java diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 09d31c43..fb5b6a92 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -186,6 +186,10 @@ public class FileDetailFragment extends FileFragment implements super.onActivityCreated(savedInstanceState); if (mAccount != null) { mStorageManager = new FileDataStorageManager(mAccount, getActivity().getApplicationContext().getContentResolver()); + OCFile file = mStorageManager.getFileByPath(getFile().getRemotePath()); + if (file != null) { + setFile(file); + } } } @@ -314,6 +318,8 @@ public class FileDetailFragment extends FileFragment implements // Options shareLink if (!file.isShareByLink()) { toHide.add(R.id.action_unshare_file); + } else { + toShow.add(R.id.action_unshare_file); } MenuItem item = null; @@ -340,8 +346,19 @@ public class FileDetailFragment extends FileFragment implements @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: { @@ -363,7 +380,7 @@ public class FileDetailFragment extends FileFragment implements return false; } } - + @Override public void onClick(View v) { switch (v.getId()) { @@ -404,7 +421,6 @@ public class FileDetailFragment extends FileFragment implements } } - private void removeFile() { OCFile file = getFile(); ConfirmationDialogFragment confDialog = ConfirmationDialogFragment.newInstance(