Guard for low android version
(cherry picked from commit 60b50ec041651ecf10fe76bef8f2abda36140d0f)
This commit is contained in:
parent
f78978a1e3
commit
5decd801fc
1 changed files with 9 additions and 7 deletions
|
@ -1311,13 +1311,15 @@ public class FileBackend {
|
|||
if (parts[0].equals("image/blurhash")) continue; // blurhash only for fallback
|
||||
if (parts[0].equals("image/thumbhash")) continue; // thumbhash only for fallback
|
||||
|
||||
ImageDecoder.Source source = ImageDecoder.createSource(ByteBuffer.wrap(data));
|
||||
thumbnail = ImageDecoder.decodeDrawable(source, (decoder, info, src) -> {
|
||||
int w = info.getSize().getWidth();
|
||||
int h = info.getSize().getHeight();
|
||||
Rect r = rectForSize(w, h, size);
|
||||
decoder.setTargetSize(r.width(), r.height());
|
||||
});
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28) {
|
||||
ImageDecoder.Source source = ImageDecoder.createSource(ByteBuffer.wrap(data));
|
||||
thumbnail = ImageDecoder.decodeDrawable(source, (decoder, info, src) -> {
|
||||
int w = info.getSize().getWidth();
|
||||
int h = info.getSize().getHeight();
|
||||
Rect r = rectForSize(w, h, size);
|
||||
decoder.setTargetSize(r.width(), r.height());
|
||||
});
|
||||
}
|
||||
|
||||
if (thumbnail != null && file.getAbsolutePath() != null) {
|
||||
cache.put(file.getAbsolutePath(), thumbnail);
|
||||
|
|
Loading…
Reference in a new issue