pull/84/head
kunfei 5 years ago
parent da891e1227
commit 150d1b15bc
  1. 7
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt
  2. 8
      app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt
  3. 5
      app/src/main/java/io/legado/app/ui/widget/image/CoverImageView.kt

@ -8,7 +8,6 @@ import androidx.lifecycle.Observer
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.data.entities.Book
import io.legado.app.help.ImageLoader
import io.legado.app.ui.changecover.ChangeCoverDialog
import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_book_info_edit.*
@ -59,10 +58,8 @@ class BookInfoEditActivity :
}
private fun upCover() {
viewModel.book?.getDisplayCover()?.let {
ImageLoader.load(this, it)
.centerCrop()
.into(iv_cover)
viewModel.book.let {
iv_cover.load(it?.getDisplayCover(), it?.name)
}
}

@ -67,13 +67,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
}
}
}
searchBook.coverUrl.let {
ImageLoader.load(context, it)//Glide自动识别http://和file://
.placeholder(R.drawable.image_cover_default)
.error(R.drawable.image_cover_default)
.centerCrop()
.into(iv_cover)
}
iv_cover.load(searchBook.coverUrl, searchBook.name)
onClick {
callBack.showBookInfo(searchBook.name, searchBook.author)
}

@ -71,7 +71,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView {
}
}
fun setName(name: String) {
fun setName(name: String?) {
this.name = name
invalidate()
}
@ -81,7 +81,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView {
minimumWidth = width
}
fun load(path: String?, name: String) {
fun load(path: String?, name: String?) {
if (path.isNullOrEmpty()) {
setName(name)
} else {
@ -106,6 +106,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView {
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
setName(null)
return false
}

Loading…
Cancel
Save