From 454e8bb934ec82676196d67a80477e91cdbff9af Mon Sep 17 00:00:00 2001 From: juntao Date: Wed, 29 Sep 2021 12:00:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20MUMU=20=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/gh/common/util/ImageUtils.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/gh/common/util/ImageUtils.kt b/app/src/main/java/com/gh/common/util/ImageUtils.kt index c995e01a55..6fa5f4fc54 100644 --- a/app/src/main/java/com/gh/common/util/ImageUtils.kt +++ b/app/src/main/java/com/gh/common/util/ImageUtils.kt @@ -426,9 +426,6 @@ object ImageUtils { // 低于 2G 运行内存的不加载 gif val shouldLoadAsGif = url.endsWith(".gif") - && isAutoPlayGif - && (HaloApp.getInstance().deviceRamSize == 0L || HaloApp.getInstance().deviceRamSize > 2500) - && view?.getTag(R.id.tag_show_gif) != false if (shouldLoadAsGif && view?.tag == url) return@execute @@ -440,7 +437,9 @@ object ImageUtils { highResUrl = resizeGif(url, view!!.width, height ?: 0) loadImageClosure(shouldLoadAsGif, highResUrl, lowResUrl) } else { - view?.post { + // view.post { } 里面的方法体在 MUMU 模拟器上不会被调用?????????????? + runOnUiThread { + view ?: return@runOnUiThread highResUrl = resizeGif(url, view.width, height ?: 0) loadImageClosure(shouldLoadAsGif, highResUrl, lowResUrl) } @@ -547,7 +546,9 @@ object ImageUtils { private fun resizeGif(url: String, width: Int, height: Int): String { val idealSize = getIdealGifSize(width, height) - return "$url?x-oss-process=image/resize,h_$idealSize,w_$idealSize".also { addCachedUrl(it) } + return "$url?x-oss-process=image/resize,h_$idealSize,w_$idealSize".also { addCachedUrl(it) + Utils.log(it) + } } private fun getIdealGifSize(width: Int, height: Int): String {