搜索与发现项优化 #146
This commit is contained in:
@@ -43,7 +43,6 @@ class ExploreShowActivity : VMBaseActivity<ActivityExploreShowBinding, ExploreSh
|
||||
}
|
||||
|
||||
private fun initRecyclerView() {
|
||||
binding.recyclerView.addItemDecoration(VerticalDivider(this))
|
||||
binding.recyclerView.adapter = adapter
|
||||
binding.recyclerView.applyNavigationBarPadding()
|
||||
adapter.addFooterView {
|
||||
|
||||
@@ -53,10 +53,13 @@ class ExploreShowAdapter(context: Context, val callBack: CallBack) :
|
||||
tvIntroduce.text = item.trimIntro(context)
|
||||
val kinds = item.getKindList()
|
||||
if (kinds.isEmpty()) {
|
||||
llKind.gone()
|
||||
tvKind.gone()
|
||||
tvAuthorKind.gone()
|
||||
} else {
|
||||
llKind.visible()
|
||||
llKind.setLabels(kinds) {}
|
||||
tvAuthorKind.visible()
|
||||
tvKind.visible()
|
||||
val kindText = kinds.joinToString(" • ")
|
||||
tvKind.text = kindText
|
||||
}
|
||||
ivCover.load(
|
||||
item.coverUrl,
|
||||
@@ -80,7 +83,7 @@ class ExploreShowAdapter(context: Context, val callBack: CallBack) :
|
||||
}
|
||||
|
||||
override fun registerListener(holder: ItemViewHolder, binding: ItemSearchBinding) {
|
||||
holder.itemView.setOnClickListener {
|
||||
binding.llContent.setOnClickListener {
|
||||
getItem(holder.layoutPosition)?.let {
|
||||
callBack.showBookInfo(it.toBook())
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
|
||||
}
|
||||
|
||||
override fun registerListener(holder: ItemViewHolder, binding: ItemSearchBinding) {
|
||||
binding.root.setOnClickListener {
|
||||
binding.llContent.setOnClickListener {
|
||||
getItem(holder.layoutPosition)?.let {
|
||||
callBack.showBookInfo(it.name, it.author, it.bookUrl)
|
||||
}
|
||||
@@ -135,12 +135,13 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
|
||||
|
||||
private fun upKind(binding: ItemSearchBinding, kinds: List<String>) = binding.run {
|
||||
if (kinds.isEmpty()) {
|
||||
llKind.gone()
|
||||
tvKind.gone()
|
||||
tvAuthorKind.gone()
|
||||
} else {
|
||||
llKind.visible()
|
||||
llKind.setLabels(kinds) { chips ->
|
||||
chips.textSize = 12f
|
||||
}
|
||||
tvAuthorKind.visible()
|
||||
tvKind.visible()
|
||||
val kindText = kinds.joinToString(" • ")
|
||||
tvKind.text = kindText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user