|
@@ -9,10 +9,12 @@ import io.legado.app.base.adapter.RecyclerAdapter
|
|
|
import io.legado.app.data.entities.BookChapter
|
|
import io.legado.app.data.entities.BookChapter
|
|
|
import io.legado.app.databinding.ItemChapterListBinding
|
|
import io.legado.app.databinding.ItemChapterListBinding
|
|
|
import io.legado.app.lib.theme.accentColor
|
|
import io.legado.app.lib.theme.accentColor
|
|
|
|
|
+import io.legado.app.lib.theme.backgroundColor
|
|
|
|
|
+import io.legado.app.lib.theme.ThemeUtils
|
|
|
|
|
+import io.legado.app.help.AppConfig
|
|
|
import io.legado.app.utils.getCompatColor
|
|
import io.legado.app.utils.getCompatColor
|
|
|
import io.legado.app.utils.visible
|
|
import io.legado.app.utils.visible
|
|
|
|
|
|
|
|
-
|
|
|
|
|
class ChapterListAdapter(context: Context, val callback: Callback) :
|
|
class ChapterListAdapter(context: Context, val callback: Callback) :
|
|
|
RecyclerAdapter<BookChapter, ItemChapterListBinding>(context) {
|
|
RecyclerAdapter<BookChapter, ItemChapterListBinding>(context) {
|
|
|
|
|
|
|
@@ -30,6 +32,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
|
|
|
&& oldItem.isPay == newItem.isPay
|
|
&& oldItem.isPay == newItem.isPay
|
|
|
&& oldItem.title == newItem.title
|
|
&& oldItem.title == newItem.title
|
|
|
&& oldItem.tag == newItem.tag
|
|
&& oldItem.tag == newItem.tag
|
|
|
|
|
+ && oldItem.isVolume == newItem.isVolume
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -54,7 +57,15 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
|
|
|
tvChapterName.setTextColor(context.getCompatColor(R.color.primaryText))
|
|
tvChapterName.setTextColor(context.getCompatColor(R.color.primaryText))
|
|
|
}
|
|
}
|
|
|
tvChapterName.text = item.getDisplayTitle()
|
|
tvChapterName.text = item.getDisplayTitle()
|
|
|
- if (!item.tag.isNullOrEmpty()) {
|
|
|
|
|
|
|
+ if (item.isVolume) {
|
|
|
|
|
+ //卷名,如第一卷 突出显示
|
|
|
|
|
+ tvChapterItem.setBackgroundColor(context.getCompatColor(R.color.btn_bg_press))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //普通章节 保持不变
|
|
|
|
|
+ tvChapterItem.setBackground(ThemeUtils.resolveDrawable(context, android.R.attr.selectableItemBackground))
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!item.tag.isNullOrEmpty() && !item.isVolume) {
|
|
|
|
|
+ //卷名不显示tag(更新时间规则)
|
|
|
tvTag.text = item.tag
|
|
tvTag.text = item.tag
|
|
|
tvTag.visible()
|
|
tvTag.visible()
|
|
|
}
|
|
}
|