From 9bf12085bf088c0a0ecded9e1e1d254210179f0d Mon Sep 17 00:00:00 2001 From: Jakob Nixdorf Date: Wed, 13 May 2020 07:04:02 +0200 Subject: [PATCH] Fix gradients in Android APIs below 24 Fixes #539 --- .../org/shadowice/flocke/andotp/Utilities/EntryThumbnail.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/EntryThumbnail.java b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/EntryThumbnail.java index 3d99c7b4..698d456c 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/Utilities/EntryThumbnail.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/Utilities/EntryThumbnail.java @@ -29,6 +29,7 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import androidx.appcompat.app.AppCompatDelegate; +import androidx.appcompat.content.res.AppCompatResources; import org.shadowice.flocke.andotp.R; @@ -305,7 +306,7 @@ public class EntryThumbnail { try { if (thumbnail.getAssetType() == AssetType.Vector) { - Drawable drawable = context.getResources().getDrawable(thumbnail.getResource()); + Drawable drawable = AppCompatResources.getDrawable(context, thumbnail.getResource()); Bitmap bitmap = Bitmap.createBitmap(drawable.getMinimumWidth(), drawable.getMinimumHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());