pull/341/head
gedoor 4 years ago
parent aa49ef53e5
commit 4246bcd27d
  1. 5
      app/src/main/java/io/legado/app/ui/main/explore/ExploreFragment.kt

@ -7,7 +7,6 @@ import android.view.SubMenu
import android.view.View import android.view.View
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -93,7 +92,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_find_
private fun initGroupData() { private fun initGroupData() {
liveGroup?.removeObservers(viewLifecycleOwner) liveGroup?.removeObservers(viewLifecycleOwner)
liveGroup = App.db.bookSourceDao().liveGroupExplore() liveGroup = App.db.bookSourceDao().liveGroupExplore()
liveGroup?.observe(viewLifecycleOwner, Observer { liveGroup?.observe(viewLifecycleOwner, {
groups.clear() groups.clear()
it.map { group -> it.map { group ->
groups.addAll(group.splitNotBlank(",", ";")) groups.addAll(group.splitNotBlank(",", ";"))
@ -109,7 +108,7 @@ class ExploreFragment : VMBaseFragment<ExploreViewModel>(R.layout.fragment_find_
} else { } else {
App.db.bookSourceDao().liveExplore("%$key%") App.db.bookSourceDao().liveExplore("%$key%")
} }
liveExplore?.observe(viewLifecycleOwner, Observer { liveExplore?.observe(viewLifecycleOwner, {
val diffResult = DiffUtil val diffResult = DiffUtil
.calculateDiff(ExploreDiffCallBack(ArrayList(adapter.getItems()), it)) .calculateDiff(ExploreDiffCallBack(ArrayList(adapter.getItems()), it))
adapter.setItems(it) adapter.setItems(it)

Loading…
Cancel
Save