|
@@ -247,6 +247,10 @@ public class ShareFileFragment extends Fragment
|
|
// Set listener for user actions on edit permission
|
|
// Set listener for user actions on edit permission
|
|
initEditPermissionListener(view);
|
|
initEditPermissionListener(view);
|
|
|
|
|
|
|
|
+ // Set listener for hide file listing
|
|
|
|
+ // TODO only if "allow editing" is true
|
|
|
|
+ initHideFileListingListener(view);
|
|
|
|
+
|
|
// Hide share features sections that are not enabled
|
|
// Hide share features sections that are not enabled
|
|
hideNotEnabledShareSections(view);
|
|
hideNotEnabledShareSections(view);
|
|
|
|
|
|
@@ -479,6 +483,21 @@ public class ShareFileFragment extends Fragment
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Binds listener for user actions that start any update the hide file listing permissions
|
|
|
|
+ * for the public link to the views receiving the user events.
|
|
|
|
+ *
|
|
|
|
+ * @param shareView Root view in the fragment.
|
|
|
|
+ */
|
|
|
|
+ private void initHideFileListingListener(View shareView) {
|
|
|
|
+ mOnHideFileListingPermissionInteractionListener =
|
|
|
|
+ new OnHideFileListingPermissionInteractionListener();
|
|
|
|
+
|
|
|
|
+ ((SwitchCompat) shareView.findViewById(R.id.shareViaLinkHideListPermissionSwitch)).
|
|
|
|
+ setOnCheckedChangeListener(mOnHideFileListingPermissionInteractionListener);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Listener for user actions that start any update on the edit permissions for the public link.
|
|
* Listener for user actions that start any update on the edit permissions for the public link.
|
|
*/
|
|
*/
|
|
@@ -799,15 +818,20 @@ public class ShareFileFragment extends Fragment
|
|
|
|
|
|
// set null listener before setChecked() to prevent infinite loop of calls
|
|
// set null listener before setChecked() to prevent infinite loop of calls
|
|
hideFileListingPermissionSwitch.setOnCheckedChangeListener(null);
|
|
hideFileListingPermissionSwitch.setOnCheckedChangeListener(null);
|
|
- if (mPublicShare.getPermissions() > OCShare.READ_PERMISSION_FLAG) {
|
|
|
|
- if (!hideFileListingPermissionSwitch.isChecked()) {
|
|
|
|
- hideFileListingPermissionSwitch.toggle();
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (hideFileListingPermissionSwitch.isChecked()) {
|
|
|
|
- hideFileListingPermissionSwitch.toggle();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ boolean readOnly = (mPublicShare.getPermissions() & OCShare.READ_PERMISSION_FLAG) != 0;
|
|
|
|
+ hideFileListingPermissionSwitch.setChecked(!readOnly);
|
|
|
|
+
|
|
|
|
+// if ((mPublicShare.getPermissions() & OCShare.READ_PERMISSION_FLAG) != 0) {
|
|
|
|
+// if (!hideFileListingPermissionSwitch.isChecked()) {
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// } else {
|
|
|
|
+// if (hideFileListingPermissionSwitch.isChecked()) {
|
|
|
|
+// hideFileListingPermissionSwitch.toggle();
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+
|
|
// recover listener
|
|
// recover listener
|
|
hideFileListingPermissionSwitch.setOnCheckedChangeListener(
|
|
hideFileListingPermissionSwitch.setOnCheckedChangeListener(
|
|
mOnHideFileListingPermissionInteractionListener
|
|
mOnHideFileListingPermissionInteractionListener
|