aboutsummaryrefslogtreecommitdiff
path: root/adapter/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'adapter/src/main/kotlin')
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt7
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt14
2 files changed, 10 insertions, 11 deletions
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
index 85f86bd..eb658df 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
@@ -24,8 +24,11 @@ import com.mikepenz.iconics.typeface.IIcon
* Simple generic card item with an icon, title, description and button
* The icon and button are hidden by default unless values are given
*/
-class CardIItem(val builder: Config.() -> Unit = {}) : KauIItem<CardIItem, CardIItem.ViewHolder>(R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card),
- ThemableIItem by ThemableIItemDelegate() {
+class CardIItem(
+ val builder: Config.() -> Unit = {}
+) : KauIItem<CardIItem, CardIItem.ViewHolder>(
+ R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card
+), ThemableIItem by ThemableIItemDelegate() {
companion object {
@JvmStatic fun bindClickEvents(fastAdapter: FastAdapter<IItem<*, *>>) {
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)