Fix video forwarding thumbnail display.
This commit is contained in:
parent
faafa40122
commit
a3caabcafd
2 changed files with 15 additions and 1 deletions
|
@ -40,7 +40,7 @@ class DecryptableStreamLocalUriFetcher extends StreamLocalUriFetcher {
|
|||
}
|
||||
|
||||
try {
|
||||
return PartAuthority.getAttachmentStream(context, uri);
|
||||
return PartAuthority.getAttachmentThumbnailStream(context, uri);
|
||||
} catch (IOException ioe) {
|
||||
Log.w(TAG, ioe);
|
||||
throw new FileNotFoundException("PartAuthority couldn't load Uri resource.");
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
|
|||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.providers.DeprecatedPersistentBlobProvider;
|
||||
import org.thoughtcrime.securesms.providers.PartProvider;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -44,6 +45,19 @@ public class PartAuthority {
|
|||
uriMatcher.addURI(BlobProvider.AUTHORITY, BlobProvider.PATH, BLOB_ROW);
|
||||
}
|
||||
|
||||
public static InputStream getAttachmentThumbnailStream(@NonNull Context context, @NonNull Uri uri)
|
||||
throws IOException
|
||||
{
|
||||
String contentType = getAttachmentContentType(context, uri);
|
||||
int match = uriMatcher.match(uri);
|
||||
|
||||
if (match == PART_ROW && MediaUtil.isVideoType(contentType)) {
|
||||
return DatabaseFactory.getAttachmentDatabase(context).getThumbnailStream(new PartUriParser(uri).getPartId());
|
||||
}
|
||||
|
||||
return getAttachmentStream(context, uri);
|
||||
}
|
||||
|
||||
public static InputStream getAttachmentStream(@NonNull Context context, @NonNull Uri uri)
|
||||
throws IOException
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue