pull/36/head
kunfei 5 years ago
parent 7ba212b449
commit b2ac302c45
  1. 2
      app/src/main/java/io/legado/app/ui/main/bookshelf/BooksAdapter.kt
  2. 6
      app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt

@ -35,7 +35,7 @@ class BooksAdapter(private val callBack: CallBack) :
}
fun notification(bookUrl: String) {
for (i in 0..itemCount) {
for (i in 0 until itemCount) {
getItem(i)?.let {
if (it.bookUrl == bookUrl) {
notifyItemChanged(i)

@ -12,6 +12,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.VMBaseFragment
import io.legado.app.constant.Bus
import io.legado.app.data.entities.Book
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
@ -20,6 +21,7 @@ import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.main.MainViewModel
import io.legado.app.utils.getViewModel
import io.legado.app.utils.getViewModelOfActivity
import io.legado.app.utils.observeEvent
import kotlinx.android.synthetic.main.fragment_books.*
import org.jetbrains.anko.startActivity
@ -52,6 +54,9 @@ class BooksFragment : VMBaseFragment<BooksViewModel>(R.layout.fragment_books),
}
initRecyclerView()
upRecyclerData()
observeEvent<String>(Bus.UP_BOOK) {
booksAdapter.notification(it)
}
}
private fun initRecyclerView() {
@ -70,7 +75,6 @@ class BooksFragment : VMBaseFragment<BooksViewModel>(R.layout.fragment_books),
})
booksAdapter = BooksAdapter(this)
rv_bookshelf.adapter = booksAdapter
}
private fun upRecyclerData() {

Loading…
Cancel
Save