Skip to content

Commit

Permalink
setImageResource instead of setImageDrawable
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-bor committed Nov 26, 2017
1 parent 30d78b1 commit 43e8da1
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.sharpdroid.registroelettronico.views
import android.content.Context
import android.graphics.PorterDuff
import android.support.annotation.DrawableRes
import android.support.v4.content.ContextCompat
import android.util.AttributeSet
import android.widget.RelativeLayout
import com.sharpdroid.registroelettronico.R
Expand All @@ -19,9 +18,8 @@ class EmptyFragment(context: Context, attributeSet: AttributeSet?, defStyleAttr:
}

fun setTextAndDrawable(text: String, @DrawableRes drawableRes: Int) {
val drawable = ContextCompat.getDrawable(context, drawableRes)
drawable?.setColorFilter(0xff636363.toInt(), PorterDuff.Mode.SRC_ATOP)
place_holder_image.setImageDrawable(drawable)
place_holder_image.setImageResource(drawableRes)
place_holder_image.setColorFilter(0xff636363.toInt(), PorterDuff.Mode.SRC_ATOP)
place_holder_text.text = text
}
}

0 comments on commit 43e8da1

Please sign in to comment.