~singpolyma/cheogram-android

0beb1e901a879871d15746aec6134cfe342dde07 — Daniel Gultsch 2 years ago 49c9584
every device is 21+ now
M src/main/java/eu/siacs/conversations/persistance/FileBackend.java => src/main/java/eu/siacs/conversations/persistance/FileBackend.java +4 -4
@@ 437,7 437,7 @@ public class FileBackend {
            return bitmap;
        }
        final String mime = attachment.getMime();
        if ("application/pdf".equals(mime) && Compatibility.runsTwentyOne()) {
        if ("application/pdf".equals(mime)) {
            bitmap = cropCenterSquarePdf(attachment.getUri(), size);
            drawOverlay(
                    bitmap,


@@ 961,7 961,7 @@ public class FileBackend {
                }
                DownloadableFile file = getFile(message);
                final String mime = file.getMimeType();
                if ("application/pdf".equals(mime) && Compatibility.runsTwentyOne()) {
                if ("application/pdf".equals(mime)) {
                    thumbnail = getPdfDocumentPreview(file, size);
                } else if (mime.startsWith("video/")) {
                    thumbnail = getVideoPreview(file, size);


@@ 1507,12 1507,12 @@ public class FileBackend {
            body.append(url);
        }
        body.append('|').append(file.getSize());
        if (image || video || (pdf && Compatibility.runsTwentyOne())) {
        if (image || video || pdf) {
            try {
                final Dimensions dimensions;
                if (video) {
                    dimensions = getVideoDimensions(file);
                } else if (pdf && Compatibility.runsTwentyOne()) {
                } else if (pdf) {
                    dimensions = getPdfDocumentDimensions(file);
                } else {
                    dimensions = getImageDimensions(file);

M src/main/java/eu/siacs/conversations/ui/util/Attachment.java => src/main/java/eu/siacs/conversations/ui/util/Attachment.java +1 -1
@@ 179,7 179,7 @@ public class Attachment implements Parcelable {
    private static boolean renderFileThumbnail(final String mime) {
        return mime.startsWith("video/")
                || isImage(mime)
                || (Compatibility.runsTwentyOne() && "application/pdf".equals(mime));
                || "application/pdf".equals(mime);
    }

    public Uri getUri() {

M src/main/java/eu/siacs/conversations/utils/Compatibility.java => src/main/java/eu/siacs/conversations/utils/Compatibility.java +0 -4
@@ 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;
    }

    public static boolean runsTwentyOne() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
    }

    public static boolean s() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S;
    }