Loading src/com/cyanogenmod/filemanager/activities/PickerActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import com.cyanogenmod.filemanager.ui.widgets.NavigationView.OnFilePickedListene import com.cyanogenmod.filemanager.util.DialogHelper; import com.cyanogenmod.filemanager.util.ExceptionUtil; import com.cyanogenmod.filemanager.util.FileHelper; import com.cyanogenmod.filemanager.util.MimeTypeHelper; import com.cyanogenmod.filemanager.util.StorageHelper; import java.io.File; Loading Loading @@ -184,6 +185,10 @@ public class PickerActivity extends Activity String mimeType = getIntent().getType(); Log.d(TAG, "PickerActivity. type: " + String.valueOf(mimeType)); //$NON-NLS-1$ if (mimeType != null) { if (!MimeTypeHelper.isMimeTypeKnown(this, mimeType)) { Log.i(TAG, "Mime type " + mimeType + " unknown, falling back to wildcard."); mimeType = MimeTypeHelper.ALL_MIME_TYPES; } restrictions.put(DisplayRestrictions.MIME_TYPE_RESTRICTION, mimeType); } // Other restrictions Loading src/com/cyanogenmod/filemanager/util/MimeTypeHelper.java +28 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,34 @@ public final class MimeTypeHelper { super(); } /** * Method that checks whether a certain mime type is known to * the application. * * @param context The current context * @param mimeType The mime type to be checked * @return true if mime type is known, false otherwise */ public static final boolean isMimeTypeKnown(Context context, String mimeType) { //Ensure that mime types are loaded if (sMimeTypes == null) { loadMimeTypes(context); } if (mimeType == null) { return false; } for (MimeTypeInfo info : sMimeTypes.values()) { String mimeTypeRegExp = convertToRegExp(mimeType); if (info.mMimeType.matches(mimeTypeRegExp)) { return true; } } return false; } /** * Method that returns the associated mime/type icon resource identifier of * the {@link FileSystemObject}. Loading Loading
src/com/cyanogenmod/filemanager/activities/PickerActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import com.cyanogenmod.filemanager.ui.widgets.NavigationView.OnFilePickedListene import com.cyanogenmod.filemanager.util.DialogHelper; import com.cyanogenmod.filemanager.util.ExceptionUtil; import com.cyanogenmod.filemanager.util.FileHelper; import com.cyanogenmod.filemanager.util.MimeTypeHelper; import com.cyanogenmod.filemanager.util.StorageHelper; import java.io.File; Loading Loading @@ -184,6 +185,10 @@ public class PickerActivity extends Activity String mimeType = getIntent().getType(); Log.d(TAG, "PickerActivity. type: " + String.valueOf(mimeType)); //$NON-NLS-1$ if (mimeType != null) { if (!MimeTypeHelper.isMimeTypeKnown(this, mimeType)) { Log.i(TAG, "Mime type " + mimeType + " unknown, falling back to wildcard."); mimeType = MimeTypeHelper.ALL_MIME_TYPES; } restrictions.put(DisplayRestrictions.MIME_TYPE_RESTRICTION, mimeType); } // Other restrictions Loading
src/com/cyanogenmod/filemanager/util/MimeTypeHelper.java +28 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,34 @@ public final class MimeTypeHelper { super(); } /** * Method that checks whether a certain mime type is known to * the application. * * @param context The current context * @param mimeType The mime type to be checked * @return true if mime type is known, false otherwise */ public static final boolean isMimeTypeKnown(Context context, String mimeType) { //Ensure that mime types are loaded if (sMimeTypes == null) { loadMimeTypes(context); } if (mimeType == null) { return false; } for (MimeTypeInfo info : sMimeTypes.values()) { String mimeTypeRegExp = convertToRegExp(mimeType); if (info.mMimeType.matches(mimeTypeRegExp)) { return true; } } return false; } /** * Method that returns the associated mime/type icon resource identifier of * the {@link FileSystemObject}. Loading