diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index b0e5575f8..85d5aaa87 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -108,6 +108,9 @@ object BookHelp { fun getChapterFiles(book: Book): List { val fileNameList = arrayListOf() + if (book.isLocalBook()) { + return fileNameList + } FileUtils.createFolderIfNotExist( downloadDir, subDirs = arrayOf(cacheFolderName, book.getFolderName()) 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 17970bc65..5d4b3621b 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 @@ -22,7 +22,8 @@ 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)) + val cached = callback.isLocalBook + || cacheFileNames.contains(BookHelp.formatChapterName(item)) if (payloads.isEmpty()) { if (isDur) { tv_chapter_name.setTextColor(context.accentColor) @@ -60,6 +61,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) : } interface Callback { + val isLocalBook: Boolean fun openChapter(bookChapter: BookChapter) fun durChapterIndex(): Int } diff --git a/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListFragment.kt b/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListFragment.kt index 58d47efeb..d4339bb23 100644 --- a/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListFragment.kt +++ b/app/src/main/java/io/legado/app/ui/book/chapterlist/ChapterListFragment.kt @@ -129,6 +129,9 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragme } } + override val isLocalBook: Boolean + get() = viewModel.book?.isLocalBook() == true + override fun durChapterIndex(): Int { return durChapterIndex } diff --git a/app/src/main/res/layout/item_chapter_list.xml b/app/src/main/res/layout/item_chapter_list.xml index b0e9d4f23..285af05ba 100644 --- a/app/src/main/res/layout/item_chapter_list.xml +++ b/app/src/main/res/layout/item_chapter_list.xml @@ -29,8 +29,8 @@