From 636c4bb04e4fcd723766b82732990cdb4ae4ea2e Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 22 二月 2024 15:48:23 +0800
Subject: [PATCH] 删除掉本地库
---
app/src/main/java/com/hdl/photovoltaic/utils/GlideUtils.java | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/utils/GlideUtils.java b/app/src/main/java/com/hdl/photovoltaic/utils/GlideUtils.java
index cfeb8b5..c76747d 100644
--- a/app/src/main/java/com/hdl/photovoltaic/utils/GlideUtils.java
+++ b/app/src/main/java/com/hdl/photovoltaic/utils/GlideUtils.java
@@ -11,15 +11,22 @@
import android.graphics.RectF;
import android.widget.ImageView;
+import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.DataSource;
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.bumptech.glide.load.resource.gif.GifDrawable;
+import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
+import com.bumptech.glide.request.target.Target;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.other.HdlThreadLogic;
@@ -123,7 +130,7 @@
if (conn.getResponseCode() == 200) {
InputStream inStream = conn.getInputStream();
Bitmap bitmap = BitmapFactory.decodeStream(inStream);
- imageView.setImageBitmap(getRoundedCornerBitmap(bitmap,pixels));
+ imageView.setImageBitmap(getRoundedCornerBitmap(bitmap, pixels));
}
} catch (Exception e) {
}
@@ -160,4 +167,39 @@
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
+
+
+ /**
+ * 鐣岄潰绾挎暟鎹樉绀烘牱寮�
+ *
+ * @param context 涓婁笅鏂�
+ * @param imageview 鏄剧ず鍥剧墖缁勪欢
+ */
+ public static void getDrawableGifAnimation(Context context, ImageView imageview) {
+ if (context == null) {
+ return;
+ }
+ if (imageview == null) {
+ return;
+ }
+ Glide.with(context)
+ .asGif()
+ .load(R.drawable.null_data_icon)//(res鎴栬�単if鐨剈rl閾炬帴)
+ .diskCacheStrategy(DiskCacheStrategy.ALL)
+ .listener(new RequestListener<GifDrawable>() {
+ @Override
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
+ return false;
+ }
+
+ @Override
+ public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
+// resource.setLoopCount(1);鎺у埗鎾斁娆℃暟
+ return false;
+ }
+ })
+ .into(imageview);
+ }
+
+
}
--
Gitblit v1.8.0