1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Append file name to content:// URI

This allows intent filters with patterns for file extensions to match.
This commit is contained in:
cketti 2014-11-10 05:46:38 +01:00
parent 6a1905b7b7
commit dfd40659d1
2 changed files with 4 additions and 3 deletions

View File

@ -58,12 +58,13 @@ public class AttachmentProvider extends ContentProvider {
.build();
}
public static Uri getAttachmentUriForViewing(Account account, long id, String mimeType) {
public static Uri getAttachmentUriForViewing(Account account, long id, String mimeType, String filename) {
return CONTENT_URI.buildUpon()
.appendPath(account.getUuid())
.appendPath(Long.toString(id))
.appendPath(FORMAT_VIEW)
.appendPath(mimeType)
.appendPath(filename)
.build();
}

View File

@ -287,7 +287,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
int activitiesCount;
Uri originalMimeTypeUri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId(),
contentType);
contentType, name);
Intent originalMimeTypeIntent = createViewIntentForContentUri(contentType, originalMimeTypeUri);
int originalMimeTypeActivitiesCount = getResolvedIntentActivitiesCount(originalMimeTypeIntent);
@ -297,7 +297,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
activitiesCount = originalMimeTypeActivitiesCount;
} else {
Uri inferredMimeTypeUri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId(),
inferredMimeType);
inferredMimeType, name);
Intent inferredMimeTypeIntent = createViewIntentForContentUri(inferredMimeType, inferredMimeTypeUri);
int inferredMimeTypeActivitiesCount = getResolvedIntentActivitiesCount(inferredMimeTypeIntent);