|
@@ -106,7 +106,7 @@ public class FileMenuFilter {
|
|
|
List<Integer> toShow = new ArrayList<>();
|
|
|
List<Integer> toHide = new ArrayList<>();
|
|
|
|
|
|
- filter(toShow, toHide, inSingleFileFragment);
|
|
|
+ filter(toShow, toHide, inSingleFileFragment, menu);
|
|
|
|
|
|
for (int i : toShow) {
|
|
|
showMenuItem(menu.findItem(i));
|
|
@@ -162,7 +162,7 @@ public class FileMenuFilter {
|
|
|
* @param toHide List to save the options that must be shown in the menu.
|
|
|
* @param inSingleFileFragment True if this is not listing, but single file fragment, like preview or details.
|
|
|
*/
|
|
|
- private void filter(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment) {
|
|
|
+ private void filter(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment, Menu menu) {
|
|
|
boolean synchronizing = anyFileSynchronizing();
|
|
|
OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name);
|
|
|
boolean endToEndEncryptionEnabled = capability.getEndToEndEncryption().isTrue();
|
|
@@ -184,7 +184,7 @@ public class FileMenuFilter {
|
|
|
filterUnsetEncrypted(toShow, toHide, endToEndEncryptionEnabled);
|
|
|
filterSetPictureAs(toShow, toHide);
|
|
|
filterStream(toShow, toHide);
|
|
|
- filterOpenAsRichDocument(toShow, toHide, capability);
|
|
|
+ filterOpenAsRichDocument(toShow, toHide, capability, menu);
|
|
|
}
|
|
|
|
|
|
private void filterShareFile(List<Integer> toShow, List<Integer> toHide, OCCapability capability) {
|
|
@@ -247,12 +247,25 @@ public class FileMenuFilter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void filterOpenAsRichDocument(List<Integer> toShow, List<Integer> toHide, OCCapability capability) {
|
|
|
+ private void filterOpenAsRichDocument(List<Integer> toShow,
|
|
|
+ List<Integer> toHide,
|
|
|
+ OCCapability capability,
|
|
|
+ Menu menu) {
|
|
|
String mimeType = mFiles.iterator().next().getMimeType();
|
|
|
+
|
|
|
if (isSingleFile() && android.os.Build.VERSION.SDK_INT >= RichDocumentsWebView.MINIMUM_API &&
|
|
|
(capability.getRichDocumentsMimeTypeList().contains(mimeType) ||
|
|
|
capability.getRichDocumentsOptionalMimeTypeList().contains(mimeType)) &&
|
|
|
capability.getRichDocumentsDirectEditing().isTrue()) {
|
|
|
+
|
|
|
+ String openWith = mContext.getResources().getString(R.string.actionbar_open_as_richdocument_parameter);
|
|
|
+ String productName = capability.getRichDocumentsProductName();
|
|
|
+ MenuItem item = menu.findItem(R.id.action_open_file_as_richdocument);
|
|
|
+
|
|
|
+ if (item != null) {
|
|
|
+ item.setTitle(String.format(openWith, productName));
|
|
|
+ }
|
|
|
+
|
|
|
toShow.add(R.id.action_open_file_as_richdocument);
|
|
|
} else {
|
|
|
toHide.add(R.id.action_open_file_as_richdocument);
|