Last active
August 29, 2017 20:13
-
-
Save jifferon/6372a6c27b4d1270a275d9f0622e26d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SaleGoodHolder(itemView: View, callback: Callback) : BaseHolder(itemView, callback) { | |
@BindView(R.id.sale_item_name) | |
lateinit var name: TextView | |
@BindView(R.id.sale_item_sale_amount) | |
lateinit var saleAmount: TextView | |
@BindView(R.id.sale_item_price) | |
lateinit var price: TextView | |
init { | |
unbinder = ButterKnife.bind(this, itemView) | |
} | |
override fun bindData(data: Good) { | |
this.data = data | |
name.text = data.name | |
saleAmount.text = "${data.saleAmount}" | |
price.text = "${data.calculatePrice()}" | |
itemView.setOnClickListener { | |
callback.onSaleGoodClick(data) | |
} | |
} | |
} | |
class NormalGoodHolder(itemView: View, callback: Callback) : BaseHolder(itemView, callback) { | |
@BindView(R.id.normal_item_name) | |
lateinit var name: TextView | |
@BindView(R.id.normal_item_price) | |
lateinit var price: TextView | |
init { | |
unbinder = ButterKnife.bind(this, itemView) | |
} | |
override fun bindData(data: Good) { | |
this.data = data | |
name.text = data.name | |
price.text = "${data.price}" | |
itemView.setOnClickListener { | |
callback.onNormalGoodClick(data) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment