Skip to content

Commit

Permalink
Merge branch 'release/v4.1.5' into 'master'
Browse files Browse the repository at this point in the history
Release v4.1.5

See merge request mobile/android/android!1850
  • Loading branch information
javiergm1983 committed Jun 3, 2021
2 parents 8639bde + 5f213b1 commit 9368716
Show file tree
Hide file tree
Showing 42 changed files with 1,631 additions and 1,107 deletions.
50 changes: 29 additions & 21 deletions app/src/main/java/mega/privacy/android/app/MimeTypeList.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.util.HashMap;
import java.util.List;

import static mega.privacy.android.app.components.textFormatter.TextFormatterUtils.INVALID_INDEX;

/*
* Mime type for files
*/
Expand Down Expand Up @@ -102,40 +104,46 @@ public static MimeTypeList typeForName(String name) {
name = "";
}
String fixedName = name.trim().toLowerCase();
String extension = null;
String extension = "";
int index = fixedName.lastIndexOf(".");
if((index != -1) && ((index+1)<fixedName.length())) {

if (index != INVALID_INDEX && index + 1 < fixedName.length()) {
extension = fixedName.substring(index + 1);
} else {
extension = fixedName;
}

String detectedType = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(extension);

if (detectedType == null) {
if(extension.equals("mkv")) {
detectedType = "video/x-matroska";
}
else if (extension.equals("heic")) {
detectedType = "image/heic";
}
else if (extension.equals("url")) {
detectedType = "web/url";
}else if(extension.equals("webp")) {
detectedType = "image/webp";
switch (extension) {
case "mkv":
detectedType = "video/x-matroska";
break;
case "heic":
detectedType = "image/heic";
break;
case "url":
detectedType = "web/url";
break;
case "webp":
detectedType = "image/webp";
break;
default:
detectedType = "application/octet-stream";
break;
}
else {
detectedType = "application/octet-stream";
}
}
if (extension == null) {
extension = "";
}

return new MimeTypeList(detectedType, extension);
}

public String getType() {
return type;
}

public String getExtension() {
return extension;
}

public boolean isDocument(){
boolean r = type.startsWith("application/pdf") || type.startsWith("application/msword") || type.startsWith("application/vnd.ms-excel") || type.startsWith("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") || type.startsWith("application/vnd.openxmlformats-officedocument.wordprocessingml.document") || type.startsWith("application/rtf") || type.startsWith("text/plain");
Expand Down Expand Up @@ -275,7 +283,7 @@ public boolean isGIF () {
*
* @return True if the file is openable, false otherwise.
*/
private boolean isValidTextFileType() {
public boolean isValidTextFileType() {
//Text
return type.startsWith("text/plain")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13849,6 +13849,7 @@ public int getSearchSharedTab() {

public void setSearchQuery(String searchQuery) {
this.searchQuery = searchQuery;
this.searchView.setQuery(searchQuery, false);
}

public long getParentHandleIncoming() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,9 @@ public void onDestroy() {
if(adapter != null) {
adapter.dismissDialog();
}
if (context instanceof ManagerActivityLollipop) {
((ManagerActivityLollipop) context).setSearchQuery("");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ import mega.privacy.android.app.utils.Constants.*
import mega.privacy.android.app.utils.FileUtil.shareUri
import mega.privacy.android.app.utils.LogUtil.logDebug
import mega.privacy.android.app.utils.LogUtil.logError
import mega.privacy.android.app.utils.MegaNodeDialogUtil.Companion.moveToRubbishOrRemove
import mega.privacy.android.app.utils.MegaNodeDialogUtil.Companion.showRenameNodeDialog
import mega.privacy.android.app.utils.MegaNodeDialogUtil.moveToRubbishOrRemove
import mega.privacy.android.app.utils.MegaNodeDialogUtil.showRenameNodeDialog
import mega.privacy.android.app.utils.MegaNodeUtil.handleSelectFolderToImportResult
import mega.privacy.android.app.utils.MegaNodeUtil.selectFolderToCopy
import mega.privacy.android.app.utils.MegaNodeUtil.selectFolderToMove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import mega.privacy.android.app.textFileEditor.TextFileEditorViewModel.Companion
import mega.privacy.android.app.utils.AlertsAndWarnings.Companion.showSaveToDeviceConfirmDialog
import mega.privacy.android.app.utils.ChatUtil.removeAttachmentMessage
import mega.privacy.android.app.utils.Constants.*
import mega.privacy.android.app.utils.MegaNodeDialogUtil.moveToRubbishOrRemove
import mega.privacy.android.app.utils.MegaNodeDialogUtil.showRenameNodeDialog
import mega.privacy.android.app.utils.LogUtil.logError
import mega.privacy.android.app.utils.MegaNodeDialogUtil.Companion.moveToRubbishOrRemove
import mega.privacy.android.app.utils.MegaNodeDialogUtil.Companion.showRenameNodeDialog
import mega.privacy.android.app.utils.MegaNodeUtil.selectFolderToCopy
import mega.privacy.android.app.utils.MegaNodeUtil.selectFolderToMove
import mega.privacy.android.app.utils.MenuUtils.toggleAllMenuItemsVisibility
Expand Down
Loading

0 comments on commit 9368716

Please sign in to comment.