diff --git a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt index f70e6beaf..8a8e80ddd 100644 --- a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListAdapter.kt @@ -1,10 +1,10 @@ package io.legado.app.ui.chapterlist import android.content.Context +import android.widget.TextView import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter -import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter import io.legado.app.help.BookHelp import io.legado.app.lib.theme.accentColor @@ -35,17 +35,24 @@ class ChapterListAdapter(context: Context, val callback: Callback) : this.onClick { callback.openChapter(item) } - tv_chapter_name.paint.isFakeBoldText = + upHasCache( + tv_chapter_name, cacheFileNames.contains(BookHelp.formatChapterName(item)) + ) } else { - tv_chapter_name.paint.isFakeBoldText = + upHasCache( + tv_chapter_name, cacheFileNames.contains(BookHelp.formatChapterName(item)) + ) } } } + private fun upHasCache(textView: TextView, contains: Boolean) { + textView.paint.isFakeBoldText = contains + } + interface Callback { - fun book(): Book? fun openChapter(bookChapter: BookChapter) fun durChapterIndex(): Int } diff --git a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt index 964862e0b..610984b22 100644 --- a/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt +++ b/app/src/main/java/io/legado/app/ui/chapterlist/ChapterListFragment.kt @@ -118,7 +118,4 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragme activity?.finish() } - override fun book(): Book? { - return book - } } \ No newline at end of file