|
|
@ -14,9 +14,9 @@ import kotlinx.android.synthetic.main.item_search.view.* |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
|
|
|
|
class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
SimpleRecyclerAdapter<SearchEntry>(context, R.layout.item_search) { |
|
|
|
SimpleRecyclerAdapter<SearchEntity>(context, R.layout.item_search) { |
|
|
|
|
|
|
|
|
|
|
|
override fun convert(holder: ItemViewHolder, item: SearchEntry, payloads: MutableList<Any>) { |
|
|
|
override fun convert(holder: ItemViewHolder, item: SearchEntity, payloads: MutableList<Any>) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
bind(holder.itemView, item) |
|
|
|
bind(holder.itemView, item) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -24,7 +24,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun bind(itemView: View, searchBook: SearchEntry) { |
|
|
|
private fun bind(itemView: View, searchBook: SearchEntity) { |
|
|
|
with(itemView) { |
|
|
|
with(itemView) { |
|
|
|
tv_name.text = searchBook.name |
|
|
|
tv_name.text = searchBook.name |
|
|
|
tv_author.text = context.getString(R.string.author_show, searchBook.author) |
|
|
|
tv_author.text = context.getString(R.string.author_show, searchBook.author) |
|
|
@ -79,7 +79,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) : |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun bindChange(itemView: View, searchBook: SearchEntry, payloads: MutableList<Any>) { |
|
|
|
private fun bindChange(itemView: View, searchBook: SearchEntity, payloads: MutableList<Any>) { |
|
|
|
with(itemView) { |
|
|
|
with(itemView) { |
|
|
|
when (payloads[0]) { |
|
|
|
when (payloads[0]) { |
|
|
|
1 -> bv_originCount.setBadgeCount(searchBook.originCount) |
|
|
|
1 -> bv_originCount.setBadgeCount(searchBook.originCount) |
|
|
|