1:羽声新版本
This commit is contained in:
@@ -150,25 +150,30 @@ public class ImageUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
// 没有缓存,正常加载
|
||||
SVGAParser parser = SVGAParser.Companion.shareParser();
|
||||
parser.decodeFromInputStream(mImageView.getContext().getResources().openRawResource(resourceId), "", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
|
||||
if (mImageView != null) {
|
||||
// 缓存实体
|
||||
svgaCache.put(resourceId, svgaVideoEntity);
|
||||
SVGADrawable svgaDrawable = new SVGADrawable(svgaVideoEntity);
|
||||
mImageView.setImageDrawable(svgaDrawable);
|
||||
mImageView.startAnimation();
|
||||
try {
|
||||
// 没有缓存,正常加载
|
||||
SVGAParser parser = SVGAParser.Companion.shareParser();
|
||||
InputStream inputStream = mImageView.getContext().getResources().openRawResource(resourceId);
|
||||
parser.decodeFromAssets("heart_line_31.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
|
||||
if (mImageView != null) {
|
||||
// 缓存实体
|
||||
svgaCache.put(resourceId, svgaVideoEntity);
|
||||
SVGADrawable svgaDrawable = new SVGADrawable(svgaVideoEntity);
|
||||
mImageView.setImageDrawable(svgaDrawable);
|
||||
mImageView.startAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.e("loadDecorationAvatar2 error");
|
||||
}
|
||||
}, true);
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.e("loadDecorationAvatar2 error, resourceId: " + resourceId);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Logger.e("loadDecorationAvatar2 exception, resourceId: " + resourceId, e);
|
||||
}
|
||||
} else {
|
||||
Logger.e("Resource ID is 0 or invalid");
|
||||
}
|
||||
@@ -176,6 +181,7 @@ public class ImageUtils {
|
||||
|
||||
|
||||
|
||||
|
||||
public static void loadHeadCC(String path, ImageView mImageView) {
|
||||
Glide.with(mImageView).load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
|
||||
|
||||
@@ -195,6 +201,7 @@ public class ImageUtils {
|
||||
|
||||
public static void loadRes(int path, ImageView mImageView) {
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -561,5 +568,8 @@ public class ImageUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearDiskCache(Context context){
|
||||
Glide.get(context).clearDiskCache();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user