pull/84/head
kunfei 5 years ago
parent d1d91d95d7
commit 85dfd30274
  1. 7
      app/src/main/java/io/legado/app/ui/changecover/ChangeCoverViewModel.kt
  2. 1
      app/src/main/java/io/legado/app/ui/changecover/CoverAdapter.kt
  3. 1
      app/src/main/res/layout/item_cover.xml

@ -22,10 +22,13 @@ class ChangeCoverViewModel(application: Application) : BaseViewModel(application
fun initData() { fun initData() {
execute { execute {
App.db.searchBookDao().getEnableHasCover(name, author).let { App.db.searchBookDao().getEnableHasCover(name, author)
}.onSuccess {
it?.let {
callBack?.adapter?.setItems(it) callBack?.adapter?.setItems(it)
search()
} }
}.onFinally {
search()
} }
} }

@ -16,6 +16,7 @@ class CoverAdapter(context: Context) :
with(holder.itemView) { with(holder.itemView) {
item.coverUrl?.let { item.coverUrl?.let {
ImageLoader.load(context, it) ImageLoader.load(context, it)
.error(R.drawable.image_cover_default)
.centerCrop() .centerCrop()
.into(iv_cover) .into(iv_cover)
} }

@ -15,7 +15,6 @@
android:layout_height="100dp" android:layout_height="100dp"
android:contentDescription="@string/img_cover" android:contentDescription="@string/img_cover"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/image_cover_default"
android:transitionName="img_cover" android:transitionName="img_cover"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"

Loading…
Cancel
Save