From cb64d0973e3dfc284c3d5407eb84499118770549 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 26 Aug 2020 22:21:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E4=B8=8B=E8=BD=BD=E7=AB=A0=E8=8A=82?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=98=8E=E6=98=BE=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/chapterlist/ChapterListAdapter.kt | 11 ++++--- app/src/main/res/layout/item_chapter_list.xml | 31 +++++++++++++++---- 2 files changed, 31 insertions(+), 11 deletions(-) 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 6ea580b31..f1043a2a4 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 @@ -1,7 +1,7 @@ package io.legado.app.ui.book.chapterlist import android.content.Context -import android.widget.TextView +import android.view.View import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter @@ -33,12 +33,12 @@ class ChapterListAdapter(context: Context, val callback: Callback) : tv_tag.visible() } upHasCache( - tv_chapter_name, + this, cacheFileNames.contains(BookHelp.formatChapterName(item)) ) } else { upHasCache( - tv_chapter_name, + this, cacheFileNames.contains(BookHelp.formatChapterName(item)) ) } @@ -53,8 +53,9 @@ class ChapterListAdapter(context: Context, val callback: Callback) : } } - private fun upHasCache(textView: TextView, contains: Boolean) { - textView.paint.isFakeBoldText = contains + private fun upHasCache(itemView: View, contains: Boolean) = itemView.apply { + tv_chapter_name.paint.isFakeBoldText = contains + iv_checked.visible(contains) } interface Callback { diff --git a/app/src/main/res/layout/item_chapter_list.xml b/app/src/main/res/layout/item_chapter_list.xml index bd678b4fe..aea6a6cfd 100644 --- a/app/src/main/res/layout/item_chapter_list.xml +++ b/app/src/main/res/layout/item_chapter_list.xml @@ -1,5 +1,6 @@ - + android:singleLine="true" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/iv_checked" /> + android:singleLine="true" + app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toLeftOf="@+id/iv_checked" /> - \ No newline at end of file + + + \ No newline at end of file