aboutsummaryrefslogtreecommitdiff
path: root/adapter/src
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-23 13:13:36 -0700
committerGitHub <noreply@github.com>2017-07-23 13:13:36 -0700
commit4706b8f6a8d08a6961da6ab34d15881b63356d79 (patch)
tree3d1e611e43bd589a98a5f1840c5b6f52ff254468 /adapter/src
parent61d87976e8b29ed25061ae98743a6cf4f4274542 (diff)
downloadkau-4706b8f6a8d08a6961da6ab34d15881b63356d79.tar.gz
kau-4706b8f6a8d08a6961da6ab34d15881b63356d79.tar.bz2
kau-4706b8f6a8d08a6961da6ab34d15881b63356d79.zip
Update kpref-activity's min-sdk and other minor changes (#11)3.1.0
* 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
Diffstat (limited to 'adapter/src')
-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)