This commit is contained in:
tobiasKaminsky 2016-07-18 17:27:38 +02:00 committed by Andy Scherzinger
parent 69c801206c
commit 1ace509e4f
3 changed files with 64 additions and 0 deletions

View file

@ -190,6 +190,40 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/shareViaLinkHideListPermissionSection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_marginBottom="@dimen/standard_half_margin"
>
<android.support.v7.widget.SwitchCompat
android:id="@+id/shareViaLinkHideListPermissionSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:padding="@dimen/standard_half_padding"
/>
<TextView
android:id="@+id/shareViaLinkHideListPermissionLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@id/shareViaLinkHideListPermissionSwitch"
android:layout_toStartOf="@id/shareViaLinkHideListPermissionSwitch"
android:padding="@dimen/standard_half_padding"
android:text="@string/share_via_link_hide_file_listing_permission_label"
android:textColor="@color/black"
android:textSize="14sp"
/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/shareViaLinkPasswordSection" android:id="@+id/shareViaLinkPasswordSection"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -424,6 +424,7 @@
<string name="share_via_link_password_label">Password protect</string> <string name="share_via_link_password_label">Password protect</string>
<string name="share_via_link_password_title">Secured</string> <string name="share_via_link_password_title">Secured</string>
<string name="share_via_link_edit_permission_label">Allow editing</string> <string name="share_via_link_edit_permission_label">Allow editing</string>
<string name="share_via_link_hide_file_listing_permission_label">Hide file listing</string>
<string name="share_get_public_link_button">Get link</string> <string name="share_get_public_link_button">Get link</string>
<string name="share_with_title">Share with &#8230;</string> <string name="share_with_title">Share with &#8230;</string>
<string name="share_with_edit_title">Share with %1$s</string> <string name="share_with_edit_title">Share with %1$s</string>

View file

@ -674,6 +674,7 @@ public class ShareFileFragment extends Fragment
getPasswordSection().setVisibility(View.VISIBLE); getPasswordSection().setVisibility(View.VISIBLE);
if (mFile.isFolder() && !mCapabilities.getFilesSharingPublicUpload().isFalse()) { if (mFile.isFolder() && !mCapabilities.getFilesSharingPublicUpload().isFalse()) {
getEditPermissionSection().setVisibility(View.VISIBLE); getEditPermissionSection().setVisibility(View.VISIBLE);
getFileListingPermissionSection().setVisibility(View.VISIBLE);
} else { } else {
getEditPermissionSection().setVisibility(View.GONE); getEditPermissionSection().setVisibility(View.GONE);
} }
@ -754,6 +755,26 @@ public class ShareFileFragment extends Fragment
mOnEditPermissionInteractionListener 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 { } else {
/// no public share -> collapse section /// no public share -> collapse section
SwitchCompat shareViaLinkSwitch = getShareViaLinkSwitch(); SwitchCompat shareViaLinkSwitch = getShareViaLinkSwitch();
@ -810,6 +831,14 @@ public class ShareFileFragment extends Fragment
return (SwitchCompat) getView().findViewById(R.id.shareViaLinkEditPermissionSwitch); 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() { private AppCompatButton getGetLinkButton() {
return (AppCompatButton) getView().findViewById(R.id.shareViaLinkGetLinkButton); return (AppCompatButton) getView().findViewById(R.id.shareViaLinkGetLinkButton);
} }