diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-07 15:29:35 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-07-07 15:29:35 -0700 |
commit | f0237ca8dd0e4ad4c1873f5951099cf03b5f0dd1 (patch) | |
tree | 5c89f04b3f59c2efeab28826f0559bdd326dbbdf /core/src/main/kotlin/ca/allanwang | |
parent | 3dd7fceba150b80fa1cba8102ee1b3f1bbf2948e (diff) | |
download | kau-f0237ca8dd0e4ad4c1873f5951099cf03b5f0dd1.tar.gz kau-f0237ca8dd0e4ad4c1873f5951099cf03b5f0dd1.tar.bz2 kau-f0237ca8dd0e4ad4c1873f5951099cf03b5f0dd1.zip |
Update kauIItem for optional id
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt | 5 | ||||
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt b/core/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt index 00b165c..d8567c4 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt @@ -11,11 +11,12 @@ import com.mikepenz.fastadapter.items.AbstractItem * Created by Allan Wang on 2017-07-03. * * Kotlin implementation of the [AbstractItem] to make things shorter + * If only one iitem type extends the given [layoutRes], you may use it as the type and not worry about another id */ open class KauIItem<Item, VH : RecyclerView.ViewHolder>( - private val type: Int, @param:LayoutRes private val layoutRes: Int, - private val viewHolder: (v: View) -> VH + private val viewHolder: (v: View) -> VH, + private val type: Int = layoutRes ) : AbstractItem<Item, VH>() where Item : IItem<*, *>, Item : IClickable<*> { override final fun getType(): Int = type override final fun getViewHolder(v: View): VH = viewHolder(v) diff --git a/core/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt b/core/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt index ac8ec2e..96dc789 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt @@ -29,9 +29,9 @@ class SearchItem(val key: String, val iicon: IIcon? = GoogleMaterial.Icon.gmd_search, val image: Drawable? = null ) : KauIItem<SearchItem, SearchItem.ViewHolder>( - R.id.kau_item_search, R.layout.kau_search_iitem, - {ViewHolder(it)} + { ViewHolder(it) }, + R.id.kau_item_search ) { companion object { |