pull/2661/head
Horis 2 years ago
parent 59e9f3213d
commit 08b89b9844
  1. 6
      app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt

@ -84,7 +84,11 @@ class ExploreShowActivity : VMBaseActivity<ActivityExploreShowBinding, ExploreSh
} }
override fun isInBookshelf(name: String, author: String): Boolean { override fun isInBookshelf(name: String, author: String): Boolean {
return viewModel.bookshelf.contains("$name-$author") return if (author.isNotBlank()) {
viewModel.bookshelf.contains("$name-$author")
} else {
viewModel.bookshelf.any { it.startsWith("$name-") }
}
} }
override fun showBookInfo(book: Book) { override fun showBookInfo(book: Book) {

@ -408,7 +408,11 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
* 是否已经加入书架 * 是否已经加入书架
*/ */
override fun isInBookshelf(name: String, author: String): Boolean { override fun isInBookshelf(name: String, author: String): Boolean {
return viewModel.bookshelf.contains("$name-$author") return if (author.isNotBlank()) {
viewModel.bookshelf.contains("$name-$author")
} else {
viewModel.bookshelf.any { it.startsWith("$name-") }
}
} }
/** /**

Loading…
Cancel
Save