From d540934915da26ab2cec4c897e973be35e0bfe24 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 9 Sep 2018 11:59:24 -0400 Subject: Clean up kotterknife (#161) * Remove bindview implementations internally * Remove more bindView calls * Make config private in ElasticRecyclerActivity * Fix recyclerview * Update adapter * Improve swipe destroy and add direction to swipe finish --- .../main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt | 17 +++++++++-------- .../main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt | 5 ++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'adapter') 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 9fd5512..ba969a2 100644 --- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt +++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt @@ -71,7 +71,7 @@ class CardIItem( override fun bindView(holder: ViewHolder, payloads: MutableList) { super.bindView(holder, payloads) - with(holder.itemView.context) context@ { + with(holder.itemView.context) context@{ with(configs) { holder.title.text = string(titleRes, title) val descText = string(descRes, desc) @@ -82,7 +82,8 @@ class CardIItem( holder.button.text = buttonText } val icon = drawable(imageRes) { - imageIIcon?.toDrawable(this@context, sizeDp = 24, color = imageIIconColor) ?: image + imageIIcon?.toDrawable(this@context, sizeDp = 24, color = imageIIconColor) + ?: image } if (icon != null) holder.icon.visible().setImageDrawable(icon) } @@ -109,12 +110,12 @@ class CardIItem( } class ViewHolder(v: View) : RecyclerView.ViewHolder(v) { - val card: CardView by bindView(R.id.kau_card_container) - val icon: ImageView by bindView(R.id.kau_card_image) - val title: TextView by bindView(R.id.kau_card_title) - val description: TextView by bindView(R.id.kau_card_description) - val bottomRow: LinearLayout by bindView(R.id.kau_card_bottom_row) - val button: Button by bindView(R.id.kau_card_button) + val card: CardView = v.findViewById(R.id.kau_card_container) + val icon: ImageView = v.findViewById(R.id.kau_card_image) + val title: TextView = v.findViewById(R.id.kau_card_title) + val description: TextView = v.findViewById(R.id.kau_card_description) + val bottomRow: LinearLayout = v.findViewById(R.id.kau_card_bottom_row) + val button: Button = v.findViewById(R.id.kau_card_button) } } \ No newline at end of file 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 67e7d30..2116b34 100644 --- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt +++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt @@ -8,7 +8,6 @@ import ca.allanwang.kau.adapter.R import ca.allanwang.kau.adapters.ThemableIItem import ca.allanwang.kau.adapters.ThemableIItemDelegate import ca.allanwang.kau.utils.INVALID_ID -import ca.allanwang.kau.utils.bindView import ca.allanwang.kau.utils.string /** @@ -38,8 +37,8 @@ class HeaderIItem( } 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) + val text: TextView = v.findViewById(R.id.kau_header_text) + val container: CardView = v.findViewById(R.id.kau_header_container) } } \ No newline at end of file -- cgit v1.2.3