[M2] 默认图片更改, glide 加载图片设置

This commit is contained in:
wangmingjun
2023-03-10 17:05:06 +08:00
parent f39c75f7a8
commit 4b3b01919e
3 changed files with 6 additions and 4 deletions

View File

@@ -32,9 +32,10 @@ class AdvanceImageView @JvmOverloads constructor(
@SuppressLint("CheckResult")
fun setImagePath(path: String){
imageView?.setImageResource(R.drawable.m2_p_video_holder)
imageView?.let { Glide.with(context).load(path)
imageView?.let { Glide.with(context).asBitmap().load(path)
.apply(
RequestOptions().placeholder(R.drawable.m2_p_video_holder)
RequestOptions().useUnlimitedSourceGeneratorsPool(true)
.placeholder(R.drawable.m2_p_video_holder)
.error(R.drawable.m2_p_video_holder)
.fallback(R.drawable.m2_p_video_holder)
.centerCrop()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

@@ -471,9 +471,10 @@ class AdvanceImageView @JvmOverloads constructor(
fun setImagePath(path: String) {
imageView?.setImageResource(R.drawable.video_holder)
imageView?.let {
Glide.with(context).load(path)
Glide.with(context).asBitmap().load(path)
.apply(
RequestOptions().placeholder(R.drawable.video_holder)
RequestOptions().useUnlimitedSourceGeneratorsPool(true)
.placeholder(R.drawable.video_holder)
.error(R.drawable.video_holder)
.fallback(R.drawable.video_holder)
.centerCrop()