bumptech/glide

Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API that allows developers to plug in to almost any network stack. By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google’s Volley project or Square’s OkHttp library instead.

Glide’s primary focus is on making scrolling any kind of a list of images as smooth and fast as possible, but Glide is also effective for almost any case where you need to fetch, resize, and display a remote image.

Download
For detailed instructions and requirements, see Glide’s download and setup docs page.

You can download a jar from GitHub’s releases page.

Or use Gradle:

repositories {
google()
jcenter()
}

dependencies {
implementation ‘com.github.bumptech.glide:glide:4.11.0’
annotationProcessor ‘com.github.bumptech.glide:compiler:4.11.0’
}
Or Maven:

com.github.bumptech.glide glide 4.11.0 com.github.bumptech.glide compiler 4.11.0 true For info on using the bleeding edge, see the Snapshots docs page.

ProGuard
Depending on your ProGuard (DexGuard) config and usage, you may need to include the following lines in your proguard.cfg (see the Download and Setup docs page for more details):

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
(…);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] KaTeX parse error: Expected 'EOF', got '}' at position 21: …S; public *; }̲ -keep class co…InternalRewinder {
*** rewind();
}

for DexGuard only

-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
How do I use Glide?
Check out the documentation for pages on a variety of topics, and see the javadocs.

For Glide v3, see the wiki.

Simple use cases will look something like this:

// 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/gEgYUd”).into(imageView);
}

// For a simple image 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)
.into(myImageView);

return myImageView;
}
Status
Version 4 is now released and stable. Updates are released periodically with new features and bug fixes.

Comments/bugs/questions/pull requests are always welcome! Please read CONTRIBUTING.md on how to report issues.

Compatibility
Minimum Android SDK: Glide v4 requires a minimum API level of 14.
Compile Android SDK: Glide v4 requires you to compile against API 26 or later.
If you need to support older versions of Android, consider staying on Glide v3, which works on API 10, but is not actively maintained.

OkHttp 3.x: There is an optional dependency available called okhttp3-integration, see the docs page.
Volley: There is an optional dependency available called volley-integration, see the docs page.
Round Pictures: CircleImageView/CircularImageView/RoundedImageView are known to have issues with TransitionDrawable (.crossFade() with .thumbnail() or .placeholder()) and animated GIFs, use a BitmapTransformation (.circleCrop() will be available in v4) or .dontAnimate() to fix the issue.
Huge Images (maps, comic strips): Glide can load huge images by downsampling them, but does not support zooming and panning ImageViews as they require special resource optimizations (such as tiling) to work without OutOfMemoryErrors.
Build
Building Glide with gradle is fairly straight forward:

git clone https://github.com/bumptech/glide.git
cd glide
./gradlew jar
Note: Make sure your Android SDK has the Android Support Repository installed, and that your $ANDROID_HOME environment variable is pointing at the SDK or add a local.properties file in the root project with a sdk.dir=… line.

Samples
Follow the steps in the Build section to set up the project and then:

./gradlew :samples:flickr:run
./gradlew :samples:giphy:run
./gradlew :samples:svg:run
./gradlew :samples:contacturi:run
You may also find precompiled APKs on the releases page.

Development
Follow the steps in the Build section to setup the project and then edit the files however you wish. Android Studio cleanly imports both Glide’s source and tests and is the recommended way to work with Glide.

To open the project in Android Studio:

Go to File menu or the Welcome Screen
Click on Open…
Navigate to Glide’s root directory.
Select setting.gradle
For more details, see the Contributing docs page.

Getting Help
To report a specific problem or feature request, open a new issue on Github. For questions, suggestions, or anything else, email Glide’s discussion group, or join our IRC channel: irc.freenode.net#glide-library.

Contributing
Before submitting pull requests, contributors must sign Google’s individual contributor license agreement.

Thanks
The Android team and Jake Wharton for the disk cache implementation Glide’s disk cache is based on.
Dave Smith for the GIF decoder gist Glide’s GIF decoder is based on.
Chris Banes for his gradle-mvn-push script.
Corey Hall for Glide’s amazing logo.
Everyone who has contributed code and reported issues!
Author
Sam Judd - @sjudd on GitHub, @samajudd on Twitter

License
BSD, part MIT and Apache 2.0. See the LICENSE file for details.

Disclaimer
This is not an official Google product.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值