class GlideEngine : ImageEngine {
override fun loadImage(context: Context, url: String?, imageView: ImageView) {
if (!ActivityCompatHelper.assertValidRequest(context)) {
return
}
Glide.with(context).load(url).into(imageView)
}
override fun loadImage(
context: Context,
url: String?,
width: Int,
height: Int,
imageView: ImageView
) {
Glide.with(context).load(url).override(width, height).into(imageView)
}
override fun loadAlbumCover(context: Context, url: String?, imageView: ImageView) {
if (!ActivityCompatHelper.assertValidRequest(context)) {
return
}
Glide.with(context).load(url)
.override(180, 180)
.transform(CenterCrop(), RoundedCorners(8))
.placeholder(R.drawable.ps_image_placeholder)
.into(imageView)
}
companion object {
fun create() = InstanceHelper.engine
}
object InstanceHelper {
val engine = GlideEngine()
}
}
}
赢无翳
- 发布:2024-10-18 13:03
- 更新:2024-10-18 13:03
- 阅读:63
0 个回复