diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-06-24 14:03:18 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-06-24 14:03:18 +0300 |
commit | f828c7187bc14df52d9a9c9108151232208d735b (patch) | |
tree | cd3b2d37f3bbd078631633c5d0f69d81e43fb933 /app/src/main/java/it/niedermann/nextcloud/deck/util | |
parent | 719ac9ebee257f9254e35c2501b1eff28f6a2992 (diff) |
version bump to 1.5.61.5.6
- 🐞 Fix sharing text based files like contacts
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/util')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java index bdbb08a63..0390bf96d 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/MimeTypeUtil.java @@ -1,45 +1,41 @@ package it.niedermann.nextcloud.deck.util; +import androidx.annotation.Nullable; + import java.util.Locale; public class MimeTypeUtil { public static final String TEXT_PLAIN = "text/plain"; + public static final String TEXT_VCARD = "text/vcard"; public static final String APPLICATION_PDF = "application/pdf"; - /** - * @return 'True' if the mime type defines image - */ - public static boolean isImage(String mimeType) { + public static boolean isImage(@Nullable String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("image/") && !mimeType.toLowerCase(Locale.ROOT).contains("djvu"); } - /** - * @return 'True' the mime type defines video - */ - public static boolean isVideo(String mimeType) { + public static boolean isVideo(@Nullable String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("video/"); } - /** - * @return 'True' the mime type defines audio - */ - public static boolean isAudio(String mimeType) { + public static boolean isAudio(@Nullable String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("audio/"); } - /** - * @return 'True' if mime type defines text - */ - public static boolean isText(String mimeType) { + public static boolean isText(@Nullable String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("text/"); } - /** - * @return 'True' if mime type defines pdf - */ - public static boolean isPdf(String mimeType) { - return APPLICATION_PDF.equals(mimeType.toLowerCase(Locale.ROOT)); + public static boolean isTextPlain(@Nullable String mimeType) { + return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith(TEXT_PLAIN); + } + + public static boolean isContact(@Nullable String mimeType) { + return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith(TEXT_VCARD); + } + + public static boolean isPdf(@Nullable String mimeType) { + return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith(APPLICATION_PDF); } } |