mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Remove gradient support from api 19.
This commit is contained in:
committed by
Cody Henthorne
parent
35930fb23a
commit
273e5f9168
@@ -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)
|
||||
Reference in New Issue
Block a user