Commit cea1525e authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update widget/helper/DrawableHelper.kt

parent d228d0a6
...@@ -13,9 +13,11 @@ object DrawableHelper { ...@@ -13,9 +13,11 @@ object DrawableHelper {
* @param drawable The drawable to wrap. * @param drawable The drawable to wrap.
* @see tintDrawable * @see tintDrawable
*/ */
fun wrapDrawable(drawable: Drawable) { fun wrapDrawable(drawable: Drawable?) {
if (drawable != null) {
DrawableCompat.wrap(drawable) DrawableCompat.wrap(drawable)
} }
}
/** /**
* REMARK: You MUST always wrap the drawable before tint it. * REMARK: You MUST always wrap the drawable before tint it.
...@@ -25,7 +27,9 @@ object DrawableHelper { ...@@ -25,7 +27,9 @@ object DrawableHelper {
* @param resId The resource id color to tint the drawable. * @param resId The resource id color to tint the drawable.
* @see wrapDrawable * @see wrapDrawable
*/ */
fun tintDrawable(drawable: Drawable, context: Context, resId: Int) { fun tintDrawable(drawable: Drawable?, context: Context, resId: Int) {
if (drawable != null) {
DrawableCompat.setTint(drawable, ContextCompat.getColor(context, resId)) DrawableCompat.setTint(drawable, ContextCompat.getColor(context, resId))
} }
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment