From b0f9a3981d0472d907a4e8dcc9e71fb761c5af83 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 16 Dec 2020 09:13:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/changecover/ChangeCoverDialog.kt | 3 --- .../io/legado/app/ui/book/changesource/ChangeSourceDialog.kt | 3 --- .../legado/app/ui/book/changesource/ChangeSourceViewModel.kt | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt b/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt index c842e0fae..c7a5130d4 100644 --- a/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.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) }) } diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index ef0d4661f..1c5071173 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt @@ -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() diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt index f52ad89d5..e4d3e3c17 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt @@ -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))