aboutsummaryrefslogtreecommitdiff
path: root/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
diff options
context:
space:
mode:
Diffstat (limited to 'adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt')
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt14
1 files changed, 5 insertions, 9 deletions
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
index 21a49f2..d6d06f3 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
@@ -9,7 +9,6 @@ import ca.allanwang.kau.adapters.ThemableIItem
import ca.allanwang.kau.adapters.ThemableIItemDelegate
import ca.allanwang.kau.utils.bindView
import ca.allanwang.kau.utils.string
-import com.mikepenz.fastadapter.items.AbstractItem
/**
* Created by Allan Wang on 2017-06-28.
@@ -17,15 +16,14 @@ import com.mikepenz.fastadapter.items.AbstractItem
* Simple Header with lots of padding on the top
* Contains only one text view
*/
-class HeaderIItem(text: String? = null, var textRes: Int = -1
-) : AbstractItem<HeaderIItem, HeaderIItem.ViewHolder>(), ThemableIItem by ThemableIItemDelegate() {
+class HeaderIItem(
+ text: String? = null, var textRes: Int = -1
+) : KauIItem<HeaderIItem, HeaderIItem.ViewHolder>(
+ R.layout.kau_iitem_header, { ViewHolder(it) }, R.id.kau_item_header_big_margin_top
+), ThemableIItem by ThemableIItemDelegate() {
var text: String = text ?: "Header Placeholder"
- override fun getType(): Int = R.id.kau_item_header_big_margin_top
-
- override fun getLayoutRes(): Int = R.layout.kau_iitem_header
-
override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) {
super.bindView(holder, payloads)
holder.text.text = holder.itemView.context.string(textRes, text)
@@ -38,8 +36,6 @@ class HeaderIItem(text: String? = null, var textRes: Int = -1
holder.text.text = null
}
- override fun getViewHolder(v: View): ViewHolder = ViewHolder(v)
-
class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
val text: TextView by bindView(R.id.kau_header_text)
val container: CardView by bindView(R.id.kau_header_container)