feat: 优化代码

pull/103/head
kunfei 5 years ago
parent c3e7e3af6f
commit 7b501bd6d8
  1. 7
      app/src/main/java/io/legado/app/base/adapter/CommonRecyclerAdapter.kt

@ -339,6 +339,9 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
)
)
itemDelegates.getValue(viewType)
.registerListener(holder)
if (itemClickListener != null) {
holder.itemView.setOnClickListener {
getItem(holder.layoutPosition)?.let {
@ -374,10 +377,6 @@ abstract class CommonRecyclerAdapter<ITEM>(protected val context: Context) :
itemDelegates.getValue(getItemViewType(holder.layoutPosition))
.convert(holder, it, payloads)
}
if (payloads.isEmpty()) {
itemDelegates.getValue(getItemViewType(holder.layoutPosition))
.registerListener(holder)
}
}
}

Loading…
Cancel
Save