[Libreoffice-commits] core.git: android/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 23 21:25:18 UTC 2021


 android/source/src/java/org/libreoffice/ui/FileUtilities.java |   42 ----------
 1 file changed, 1 insertion(+), 41 deletions(-)

New commits:
commit 710badae87b53e5052413cf6dfa163065ef250ac
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Apr 23 14:13:20 2021 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Apr 23 23:24:31 2021 +0200

    android: Drop unused FileUtilities members
    
    ... and make its static 'LOGTAG' member final.
    
    Change-Id: I6d16bc76590341a60db9e123d20d81dcd7adba71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114545
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/android/source/src/java/org/libreoffice/ui/FileUtilities.java b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
index aed671205bef..38ea9054fd59 100644
--- a/android/source/src/java/org/libreoffice/ui/FileUtilities.java
+++ b/android/source/src/java/org/libreoffice/ui/FileUtilities.java
@@ -8,7 +8,6 @@
  */
 package org.libreoffice.ui;
 
-import java.io.File;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -17,13 +16,10 @@ import android.database.Cursor;
 import android.net.Uri;
 import android.provider.OpenableColumns;
 import android.util.Log;
-import android.webkit.MimeTypeMap;
 
 public class FileUtilities {
 
-    private static String LOGTAG = FileUtilities.class.getSimpleName();
-
-    static final int ALL = -1;
+    private static final String LOGTAG = FileUtilities.class.getSimpleName();
 
     // These have to be in sync with the file_view_modes resource.
     static final int DOC = 0;
@@ -40,7 +36,6 @@ public class FileUtilities {
     public static final String MIMETYPE_PDF = "application/pdf";
 
     private static final Map<String, Integer> mExtnMap = new HashMap<String, Integer>();
-    private static final Map<String, String> extensionToMimeTypeMap = new HashMap<String, String>();
     static {
         // Please keep this in sync with AndroidManifest.xml
         // and 'SUPPORTED_MIME_TYPES' in LibreOfficeUIActivity.java
@@ -97,22 +92,6 @@ public class FileUtilities {
         mExtnMap.put(".svm",  DRAWING);
         mExtnMap.put(".wmf",  DRAWING);
         mExtnMap.put(".svg",  DRAWING);
-
-        // Some basic MIME types
-        // Android's MimeTypeMap lacks some types that we need
-        extensionToMimeTypeMap.put("odb", "application/vnd.oasis.opendocument.database");
-        extensionToMimeTypeMap.put("odf", "application/vnd.oasis.opendocument.formula");
-        extensionToMimeTypeMap.put("odg", MIMETYPE_OPENDOCUMENT_GRAPHICS);
-        extensionToMimeTypeMap.put("otg", "application/vnd.oasis.opendocument.graphics-template");
-        extensionToMimeTypeMap.put("odi", "application/vnd.oasis.opendocument.image");
-        extensionToMimeTypeMap.put("odp", MIMETYPE_OPENDOCUMENT_PRESENTATION);
-        extensionToMimeTypeMap.put("otp", "application/vnd.oasis.opendocument.presentation-template");
-        extensionToMimeTypeMap.put("ods", MIMETYPE_OPENDOCUMENT_SPREADSHEET);
-        extensionToMimeTypeMap.put("ots", "application/vnd.oasis.opendocument.spreadsheet-template");
-        extensionToMimeTypeMap.put("odt", MIMETYPE_OPENDOCUMENT_TEXT);
-        extensionToMimeTypeMap.put("odm", "application/vnd.oasis.opendocument.text-master");
-        extensionToMimeTypeMap.put("ott", "application/vnd.oasis.opendocument.text-template");
-        extensionToMimeTypeMap.put("oth", "application/vnd.oasis.opendocument.text-web");
     }
 
     public static String getExtension(String filename) {
@@ -137,25 +116,6 @@ public class FileUtilities {
         return type;
     }
 
-    static String getMimeType(String filename) {
-        String extension = MimeTypeMap.getFileExtensionFromUrl(filename);
-        String mime = extensionToMimeTypeMap.get(extension);
-        if (mime == null) {
-            //fallback to Android's MimeTypeMap
-            mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
-                    extension);
-        }
-        return mime;
-    }
-
-    static boolean isHidden(File file) {
-        return file.getName().startsWith(".");
-    }
-
-    static boolean isThumbnail(File file) {
-        return isHidden(file) && file.getName().endsWith(".png");
-    }
-
     /**
      * Returns whether the passed MIME type is one for a document template.
      */


More information about the Libreoffice-commits mailing list