From f9664f3fe7f3b22599c437dc1d3eca4766793bfb Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 12 Feb 2020 20:05:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/chapterlist/ChapterListAdapter.kt | 15 +++++++++++---- .../app/ui/chapterlist/ChapterListFragment.kt | 3 --- 2 files changed, 11 insertions(+), 7 deletions(-) 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