Fixed ShareContentProvider and KMZ mime type.

This commit is contained in:
Dennis Guse
2019-08-25 21:37:47 +02:00
parent b8bea27155
commit 8685e43dc2
2 changed files with 6 additions and 3 deletions
@@ -74,6 +74,9 @@ public class ShareContentProvider extends CustomContentProvider implements ICont
Uri uri = Uri.parse(ContentProviderUtils.CONTENT_BASE_URI + "/" + TracksColumns.TABLE_NAME + "/" + trackFileFormat.getName() + "/" + builder + "." + trackFileFormat.getExtension()); Uri uri = Uri.parse(ContentProviderUtils.CONTENT_BASE_URI + "/" + TracksColumns.TABLE_NAME + "/" + trackFileFormat.getName() + "/" + builder + "." + trackFileFormat.getExtension());
String mime = getTypeMime(uri); String mime = getTypeMime(uri);
Log.d(TAG, "Created uri " + uri.toString() + " with MIME " + mime);
return new Pair<>(uri, mime); return new Pair<>(uri, mime);
} }
@@ -137,7 +140,7 @@ public class ShareContentProvider extends CustomContentProvider implements ICont
@Override @Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
if (uriMatcher.match(uri) != URI_KML_ONLY) { if (uriMatcher.match(uri) == -1) {
return super.query(uri, projection, selection, selectionArgs, sortOrder); return super.query(uri, projection, selection, selectionArgs, sortOrder);
} }
@@ -144,6 +144,8 @@ public enum TrackFileFormat implements Parcelable {
dest.writeInt(ordinal()); dest.writeInt(ordinal());
} }
private static final String MIME_KMZ = "application/vnd.google-earth.kmz";
private static final String MIME_KML = "application/vnd.google-earth.kml+xml"; private static final String MIME_KML = "application/vnd.google-earth.kml+xml";
public TrackExporter newTrackExporter(Context context, Track[] tracks, TrackExporterListener trackExporterListener) { public TrackExporter newTrackExporter(Context context, Track[] tracks, TrackExporterListener trackExporterListener) {
@@ -157,8 +159,6 @@ public enum TrackFileFormat implements Parcelable {
*/ */
public abstract String getMimeType(); public abstract String getMimeType();
private static final String MIME_KMZ = "application/vnd.google-earth.kml+xml";
private static TrackExporter newKmzTrackExporter(Context context, TrackWriter trackWriter, Track[] tracks, TrackExporterListener trackExporterListener) { private static TrackExporter newKmzTrackExporter(Context context, TrackWriter trackWriter, Track[] tracks, TrackExporterListener trackExporterListener) {
ContentProviderUtils contentProviderUtils = ContentProviderUtils.Factory.get(context); ContentProviderUtils contentProviderUtils = ContentProviderUtils.Factory.get(context);