From 85dfd302749ef965c8664442f4d4f8ad754382f9 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 3 Feb 2020 20:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/changecover/ChangeCoverViewModel.kt | 7 +++++-- .../main/java/io/legado/app/ui/changecover/CoverAdapter.kt | 1 + app/src/main/res/layout/item_cover.xml | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) 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"