From 19cf573db0abc90b221ba912a94dbab33a9e3391 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Tue, 3 Nov 2015 17:07:34 +0100 Subject: [PATCH] Unshare public link in ShareFileFragment --- src/com/owncloud/android/files/FileOperationsHelper.java | 9 +++++++-- .../owncloud/android/ui/fragment/FileDetailFragment.java | 2 +- .../owncloud/android/ui/fragment/OCFileListFragment.java | 2 +- .../owncloud/android/ui/fragment/ShareFileFragment.java | 6 +----- .../android/ui/preview/PreviewImageFragment.java | 2 +- .../android/ui/preview/PreviewMediaFragment.java | 2 +- .../owncloud/android/ui/preview/PreviewTextFragment.java | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/com/owncloud/android/files/FileOperationsHelper.java b/src/com/owncloud/android/files/FileOperationsHelper.java index 80f59643ae..ccbcf07df4 100644 --- a/src/com/owncloud/android/files/FileOperationsHelper.java +++ b/src/com/owncloud/android/files/FileOperationsHelper.java @@ -141,7 +141,6 @@ public class FileOperationsHelper { /** - /** * Helper method to share a file via a public link. Starts a request to do it in {@link OperationsService} * * @param file The file to share. @@ -268,7 +267,13 @@ public class FileOperationsHelper { } - public void unshareFileWithLink(OCFile file) { + /** + * Helper method to unshare a file publicly shared via link. + * Starts a request to do it in {@link OperationsService} + * + * @param file The file to unshare. + */ + public void unshareFileViaLink(OCFile file) { // Unshare the file: Create the intent Intent unshareService = new Intent(mFileActivity, OperationsService.class); diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java index 4b07b3bc8b..e656d5c89c 100644 --- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -235,7 +235,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener return true; } case R.id.action_unshare_file: { - mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile()); + mContainerActivity.getFileOperationsHelper().unshareFileViaLink(getFile()); return true; } diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java index f195f06eaf..94484fbace 100644 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -356,7 +356,7 @@ public class OCFileListFragment extends ExtendedListFragment return true; } case R.id.action_unshare_file: { - mContainerActivity.getFileOperationsHelper().unshareFileWithLink(mTargetFile); + mContainerActivity.getFileOperationsHelper().unshareFileViaLink(mTargetFile); return true; } case R.id.action_rename_file: { diff --git a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java index 16994de863..db1e98d36f 100644 --- a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java +++ b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java @@ -186,11 +186,7 @@ public class ShareFileFragment extends Fragment ((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaLink(mFile); } else { - // TODO real implementation: unshare - // collapse section - getExpirationDateSection().setVisibility(View.GONE); - getPasswordSection().setVisibility(View.GONE); - getGetLinkButton().setVisibility(View.GONE); + ((FileActivity) getActivity()).getFileOperationsHelper().unshareFileViaLink(mFile); } } // else, nothing; very important, setCheched(...) is called automatically during Fragment // recreation on device rotations diff --git a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java index ec1e3daa56..938c444420 100644 --- a/src/com/owncloud/android/ui/preview/PreviewImageFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewImageFragment.java @@ -294,7 +294,7 @@ public class PreviewImageFragment extends FileFragment { return true; } case R.id.action_unshare_file: { - mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile()); + mContainerActivity.getFileOperationsHelper().unshareFileViaLink(getFile()); return true; } case R.id.action_open_file_with: { diff --git a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java index ae045f19e3..53ec2bcd0a 100644 --- a/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -359,7 +359,7 @@ public class PreviewMediaFragment extends FileFragment implements } case R.id.action_unshare_file: { stopPreview(false); - mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile()); + mContainerActivity.getFileOperationsHelper().unshareFileViaLink(getFile()); return true; } case R.id.action_open_file_with: { diff --git a/src/com/owncloud/android/ui/preview/PreviewTextFragment.java b/src/com/owncloud/android/ui/preview/PreviewTextFragment.java index 8038f331be..1e671333c7 100644 --- a/src/com/owncloud/android/ui/preview/PreviewTextFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewTextFragment.java @@ -307,7 +307,7 @@ public class PreviewTextFragment extends FileFragment { return true; } case R.id.action_unshare_file: { - mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile()); + mContainerActivity.getFileOperationsHelper().unshareFileViaLink(getFile()); return true; } case R.id.action_open_file_with: {