Remove gradient support from api 19.

This commit is contained in:
Alex Hart
2021-05-26 19:52:56 -03:00
committed by Cody Henthorne
parent 35930fb23a
commit 273e5f9168
10 changed files with 85 additions and 45 deletions

View File

@@ -0,0 +1,20 @@
package org.thoughtcrime.securesms.util
import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import androidx.annotation.Px
/**
* Drawable that wraps another drawable but explicitly sets its intrinsic width and height as specified.
*/
class FixedSizeDrawable(
drawable: Drawable,
@Px private val width: Int,
@Px private val height: Int
) : LayerDrawable(arrayOf(drawable)) {
override fun getIntrinsicHeight(): Int = width
override fun getIntrinsicWidth(): Int = height
}
fun Drawable.withFixedSize(@Px width: Int, @Px height: Int) = FixedSizeDrawable(this, width, height)
fun Drawable.withFixedSize(@Px size: Int) = withFixedSize(size, size)