您当前的位置: 首页 > 

Fresco 的封装,快速上手,图像后处理,超大图高清预览,缩小放大,双击放大等一一俱全

发布时间:2017-04-09 13:07:03 ,浏览量:0

FrescoUtils
项目地址: CarGuo/FrescoUtils
简介:Fresco 的封装,快速上手,图像后处理,超大图高清预览,缩小放大,双击放大等一一俱全。简书 http://www.jianshu.com/p/cd058a924288
因为某些原因,现在使用 jitpack.io,还请使用依赖的各位切换到 jitpack。 在 project 下的 build.gradle 添加
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
在 module 下的 build.gradle 添加
dependencies {
    compile 'com.github.CarGuo:FrescoUtils:v1.0.4'
}
1.0.4 update fresco to 1.0.1,update scaleImage to 3.6.0 1.0.3 update fresco to 1.0.0 1.0.2 最低 API 调整到 15 1.0.1 增加了额 FrescoHelper 直接超大图加载接口
/**
 * 超大图片的就接口
 *
 * @param context   上下玩
 * @param imageView 图片加载控件
 * @param imageUri  图片地址
 * @param defaultId 默认失败图片
 */
public static void loadBigImage(final Context context, final SubsamplingScaleImageView imageView, String imageUri, final int defaultId)
简书入口 这里有详细介绍 效果显示

 

动态图效果

 

记得记得在 Application 里初始化
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
        .setDownsampleEnabled(true)
        .build();
Fresco.initialize(this, config);
FrescoHelper 封装了针对 FrescoImageView 的工具类,直接使用 FrescoImageView 作为 ImageView 使用即可。

封装了多种类型,这是最全的一种

/**
 * @param imageView     图片加载控件
 * @param uri           路径或者 URL
 * @param defaultImg    默认图片
 * @param cornerRadius  弧形角度
 * @param isCircle      是否为圆
 * @param loadLocalPath 是否本地资源,如果显示 R.drawable.xxx,Path 可以为 null,前提 isCircle 为 true
 * @param isAnima       是否显示 GIF 动画
 * @param size          是否再编码
 * @param postprocessor 图像显示处理
 */
public static void loadFrescoImage(FrescoImageView imageView, String uri, int defaultImg,
                                   int cornerRadius, boolean isCircle, boolean loadLocalPath, boolean isAnima,
                                   Point size, Postprocessor postprocessor) {
    init(imageView, cornerRadius, isCircle, isAnima, size, postprocessor);
    if (loadLocalPath) {
        imageView.loadLocalImage(uri, defaultImg);
    } else {
        imageView.loadView(uri, defaultImg);
    }
}

···

FrescoHelper.loadFrescoImage(frescoImageView, recyclerDataModel.getUrl(), R.mipmap.ic_launcher, 2, false, recyclerDataModel.getSize(), new BlurPostprocessor(context, 10));
带有fresco-processors各种处理特效,高斯,五角形等。

带有subsampling-scale-image-view实现超高清图片超长图片不模糊显示。

带有PhotoDraweeView 功能与 PhotoView 一样,支持双击放大,单击返回,手动放大与缩小等。

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    110950博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0531s