bg闪退问题修改.
This commit is contained in:
@@ -322,7 +322,7 @@ public class ImageUtils {
|
|||||||
* @param url 图片 URL
|
* @param url 图片 URL
|
||||||
* @param imageView 目标 ImageView
|
* @param imageView 目标 ImageView
|
||||||
*/
|
*/
|
||||||
public static void loadImageWithCache(Context context, String url, ImageView imageView) {
|
public static void loadImageWithCache(String url, ImageView imageView) {
|
||||||
if (TextUtils.isEmpty(url)) return;
|
if (TextUtils.isEmpty(url)) return;
|
||||||
|
|
||||||
// 去掉动态参数,提取稳定 URL
|
// 去掉动态参数,提取稳定 URL
|
||||||
@@ -330,7 +330,7 @@ public class ImageUtils {
|
|||||||
String signature = Md5Utils.getMD5String(stableUrl); // 使用 MD5 生成唯一签名
|
String signature = Md5Utils.getMD5String(stableUrl); // 使用 MD5 生成唯一签名
|
||||||
|
|
||||||
// Glide 加载配置
|
// Glide 加载配置
|
||||||
Glide.with(context)
|
Glide.with(imageView)
|
||||||
.load(stableUrl)
|
.load(stableUrl)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) // 缓存所有版本
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) // 缓存所有版本
|
||||||
.signature(new ObjectKey(signature)) // 使用签名确保缓存一致
|
.signature(new ObjectKey(signature)) // 使用签名确保缓存一致
|
||||||
|
|||||||
@@ -2685,7 +2685,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
|||||||
*/
|
*/
|
||||||
fun changeBackgroundColor(bjId: String?) {
|
fun changeBackgroundColor(bjId: String?) {
|
||||||
// 假设你的Activity有一个根布局,例如 ConstraintLayout
|
// 假设你的Activity有一个根布局,例如 ConstraintLayout
|
||||||
ImageUtils.loadImageWithCache(this, bjId, mBinding!!.ivBg)
|
ImageUtils.loadImageWithCache(bjId, mBinding!!.ivBg)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun changeBackground(bjId: Int) {
|
fun changeBackground(bjId: Int) {
|
||||||
|
|||||||
Reference in New Issue
Block a user