feat: 刷新时只刷新当前书架

pull/248/head
gedoor 5 years ago
parent 5b0323d492
commit b62490b7a2
  1. 4
      app/src/main/assets/updateLog.md
  2. 5
      app/src/main/java/io/legado/app/ui/main/MainViewModel.kt
  3. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt

@ -3,6 +3,10 @@
* 请关注公众号[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
* 新公众号[开源阅读]()已启用,[开源阅读软件]()备用
**2020/06/16**
* 刷新时只刷新当前书架
* 修复恢复备份需要退出重进的问题
**2020/06/15**
* 添加 E-Ink 模式 by Modificator
* 修复发现打开书时可能的错误

@ -4,6 +4,7 @@ import android.app.Application
import io.legado.app.App
import io.legado.app.base.BaseViewModel
import io.legado.app.constant.EventBus
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.RssSource
import io.legado.app.help.http.HttpHelper
import io.legado.app.help.storage.Restore
@ -17,9 +18,9 @@ import kotlinx.coroutines.delay
class MainViewModel(application: Application) : BaseViewModel(application) {
val updateList = hashSetOf<String>()
fun upChapterList() {
fun upChapterList(books: List<Book>) {
execute {
App.db.bookDao().hasUpdateBooks.forEach { book ->
books.forEach { book ->
if (!updateList.contains(book.bookUrl)) {
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource ->
synchronized(this) {

@ -67,7 +67,7 @@ class BooksFragment : BaseFragment(R.layout.fragment_books),
refresh_layout.setColorSchemeColors(accentColor)
refresh_layout.setOnRefreshListener {
refresh_layout.isRefreshing = false
activityViewModel.upChapterList()
activityViewModel.upChapterList(booksAdapter.getItems())
}
val bookshelfLayout = getPrefInt(PreferKey.bookshelfLayout)
if (bookshelfLayout == 0) {

Loading…
Cancel
Save