diff --git a/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt b/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt index 066fdf99c..f2b351c68 100644 --- a/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt @@ -22,10 +22,13 @@ class ChangeCoverViewModel(application: Application) : BaseViewModel(application fun initData() { execute { - App.db.searchBookDao().getEnableHasCover(name, author).let { + App.db.searchBookDao().getEnableHasCover(name, author) + }.onSuccess { + it?.let { callBack?.adapter?.setItems(it) - search() } + }.onFinally { + search() } } diff --git a/app/src/main/java/io/legado/app/ui/changecover/CoverAdapter.kt b/app/src/main/java/io/legado/app/ui/changecover/CoverAdapter.kt index ba250a8a2..f952a8b20 100644 --- a/app/src/main/java/io/legado/app/ui/changecover/CoverAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/changecover/CoverAdapter.kt @@ -16,6 +16,7 @@ class CoverAdapter(context: Context) : with(holder.itemView) { item.coverUrl?.let { ImageLoader.load(context, it) + .error(R.drawable.image_cover_default) .centerCrop() .into(iv_cover) } diff --git a/app/src/main/res/layout/item_cover.xml b/app/src/main/res/layout/item_cover.xml index 018b5f2f8..b80cf9b6c 100644 --- a/app/src/main/res/layout/item_cover.xml +++ b/app/src/main/res/layout/item_cover.xml @@ -15,7 +15,6 @@ android:layout_height="100dp" android:contentDescription="@string/img_cover" android:scaleType="centerCrop" - android:src="@drawable/image_cover_default" android:transitionName="img_cover" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent"