OC-2833: Access to unshare link from PreviewImageFragment

This commit is contained in:
masensio 2014-02-05 17:32:29 +01:00
parent 6951154b11
commit de29fd38ce
3 changed files with 38 additions and 17 deletions

@ -1 +1 @@
Subproject commit 984cbbc124441f6dd9d5c53f5e7989be1593176f
Subproject commit f166bcdd8b52a64c3ad0c8725ed64ba768c1eeb5

View file

@ -246,6 +246,22 @@ public class PreviewImageFragment extends FileFragment implements OnRemoteOper
}
/**
* {@inheritDoc}
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// Options shareLink
if (!getFile().isShareByLink()) {
MenuItem item = menu.findItem(R.id.action_unshare_file);
item.setVisible(false);
item.setEnabled(false);
}
}
/**
* {@inheritDoc}
@ -258,6 +274,11 @@ public class PreviewImageFragment extends FileFragment implements OnRemoteOper
act.getFileOperationsHelper().shareFileWithLink(getFile(), act);
return true;
}
case R.id.action_unshare_file: {
FileActivity act = (FileActivity)getSherlockActivity();
act.getFileOperationsHelper().unshareFileWithLink(getFile(), act);
return true;
}
case R.id.action_open_file_with: {
openFile();
return true;
@ -277,14 +298,6 @@ public class PreviewImageFragment extends FileFragment implements OnRemoteOper
}
/**
* {@inheritDoc}
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
}
private void seeDetails() {
((FileFragment.ContainerActivity)getActivity()).showDetails(getFile());

View file

@ -305,6 +305,22 @@ public class PreviewMediaFragment extends FileFragment implements
}
/**
* {@inheritDoc}
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// Options shareLink
if (!getFile().isShareByLink()) {
MenuItem item = menu.findItem(R.id.action_unshare_file);
item.setVisible(false);
item.setEnabled(false);
}
}
/**
* {@inheritDoc}
@ -340,14 +356,6 @@ public class PreviewMediaFragment extends FileFragment implements
/**
* {@inheritDoc}
*/
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
}
private void unshareFileWithLink() {
stopPreview(false);
FileActivity activity = (FileActivity)((FileFragment.ContainerActivity)getActivity());