every device is 21+ now

This commit is contained in:
Daniel Gultsch 2022-07-10 13:00:34 +02:00
parent 7d92ac365d
commit dd30951dfb
3 changed files with 5 additions and 9 deletions

View file

@ -437,7 +437,7 @@ public class FileBackend {
return bitmap; return bitmap;
} }
final String mime = attachment.getMime(); final String mime = attachment.getMime();
if ("application/pdf".equals(mime) && Compatibility.runsTwentyOne()) { if ("application/pdf".equals(mime)) {
bitmap = cropCenterSquarePdf(attachment.getUri(), size); bitmap = cropCenterSquarePdf(attachment.getUri(), size);
drawOverlay( drawOverlay(
bitmap, bitmap,
@ -961,7 +961,7 @@ public class FileBackend {
} }
DownloadableFile file = getFile(message); DownloadableFile file = getFile(message);
final String mime = file.getMimeType(); final String mime = file.getMimeType();
if ("application/pdf".equals(mime) && Compatibility.runsTwentyOne()) { if ("application/pdf".equals(mime)) {
thumbnail = getPdfDocumentPreview(file, size); thumbnail = getPdfDocumentPreview(file, size);
} else if (mime.startsWith("video/")) { } else if (mime.startsWith("video/")) {
thumbnail = getVideoPreview(file, size); thumbnail = getVideoPreview(file, size);
@ -1507,12 +1507,12 @@ public class FileBackend {
body.append(url); body.append(url);
} }
body.append('|').append(file.getSize()); body.append('|').append(file.getSize());
if (image || video || (pdf && Compatibility.runsTwentyOne())) { if (image || video || pdf) {
try { try {
final Dimensions dimensions; final Dimensions dimensions;
if (video) { if (video) {
dimensions = getVideoDimensions(file); dimensions = getVideoDimensions(file);
} else if (pdf && Compatibility.runsTwentyOne()) { } else if (pdf) {
dimensions = getPdfDocumentDimensions(file); dimensions = getPdfDocumentDimensions(file);
} else { } else {
dimensions = getImageDimensions(file); dimensions = getImageDimensions(file);

View file

@ -179,7 +179,7 @@ public class Attachment implements Parcelable {
private static boolean renderFileThumbnail(final String mime) { private static boolean renderFileThumbnail(final String mime) {
return mime.startsWith("video/") return mime.startsWith("video/")
|| isImage(mime) || isImage(mime)
|| (Compatibility.runsTwentyOne() && "application/pdf".equals(mime)); || "application/pdf".equals(mime);
} }
public Uri getUri() { public Uri getUri() {

View file

@ -43,10 +43,6 @@ public class Compatibility {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(context, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(context, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
} }
public static boolean runsTwentyOne() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}
private static boolean runsTwentyFour() { private static boolean runsTwentyFour() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
} }