Added support for AVIF

pull/204/head
M66B 3 years ago
parent 636c2b4a8f
commit 03e2013ab1

@ -427,6 +427,9 @@ public abstract class DB extends RoomDatabase {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
for (String img : ImageHelper.IMAGE_TYPES8)
image.add("'" + img + "'");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
for (String img : ImageHelper.IMAGE_TYPES12)
image.add("'" + img + "'");
String images = TextUtils.join(",", image);
db.execSQL("CREATE TRIGGER IF NOT EXISTS attachment_insert" +

@ -109,11 +109,20 @@ class ImageHelper {
"image/heif"
));
// https://developer.android.com/about/versions/12/features#avif
static final List<String> IMAGE_TYPES12 = Collections.unmodifiableList(Arrays.asList(
"image/avif"
));
static boolean isImage(String mimeType) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
if (IMAGE_TYPES8.contains(mimeType))
return true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
if (IMAGE_TYPES12.contains(mimeType))
return true;
return IMAGE_TYPES.contains(mimeType);
}

Loading…
Cancel
Save