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/blurhash")) continue; // blurhash only for fallback
|
||||||
if (parts[0].equals("image/thumbhash")) continue; // thumbhash only for fallback
|
if (parts[0].equals("image/thumbhash")) continue; // thumbhash only for fallback
|
||||||
|
|
||||||
ImageDecoder.Source source = ImageDecoder.createSource(ByteBuffer.wrap(data));
|
if (android.os.Build.VERSION.SDK_INT >= 28) {
|
||||||
thumbnail = ImageDecoder.decodeDrawable(source, (decoder, info, src) -> {
|
ImageDecoder.Source source = ImageDecoder.createSource(ByteBuffer.wrap(data));
|
||||||
int w = info.getSize().getWidth();
|
thumbnail = ImageDecoder.decodeDrawable(source, (decoder, info, src) -> {
|
||||||
int h = info.getSize().getHeight();
|
int w = info.getSize().getWidth();
|
||||||
Rect r = rectForSize(w, h, size);
|
int h = info.getSize().getHeight();
|
||||||
decoder.setTargetSize(r.width(), r.height());
|
Rect r = rectForSize(w, h, size);
|
||||||
});
|
decoder.setTargetSize(r.width(), r.height());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (thumbnail != null && file.getAbsolutePath() != null) {
|
if (thumbnail != null && file.getAbsolutePath() != null) {
|
||||||
cache.put(file.getAbsolutePath(), thumbnail);
|
cache.put(file.getAbsolutePath(), thumbnail);
|
||||||
|
|
Loading…
Add table
Reference in a new issue