diff --git a/res/layout/share_file_layout.xml b/res/layout/share_file_layout.xml
index b2fe3f6a62..b6910ddafe 100644
--- a/res/layout/share_file_layout.xml
+++ b/res/layout/share_file_layout.xml
@@ -190,6 +190,40 @@
+
+
+
+
+
+
+
+
Password protect
Secured
Allow editing
+ Hide file listing
Get link
Share with …
Share with %1$s
diff --git a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java
index a0e3086cb6..24eeb2e391 100644
--- a/src/com/owncloud/android/ui/fragment/ShareFileFragment.java
+++ b/src/com/owncloud/android/ui/fragment/ShareFileFragment.java
@@ -674,6 +674,7 @@ public class ShareFileFragment extends Fragment
getPasswordSection().setVisibility(View.VISIBLE);
if (mFile.isFolder() && !mCapabilities.getFilesSharingPublicUpload().isFalse()) {
getEditPermissionSection().setVisibility(View.VISIBLE);
+ getFileListingPermissionSection().setVisibility(View.VISIBLE);
} else {
getEditPermissionSection().setVisibility(View.GONE);
}
@@ -754,6 +755,26 @@ public class ShareFileFragment extends Fragment
mOnEditPermissionInteractionListener
);
+ /// update state of the hide file listing permission switch
+ SwitchCompat hideFileListingPermissionSwitch = getHideFileListingPermissionSwitch();
+
+ // set null listener before setChecked() to prevent infinite loop of calls
+ hideFileListingPermissionSwitch.setOnCheckedChangeListener(null);
+ if (mPublicShare.getPermissions() > OCShare.READ_PERMISSION_FLAG) {
+ if (!hideFileListingPermissionSwitch.isChecked()) {
+ hideFileListingPermissionSwitch.toggle();
+ }
+ } else {
+ if (hideFileListingPermissionSwitch.isChecked()) {
+ hideFileListingPermissionSwitch.toggle();
+ }
+ }
+ // recover listener
+ // TODO Tobi
+// hideFileListingPermissionSwitch.setOnCheckedChangeListener(
+// mOnEditPermissionInteractionListener
+// );
+
} else {
/// no public share -> collapse section
SwitchCompat shareViaLinkSwitch = getShareViaLinkSwitch();
@@ -810,6 +831,14 @@ public class ShareFileFragment extends Fragment
return (SwitchCompat) getView().findViewById(R.id.shareViaLinkEditPermissionSwitch);
}
+ private View getFileListingPermissionSection() {
+ return getView().findViewById(R.id.shareViaLinkHideListPermissionSection);
+ }
+
+ private SwitchCompat getHideFileListingPermissionSwitch() {
+ return (SwitchCompat) getView().findViewById(R.id.shareViaLinkHideListPermissionSwitch);
+ }
+
private AppCompatButton getGetLinkButton() {
return (AppCompatButton) getView().findViewById(R.id.shareViaLinkGetLinkButton);
}