aboutsummaryrefslogtreecommitdiff
path: root/adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapter')
-rw-r--r--adapter/README.md19
-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
3 files changed, 26 insertions, 14 deletions
diff --git a/adapter/README.md b/adapter/README.md
index 6d59777..7df9713 100644
--- a/adapter/README.md
+++ b/adapter/README.md
@@ -4,8 +4,21 @@ Collection of kotlin bindings and custom IItems for [Fast Adapter](https://githu
## KauIItems
-Extends `AbstractIItems` and contains the arguments (layoutRes, ViewHolder lambda, idRes)
-In that order. Those variables are used to override the default abstract functions.
+Abstract base that extends `AbstractIItems` and contains the arguments `(layoutRes, ViewHolder lambda, idRes)` in that order.
+Those variables are used to override the default abstract functions.
If a layout is only used for one item, it may also be used as the id, which you may leave blank in this case.
The ViewHolder lambda is typically of the form `{ ViewHolder(it) }`
-Where you will have a nested class `ViewHolder(v: View) : RecyclerView.ViewHolder(v)` \ No newline at end of file
+Where you will have a nested class `ViewHolder(v: View) : RecyclerView.ViewHolder(v)`
+
+## IItem Templates
+
+* CardIItem - generic all encompassing card item with a title, description, imageview, and button.
+All items except for the title are optional.
+* HeaderIItem - simple title container with a big top margin
+
+## KauAnimator
+
+Abstract base that decouples the animations into three parts: `add`, `remove`, and `change`.
+Each component extends `KauAnimatorAdd`, `KauAnimatorRemove`, or `KauAnimatorChange` respectively.
+All the changes in the original animator are removed, so you have complete control over the transitions.
+There are a couple base animators, such as fade scale and slide, which can be mix and matched and added to `KauAnimator` \ No newline at end of file
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)