Glide 3.4.0 发布,Android 的媒体管理库

oschina
 oschina
发布于 2014年11月08日
收藏 68

Glide 是一个 Android 上的图片加载和缓存库,其目的是实现平滑的图片列表滚动效果。

Glide 3.4.0 发布,此版本现已提供下载,包括大量新特性和 bug 修复。此版本最值得关注的是动态 GIFs,可以通过 GifDecoder 来对 GIFs 进行解码,修复了相关的一些小问题,比如渲染和解码通道的问题。

更多内容请看 milestone

完整改进记录:

新特性

  • Allow RequestBuilders to be re-used for multiple loads by introducing the .from() and .clone() APIs. These APIs allow users to set options on a request builder once, pass the builder to their adapters, and then start multiple loads with the single builder (#182).

// In your Activity/Fragment@Overridepublic void onCreate(Bundle savedInstanceState) {    DrawableRequestBuilder requestBuilder = 
        Glide.with(this)
           .from(String.class)
           .placeholder(R.drawable.spinner)
           .centerCrop()
           .crossFade();
    mAdapter = new MyAdapter(requestBuilder);
}// In your Adapter@Overridepublic View getView(int position, View convertView, ViewGroupParent parent) {    ...
   mRequestBuilder.load(myUrls.get(position)).into(convertView);
}
Glide.setup(new GlideBuilder(context)
    .setDecodeFormat(DecodeFormat.ALWAYS_ARGB_8888));
  • Add a .preload() API to allow preloading media into memory (#169).

Glide.with(fragment)
    .load(url)
    .preload(width, height);
  • Add a .signature() API to allow users to easily mix in additional data to cache keys, giving users more control over cache invalidation (#178, #179), see the cache invalidation wiki.

Glide.with(fragment)
    .load(url)
    .signature(new StringSignature("Version1"))
    .into(view);
  • Add a Glide.preFillBitmapPool() API to allow pre-filling the BitmapPool to avoid jank from allocations after app startup (#93).

Glide.get(context)
    .preFillBitmapPool(new PreFillType.Builder(mySize));
  • Allow recursive calls to thumbnail() to load an arbitrary number of different sized thumbnails for a single Target (#149).

Glide.with(fragment)
    .load(myUrl)
    .thumbnail(Glide.with(fragment)
        .load(myUrl)
        .override(200, 200)
        .thumbnail(Glide.with(fragment)
           .load(myUrl)
           .override(50, 50)))
    .into(myView);
  • Allow thumbnail() to load model and data types that are different than those of the parent (#107).

  • Transformations are now only applied once and no longer have to be idempotent (#112).

Build/Infrastructure

  • PMD/Findbugs (#164)

  • Jacoco/Coveralls with 85% test coverage (34f797b).

  • Standard import order (f7a6d65).

Bugs 修复

性能

  • Avoid allocating large byte arrays in BufferedInputStream (#225).

  • Use downsampled image size when obtaining Bitmaps from the pool (#224).

GIFs

  • Avoid a crash causing race decoding multiple frames with the same GifDecoder (#212).

  • Always use ARGB_8888 to prevent null GIF frames on some versions of Android that don’t support ARGB_4444 (#216).

  • Fix partially decoded GIF frames (appears as grey or transparent noise in frames) (#207, #204).

  • Set a default frame delay for GIFs which do not specify a frame delay, or specify an overly short frame delay (#205).

  • More robust GIF decoding logic, including a fix for decoding only the first few rows of certain GIFs (#203).

  • Allow fade in/cross fade animations by ensuring that the first frame of GIFs is decoded before the GIF is returned (#159).

  • Fix GIFs always appearing transparent pre KitKat (#199).

Memory

  • Fix a memory leak when Glide is first called in an Activity (#210).

Transformations

  • Fix underdraw in FitCenter causing noise along the sides of certain images (#195).

  • Maintain transparency during bitmap transformations (#156).

Caching

  • Fixed Drawables being cached only be integer resource id which can change and/or overlap after subsequent compilations (#172).

Uris

  • Fix failure to detect certain types of file Uris (#161).

其他

  • Fix concurrency bugs resulting in incorrect assertions being thrown when loads were started on multiple threads (#191, #181).

  • Fix BitmapRequestBuilder not setting the decode format on the cache decoder when format() is called (#187).

  • Fix an assertion in ViewTarget related to restarting requests (#167).

  • Fix Glide.with() throwing pre Honeycomb when given non-support Activities (#158).

  • Avoid using Closeable interface when loading ParcelFileDescriptors on 4.1.1 or earlier (#157).

  • Fix an NPE in Bitmap#getAllocationByteCount() due to a framework bug in the initial release of KitKat (#148).


本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创开源社区。
转载请注明:文章转载自 OSCHINA 社区 [http://www.oschina.net]
本文标题:Glide 3.4.0 发布,Android 的媒体管理库
加载中

最新评论(11

YU_Z_W
YU_Z_W
这个库在分享图片时,怎么获取缓存的图片文件呀?你们都是怎么搞得?
YU_Z_W
YU_Z_W
4.0一下的直接忽略,
爱潜水的鱼
com.bumptech.glide.disklrucache.DiskLruCache;
com.bumptech.glide.gifdecoder.GifDecoder;
com.bumptech.glide.gifdecoder.GifHeader;
。。。。
好的东西都没有
glide-3.4.0.jar 里面又没有最新的ListPreloader.java;
想问亲们:3.4.0能用么?
河口呱呱
河口呱呱
羡慕你们不用兼容低版本
小克898
小克898

引用来自“河口呱呱”的评论

用过,是个不错的库。亲测在api2.1系统上不能用。

引用来自“ClassNotFound”的评论

你们现在还需要适配2.1吗

引用来自“河口呱呱”的评论

需要,而且主流软件都要适配2.1系统的吧。

引用来自“zhiweiofli”的评论

无视2.3.3以下版本了
公司产品都忽略4.0以下的了
zhiweiofli
zhiweiofli

引用来自“河口呱呱”的评论

用过,是个不错的库。亲测在api2.1系统上不能用。

引用来自“ClassNotFound”的评论

你们现在还需要适配2.1吗

引用来自“河口呱呱”的评论

需要,而且主流软件都要适配2.1系统的吧。
无视2.3.3以下版本了
河口呱呱
河口呱呱

引用来自“河口呱呱”的评论

用过,是个不错的库。亲测在api2.1系统上不能用。

引用来自“ClassNotFound”的评论

你们现在还需要适配2.1吗
需要,而且主流软件都要适配2.1系统的吧。
ClassNotFound
ClassNotFound

引用来自“河口呱呱”的评论

用过,是个不错的库。亲测在api2.1系统上不能用。
你们现在还需要适配2.1吗
libran
libran
Glide requires a minimum sdk version of 10.
河口呱呱
河口呱呱
用过,是个不错的库。亲测在api2.1系统上不能用。
返回顶部
顶部