|
@@ -58,6 +58,7 @@ import com.owncloud.android.ui.decoration.SimpleListItemDividerDecoration;
|
|
import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
|
|
import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
|
|
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
|
|
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
|
|
import com.owncloud.android.ui.fragment.util.FileDetailSharingFragmentHelper;
|
|
import com.owncloud.android.ui.fragment.util.FileDetailSharingFragmentHelper;
|
|
|
|
+import com.owncloud.android.ui.fragment.util.SharingMenuHelper;
|
|
import com.owncloud.android.utils.ThemeUtils;
|
|
import com.owncloud.android.utils.ThemeUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -273,18 +274,18 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|
|
|
|
|
private void prepareOptionsMenu(Menu menu) {
|
|
private void prepareOptionsMenu(Menu menu) {
|
|
Resources res = getResources();
|
|
Resources res = getResources();
|
|
- FileDetailSharingFragmentHelper.setupHideFileListingMenuItem(
|
|
|
|
- menu.findItem(R.id.action_share_link_hide_file_listing),
|
|
|
|
|
|
+ SharingMenuHelper.setupHideFileListingMenuItem(
|
|
|
|
+ menu.findItem(R.id.action_hide_file_listing),
|
|
file.isFolder(),
|
|
file.isFolder(),
|
|
shareByLinkAllowEditing.isChecked(),
|
|
shareByLinkAllowEditing.isChecked(),
|
|
publicShare.getPermissions()
|
|
publicShare.getPermissions()
|
|
);
|
|
);
|
|
- FileDetailSharingFragmentHelper.setupPasswordMenuItem(
|
|
|
|
- menu.findItem(R.id.action_share_link_password),
|
|
|
|
|
|
+ SharingMenuHelper.setupPasswordMenuItem(
|
|
|
|
+ menu.findItem(R.id.action_password),
|
|
publicShare.isPasswordProtected()
|
|
publicShare.isPasswordProtected()
|
|
);
|
|
);
|
|
- FileDetailSharingFragmentHelper.setupExpirationDateMenuItem(
|
|
|
|
- menu.findItem(R.id.action_share_link_expiration_date),
|
|
|
|
|
|
+ SharingMenuHelper.setupExpirationDateMenuItem(
|
|
|
|
+ menu.findItem(R.id.action_share_expiration_date),
|
|
publicShare.getExpirationDate(),
|
|
publicShare.getExpirationDate(),
|
|
res
|
|
res
|
|
);
|
|
);
|
|
@@ -292,28 +293,21 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|
|
|
|
|
private boolean optionsItemSelected(MenuItem item) {
|
|
private boolean optionsItemSelected(MenuItem item) {
|
|
switch (item.getItemId()) {
|
|
switch (item.getItemId()) {
|
|
- case R.id.action_share_link_hide_file_listing: {
|
|
|
|
|
|
+ case R.id.action_hide_file_listing: {
|
|
item.setChecked(!item.isChecked());
|
|
item.setChecked(!item.isChecked());
|
|
if (capabilities.getFilesFileDrop().isTrue()) {
|
|
if (capabilities.getFilesFileDrop().isTrue()) {
|
|
- ((FileActivity) getActivity()).getFileOperationsHelper().
|
|
|
|
- setHideFileListingPermissionsToShare(publicShare, item.isChecked());
|
|
|
|
|
|
+ setHideFileListingPermissionsToShare(publicShare, item.isChecked());
|
|
} else {
|
|
} else {
|
|
// not supported in ownCloud
|
|
// not supported in ownCloud
|
|
- Snackbar.make(getView(), R.string.files_drop_not_supported, Snackbar.LENGTH_LONG)
|
|
|
|
- .setAction(R.string.learn_more, v -> {
|
|
|
|
- Intent i = new Intent(Intent.ACTION_VIEW);
|
|
|
|
- i.setData(Uri.parse(getString(R.string.url_server_install)));
|
|
|
|
- startActivity(i);
|
|
|
|
- })
|
|
|
|
- .show();
|
|
|
|
|
|
+ showNotSupportedByOcMessage();
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- case R.id.action_share_link_password: {
|
|
|
|
|
|
+ case R.id.action_password: {
|
|
requestPasswordForShareViaLink(false);
|
|
requestPasswordForShareViaLink(false);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- case R.id.action_share_link_expiration_date: {
|
|
|
|
|
|
+ case R.id.action_expiration_date: {
|
|
ExpirationDatePickerDialogFragment dialog = ExpirationDatePickerDialogFragment.newInstance(file, -1);
|
|
ExpirationDatePickerDialogFragment dialog = ExpirationDatePickerDialogFragment.newInstance(file, -1);
|
|
dialog.show(
|
|
dialog.show(
|
|
getActivity().getSupportFragmentManager(),
|
|
getActivity().getSupportFragmentManager(),
|
|
@@ -326,6 +320,25 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void setHideFileListingPermissionsToShare(OCShare share, boolean hideFileListing) {
|
|
|
|
+ ((FileActivity) getActivity()).getFileOperationsHelper().
|
|
|
|
+ setHideFileListingPermissionsToShare(share, hideFileListing);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void showNotSupportedByOcMessage() {
|
|
|
|
+ if (getView() != null) {
|
|
|
|
+ Snackbar.make(getView(), R.string.files_drop_not_supported, Snackbar.LENGTH_LONG)
|
|
|
|
+ .setAction(R.string.learn_more, v -> {
|
|
|
|
+ Intent i = new Intent(Intent.ACTION_VIEW);
|
|
|
|
+ i.setData(Uri.parse(getString(R.string.url_server_install)));
|
|
|
|
+ startActivity(i);
|
|
|
|
+ })
|
|
|
|
+ .show();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Updates the UI after the result of an update operation on the edited {@link OCFile}.
|
|
* Updates the UI after the result of an update operation on the edited {@link OCFile}.
|
|
*
|
|
*
|
|
@@ -404,6 +417,12 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
|
|
dialog.show(getChildFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
|
|
dialog.show(getChildFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void requestPasswordForShare(OCShare share) {
|
|
|
|
+ SharePasswordDialogFragment dialog = SharePasswordDialogFragment.newInstance(share);
|
|
|
|
+ dialog.show(getChildFragmentManager(), SharePasswordDialogFragment.PASSWORD_FRAGMENT);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get known server capabilities from DB
|
|
* Get known server capabilities from DB
|
|
*
|
|
*
|