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

@ -67,13 +67,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
} }
} }
} }
searchBook.coverUrl.let { iv_cover.load(searchBook.coverUrl, searchBook.name)
ImageLoader.load(context, it)//Glide自动识别http://和file://
.placeholder(R.drawable.image_cover_default)
.error(R.drawable.image_cover_default)
.centerCrop()
.into(iv_cover)
}
onClick { onClick {
callBack.showBookInfo(searchBook.name, searchBook.author) 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 this.name = name
invalidate() invalidate()
} }
@ -81,7 +81,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView {
minimumWidth = width minimumWidth = width
} }
fun load(path: String?, name: String) { fun load(path: String?, name: String?) {
if (path.isNullOrEmpty()) { if (path.isNullOrEmpty()) {
setName(name) setName(name)
} else { } else {
@ -106,6 +106,7 @@ class CoverImageView : androidx.appcompat.widget.AppCompatImageView {
dataSource: DataSource?, dataSource: DataSource?,
isFirstResource: Boolean isFirstResource: Boolean
): Boolean { ): Boolean {
setName(null)
return false return false
} }

Loading…
Cancel
Save