mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-07 09:33:39 +02:00
Fixed shared mime type
This commit is contained in:
@@ -258,7 +258,7 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
||||
ClipData.Item item = clip.getItemAt(i);
|
||||
Uri stream = (item == null ? null : item.getUri());
|
||||
if (stream != null)
|
||||
uris.add(new UriType(stream, description, this));
|
||||
uris.add(new UriType(stream, intent.getType(), description, this));
|
||||
}
|
||||
|
||||
if (intent.hasExtra(Intent.EXTRA_STREAM)) {
|
||||
|
||||
@@ -679,7 +679,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
DragAndDropPermissionsCompat permissions = ActivityCompat.requestDragAndDropPermissions(activity, event);
|
||||
if (permissions == null)
|
||||
return false;
|
||||
UriType uriType = new UriType(uri, event.getClipDescription(), activity);
|
||||
UriType uriType = new UriType(uri, null, event.getClipDescription(), activity);
|
||||
onSharedAttachments(new ArrayList<>(Arrays.asList(uriType)));
|
||||
return true;
|
||||
default:
|
||||
@@ -3979,7 +3979,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
ClipData.Item item = clipData.getItemAt(i);
|
||||
Uri uri = item.getUri();
|
||||
if (uri != null)
|
||||
result.add(new UriType(uri, description, getContext()));
|
||||
result.add(new UriType(uri, data.getType(), description, getContext()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,17 @@ public class UriType implements Parcelable {
|
||||
this.type = in.readString();
|
||||
}
|
||||
|
||||
public UriType(Uri uri, ClipDescription description, Context context) {
|
||||
this(uri, description == null || description.getMimeTypeCount() <= 0 ? null : description.getMimeType(0), context);
|
||||
public UriType(Uri uri, String type, ClipDescription description, Context context) {
|
||||
this.uri = uri;
|
||||
if (TextUtils.isEmpty(type)) {
|
||||
if (description != null) {
|
||||
if (description.getMimeTypeCount() > 0)
|
||||
this.type = description.getMimeType(0);
|
||||
for (int i = 0; i < description.getMimeTypeCount(); i++)
|
||||
Log.i("Type #" + i + " " + description.getMimeType(i) + " " + uri);
|
||||
}
|
||||
} else
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public UriType(Uri uri, String type, Context context) {
|
||||
|
||||
Reference in New Issue
Block a user