diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 8de8fa6bf..78968466d 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,9 @@ * 请关注公众号[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。 * 新公众号[开源阅读]()已启用,[开源阅读软件]()备用 +**2020/06/09** +* 修复从发现界面打开已在书架的书时,显示不对的问题 + **2020/06/07** * 优化书源检测,自定义搜索关键词 * 失效书源如果校验为有效会去掉失效标志 diff --git a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt index 04bf86188..dbba6b63e 100644 --- a/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/explore/ExploreShowActivity.kt @@ -72,7 +72,8 @@ class ExploreShowActivity : VMBaseActivity(R.layout.activi override fun showBookInfo(book: Book) { startActivity( - Pair("bookUrl", book.bookUrl) + Pair("name", book.name), + Pair("author", book.author) ) } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt index 47dc6c33f..60b40e089 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt @@ -22,13 +22,13 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) { fun initData(intent: Intent) { execute { - intent.getStringExtra("bookUrl")?.let { - App.db.bookDao().getBook(it)?.let { book -> - inBookshelf = true - setBook(book) - } ?: App.db.searchBookDao().getSearchBook(it)?.toBook()?.let { book -> - setBook(book) - } + val name = intent.getStringExtra("name") ?: "" + val author = intent.getStringExtra("author") ?: "" + App.db.bookDao().getBook(name, author)?.let { book -> + inBookshelf = true + setBook(book) + } ?: App.db.searchBookDao().getFirstByNameAuthor(name, author)?.toBook()?.let { book -> + setBook(book) } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index a88af1b3b..1ea8ec8f6 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -242,7 +242,10 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo onReplaceRuleSave() } R.id.menu_book_info -> ReadBook.book?.let { - startActivity(Pair("bookUrl", it.bookUrl)) + startActivity( + Pair("name", it.name), + Pair("author", it.author) + ) } R.id.menu_toc_regex -> TocRegexDialog.show( supportFragmentManager, diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt index e81545adc..6daa679cc 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt @@ -317,7 +317,10 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se override fun showBookInfo(name: String, author: String) { viewModel.getSearchBook(name, author) { searchBook -> searchBook?.let { - startActivity(Pair("bookUrl", it.bookUrl)) + startActivity( + Pair("name", it.name), + Pair("author", it.author) + ) } } } @@ -327,7 +330,8 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se */ override fun showBookInfo(book: Book) { startActivity( - Pair("bookUrl", book.bookUrl) + Pair("name", book.name), + Pair("author", book.author) ) } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt index 137aaf184..a1390dc94 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt @@ -111,7 +111,10 @@ class BooksFragment : BaseFragment(R.layout.fragment_books), } override fun openBookInfo(book: Book) { - context?.startActivity(Pair("bookUrl", book.bookUrl)) + context?.startActivity( + Pair("name", book.name), + Pair("author", book.author) + ) } override fun isUpdate(bookUrl: String): Boolean {