From 4706b8f6a8d08a6961da6ab34d15881b63356d79 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 23 Jul 2017 13:13:36 -0700 Subject: Update kpref-activity's min-sdk and other minor changes (#11) * Move some resources to public * Lower kpref minsdk * Remove excess kauUtils annotations * Allow nullable throwable * Do not throw null throwable * Make image picker base abstract again * Migrate about strings to private * Update readme * Update readme * Update sample tagging * Update adapter readme --- .../src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt | 7 +++++-- .../src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt | 14 +++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'adapter/src/main/kotlin/ca') 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(R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card), - ThemableIItem by ThemableIItemDelegate() { +class CardIItem( + val builder: Config.() -> Unit = {} +) : KauIItem( + R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card +), ThemableIItem by ThemableIItemDelegate() { companion object { @JvmStatic fun bindClickEvents(fastAdapter: FastAdapter>) { 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(), ThemableIItem by ThemableIItemDelegate() { +class HeaderIItem( + text: String? = null, var textRes: Int = -1 +) : KauIItem( + 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?) { 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) -- cgit v1.2.3