1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

新闻 Glide 3.5.0 发布,Android 图片加载和缓存库 下载

本帖由 漂亮的石头2015-01-26 发布。版面名称:软件资讯

  1. 漂亮的石头

    漂亮的石头 版主 管理成员

    注册:
    2012-02-10
    帖子:
    486,020
    赞:
    46
    Glide 3.5.0 发布,此版本是增量版本,包括一些新特性和重要的 bug 修复。

    新特性


    • 添加 GlideModules,更简单的延迟配置 (#311).


    • 支持原始大小 (#274):

    // You can override a view's size to request the original image:Glide.with(context)
    .load(myUrl)
    .override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
    .into(myImageVIew);// SimpleTarget also now defaults to SIZE_ORIGINAL:Glide.with(context)
    .load(myUrl)
    .into(new SimpleTarget<Bitmap>() { @Override
    public void onResourceReady(Bitmap bitmap, GlideAnimation animation) { ...
    }
    });

    • 改进 ListPrerloader API, including an interface allowing different sizes per position thanks to @DavidWiesner (#273)


    • [ALPHA] AppWidget 和 Notification Target 实现 thanks to @pavlospt (#242):

    AppWidgetTarget widgetTarget =
    new AppWidgetTarget(context, remoteViews, R.id.view_id, 300, 400, R.id.widget_id);Glide.with(context)
    .asBitmap()
    .load(myUrl)
    .into(widgetTarget);

    • Override values are passed through to thumbnails (#236).


    • Automatically call trim/clear memory based on ComponentCallbacks (9063f6c).
    Build/Infrastructure


    • 更新到 Robolectric 2.4 thanks to @TWiStErRob (#249).


    • 更新到 Android gradle plugin 1.0+ (ba32d32).


    • 添加 Intellij 文件,开发更方便 (e34df44)
    Bugs 修复


    性能


    • Fixed needlessly copying Bitmaps decoded from data without an EXIF orientation tag (#270).


    • Freed thumbnails eagerly when full loads finish (#237).


    • Fixed a strict mode violation initializing the disk cache on Lollipop (#298).


    • Fixed a NetworkOnMainThread exception in the OkHttp integration library (#257)


    • Calculate sample size correctly thanks to @jisung (#288)

    Rendering


    • Worked around a framework issue in KitKat and Lollipop causing certain types of Bitmaps to render old data (#301).


    • Fixed large BMPs failing to render (#283).


    • Fixed decode failure for images with minimal EXIF segments (#286).


    • Fixed a bug causing shared color filters (#276).

    其他


    • Fixed a crash when the Glide singleton is instantiated on a background thread (#295).


    • Fixed a crash when completing loads started or cancelled other loads (#303).


    • Fixed skipMemoryCache not always skipping the memory cache (#258).

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

    示例代码:


    // For a simple view:
    @Override
    public void onCreate(Bundle savedInstanceState) {
    ...

    ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

    Glide.with(this).load("http://goo.gl/h8qOq7").into(imageView);
    }

    // For a list:
    @Override
    public View getView(int position, View recycled, ViewGroup container) {
    final ImageView myImageView;
    if (recycled == null) {
    myImageView = (ImageView) inflater.inflate(R.layout.my_image_view,
    container, false);
    } else {
    myImageView = (ImageView) recycled;
    }

    String url = myUrls.get(position);

    Glide.with(myFragment)
    .load(url)
    .centerCrop()
    .placeholder(R.drawable.loading_spinner)
    .crossFade()
    .into(myImageView);

    return myImageView;
    }
    Glide 3.5.0 发布,Android 图片加载和缓存库下载地址
     
正在加载...