+ // GetLink button
+ AppCompatButton getLinkButton = getGetLinkButton();
+ getLinkButton.setVisibility(View.VISIBLE);
+ getLinkButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //GetLink from the server and show ShareLinkToDialog
+ ((FileActivity) getActivity()).getFileOperationsHelper().
+ getFileWithLink(mFile);
+
+ }
+ });
+
+ /// update state of expiration date switch and message depending on expiration date
+ Switch expirationDateSwitch = getExpirationDateSwitch();
+ // set null listener before setChecked() to prevent infinite loop of calls
+ expirationDateSwitch.setOnCheckedChangeListener(null);
+ long expirationDate = mPublicShare.getExpirationDate();
+ if (expirationDate > 0) {
+ if (!expirationDateSwitch.isChecked()) {
+ expirationDateSwitch.toggle();
+ }
+ String formattedDate =
+ SimpleDateFormat.getDateInstance().format(
+ new Date(expirationDate)
+ );
+ getExpirationDateValue().setText(formattedDate);
+ } else {
+ if (expirationDateSwitch.isChecked()) {
+ expirationDateSwitch.toggle();
+ }
+ getExpirationDateValue().setText(R.string.empty);
+ }
+ // recover listener
+ expirationDateSwitch.setOnCheckedChangeListener(
+ mOnExpirationDateInteractionListener
+ );
+
+ /// update state of password switch and message depending on password protection
+ Switch passwordSwitch = getPasswordSwitch();
+ // set null listener before setChecked() to prevent infinite loop of calls
+ passwordSwitch.setOnCheckedChangeListener(null);
+ if (mPublicShare.isPasswordProtected()) {
+ if (!passwordSwitch.isChecked()) {
+ passwordSwitch.toggle();
+ }
+ getPasswordValue().setVisibility(View.VISIBLE);
+ } else {
+ if (passwordSwitch.isChecked()) {
+ passwordSwitch.toggle();
+ }
+ getPasswordValue().setVisibility(View.INVISIBLE);
+ }
+ // recover listener
+ passwordSwitch.setOnCheckedChangeListener(
+ mOnPasswordInteractionListener
+ );
+