aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2020-02-12 19:53:45 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2020-02-12 19:53:45 +0100
commit92b16348f47d8964561c0fbae9990c27c1f628ac (patch)
tree0cecd3fb4febd629d271bb9835456e395383e4bf /src/main/java
parente4d3b5ebe80c6772db08a56b9bd4b95549b8463c (diff)
show PDF preview in MediaBrowserActivity
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/Attachment.java2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 6f7ee3992..be9488205 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -1383,7 +1383,10 @@ public class FileBackend {
if (bitmap != null || cacheOnly) {
return bitmap;
}
- if (attachment.getMime() != null && attachment.getMime().startsWith("video/")) {
+ DownloadableFile file = new DownloadableFile(attachment.getUri().getPath());
+ if ("application/pdf".equals(attachment.getMime()) && Compatibility.runsTwentyOne()) {
+ bitmap = cropCenterSquare(getPDFPreview(file, size), size);
+ } else if (attachment.getMime() != null && attachment.getMime().startsWith("video/")) {
bitmap = cropCenterSquareVideo(attachment.getUri(), size);
drawOverlay(bitmap, R.drawable.play_video, 0.75f);
} else {
diff --git a/src/main/java/de/pixart/messenger/ui/util/Attachment.java b/src/main/java/de/pixart/messenger/ui/util/Attachment.java
index 1eb184ca3..ed4f5040a 100644
--- a/src/main/java/de/pixart/messenger/ui/util/Attachment.java
+++ b/src/main/java/de/pixart/messenger/ui/util/Attachment.java
@@ -158,7 +158,7 @@ public class Attachment implements Parcelable {
}
public boolean renderThumbnail() {
- return type == Type.IMAGE || (type == Type.FILE && mime != null && (mime.startsWith("video/") || mime.startsWith("image/")));
+ return type == Type.IMAGE || (type == Type.FILE && mime != null && (mime.startsWith("video/") || mime.startsWith("image/") || mime.contains("pdf")));
}
public Uri getUri() {