diff --git a/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListAdapter.kt index f1043a2a4..17970bc65 100644 --- a/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListAdapter.kt @@ -21,8 +21,10 @@ class ChapterListAdapter(context: Context, val callback: Callback) : override fun convert(holder: ItemViewHolder, item: BookChapter, payloads: MutableList) { with(holder.itemView) { + val isDur = callback.durChapterIndex() == item.index + val cached = cacheFileNames.contains(BookHelp.formatChapterName(item)) if (payloads.isEmpty()) { - if (callback.durChapterIndex() == item.index) { + if (isDur) { tv_chapter_name.setTextColor(context.accentColor) } else { tv_chapter_name.setTextColor(context.getCompatColor(R.color.primaryText)) @@ -32,15 +34,9 @@ class ChapterListAdapter(context: Context, val callback: Callback) : tv_tag.text = item.tag tv_tag.visible() } - upHasCache( - this, - cacheFileNames.contains(BookHelp.formatChapterName(item)) - ) + upHasCache(this, isDur, cached) } else { - upHasCache( - this, - cacheFileNames.contains(BookHelp.formatChapterName(item)) - ) + upHasCache(this, isDur, cached) } } } @@ -53,9 +49,14 @@ class ChapterListAdapter(context: Context, val callback: Callback) : } } - private fun upHasCache(itemView: View, contains: Boolean) = itemView.apply { - tv_chapter_name.paint.isFakeBoldText = contains - iv_checked.visible(contains) + private fun upHasCache(itemView: View, isDur: Boolean, cached: Boolean) = itemView.apply { + tv_chapter_name.paint.isFakeBoldText = cached + iv_checked.setImageResource(R.drawable.ic_outline_cloud_24) + iv_checked.visible(!cached) + if (isDur) { + iv_checked.setImageResource(R.drawable.ic_check) + iv_checked.visible() + } } interface Callback { diff --git a/app/src/main/res/drawable/ic_outline_cloud_24.xml b/app/src/main/res/drawable/ic_outline_cloud_24.xml new file mode 100644 index 000000000..c8b092ead --- /dev/null +++ b/app/src/main/res/drawable/ic_outline_cloud_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/item_chapter_list.xml b/app/src/main/res/layout/item_chapter_list.xml index aea6a6cfd..b0e9d4f23 100644 --- a/app/src/main/res/layout/item_chapter_list.xml +++ b/app/src/main/res/layout/item_chapter_list.xml @@ -34,7 +34,7 @@ android:src="@drawable/ic_check" android:visibility="invisible" android:contentDescription="@string/success" - app:tint="@color/primaryText" + app:tint="@color/secondaryText" app:layout_constraintTop_toTopOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintBottom_toBottomOf="parent" />