Skip to content

Instantly share code, notes, and snippets.

@nicoqueijo
Created May 14, 2020 20:20
Show Gist options
  • Save nicoqueijo/156325c09b2200a8c685806f626987fa to your computer and use it in GitHub Desktop.
Save nicoqueijo/156325c09b2200a8c685806f626987fa to your computer and use it in GitHub Desktop.
class CurrencyRow(context: Context?, attrs: AttributeSet? = null) :
ConstraintLayout(context, attrs) {
val currencyFlag: ImageView
val currencyCode: TextView
val currencyName: TextView
init {
LayoutInflater.from(context).inflate(R.layout.row_currency, this)
currencyFlag = findViewById(R.id.currency_flag)
currencyCode = findViewById(R.id.currency_code)
currencyName = findViewById(R.id.currency_name)
}
fun initRow(currency: Currency) {
currencyFlag.setImageResource(currency.currencyFlag)
currencyCode.text = currency.currencyCode
currencyName.text = currency.currencyName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment