Replace VectorDrawableCompat.create() with AppCompatResources.getDrawable()

Fixes crash when loading pin icon in Android 5/6.
This commit is contained in:
arkon
2020-07-29 18:36:28 -04:00
parent 7e73ede47a
commit 9bb2334b69
6 changed files with 16 additions and 18 deletions
@@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.util.view
import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import androidx.appcompat.content.res.AppCompatResources
/**
* Set a vector on a [ImageView].
@@ -10,7 +10,7 @@ import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
* @param drawable id of drawable resource
*/
fun ImageView.setVectorCompat(@DrawableRes drawable: Int, tint: Int? = null) {
val vector = VectorDrawableCompat.create(resources, drawable, context.theme)
val vector = AppCompatResources.getDrawable(context, drawable)
if (tint != null) {
vector?.mutate()
vector?.setTint(tint)