pull/737/head
gedoor 4 years ago
parent 1cee5a5cf5
commit b0f9a3981d
  1. 3
      app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt
  2. 3
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt

@ -7,7 +7,6 @@ import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
@ -93,9 +92,7 @@ class ChangeCoverDialog : BaseDialogFragment(),
binding.toolBar.menu.applyTint(requireContext(), Theme.getTheme())
})
viewModel.searchBooksLiveData.observe(viewLifecycleOwner, {
val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), it))
adapter.setItems(it)
diffResult.dispatchUpdatesTo(adapter)
})
}

@ -5,7 +5,6 @@ import android.view.*
import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.legado.app.App
@ -145,9 +144,7 @@ class ChangeSourceDialog : BaseDialogFragment(),
binding.toolBar.menu.applyTint(requireContext())
})
viewModel.searchBooksLiveData.observe(viewLifecycleOwner, {
val diffResult = DiffUtil.calculateDiff(DiffCallBack(adapter.getItems(), it))
adapter.setItems(it)
diffResult.dispatchUpdatesTo(adapter)
})
App.db.bookSourceDao.liveGroupEnabled().observe(this, {
groups.clear()

@ -102,7 +102,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
private fun startSearch() {
execute {
bookSourceList.clear()
if (searchGroup.isNullOrBlank()) {
if (searchGroup.isBlank()) {
bookSourceList.addAll(App.db.bookSourceDao.allEnabled)
} else {
bookSourceList.addAll(App.db.bookSourceDao.getEnabledByGroup(searchGroup))

Loading…
Cancel
Save