aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/ca')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt5
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt4
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 {