+ boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
+ if (shareWithUsersEnable) {
+ // Show Search Fragment
+ mListener.showSearchUsersAndGroups();
+ } else {
+ String message = getString(R.string.share_sharee_unavailable);
+ Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
+ }
+ }
+ });
+
+ // Switch to create public share
+ mOnShareViaLinkSwitchCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isResumed()) {
+ if (isChecked) {
+ ((FileActivity) getActivity()).getFileOperationsHelper().shareFileViaLink(mFile);
+
+ } else {
+ ((FileActivity) getActivity()).getFileOperationsHelper().unshareFileViaLink(mFile);
+ }
+ } // else, nothing; very important, setCheched(...) is called automatically during Fragment
+ // recreation on device rotations
+ }
+ };
+ Switch shareViaLinkSwitch = (Switch) view.findViewById(R.id.shareViaLinkSectionSwitch);
+ shareViaLinkSwitch.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener);
+
+ // Switch for expiration date
+ Switch shareViaLinkExpirationSwitch = (Switch) view.findViewById(R.id.shareViaLinkExpirationSwitch);
+ shareViaLinkExpirationSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ // TODO real implementation: update share with expiration date
+ // show value of expiration date
+ getExpirationDateValue().setText(R.string.placeholder_timestamp);
+
+ } else {
+ // TODO real implementation: update share without expiration date
+ // empty value
+ getExpirationDateValue().setText(R.string.empty);
+ }