Skip to content

Commit 674201d

Browse files
committed
docs: 修改说明
1 parent 147185c commit 674201d

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

README.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ EasyGlide是一款基于Glide4.9.0的工具封装类,功能不复杂,主要
88
- 加载完毕后PlaceHolder不会自动隐藏 [Glide #3195](https://github.com/bumptech/glide/issues/3195)
99

1010
## 改动
11+
- 2.0.0
12+
- 改为Koltin扩展函数
1113
- 1.0.8
1214
- 增加加载本地图片Resize方法
1315
- 1.0.7
@@ -23,20 +25,19 @@ EasyGlide是一款基于Glide4.9.0的工具封装类,功能不复杂,主要
2325

2426
# 使用方法
2527
## 引入
26-
2728
```
28-
2929
allprojects {
3030
repositories {
3131
...
3232
maven { url 'https://www.jitpack.io' }
3333
}
3434
}
35-
```
3635
```
3736

37+
```
3838
dependencies {
39-
implementation 'com.github.BzCoder:EasyGlide:1.0.8'
39+
implementation 'com.github.BzCoder:EasyGlide:2.0.0' //kotlin实现版本
40+
implementation 'com.github.BzCoder:EasyGlide:1.0.8' //Java实现版本
4041
}
4142
```
4243

@@ -46,9 +47,8 @@ EasyGlide是一款基于Glide4.9.0的工具封装类,功能不复杂,主要
4647
- SelectImageView
4748

4849
## EasyGlide 图片加载工具类
49-
工具类都在EasyGlide当中,其中封装了常用的图片加载方法。包含基本常用功能(圆形,黑白,圆角矩形,高斯模糊,变换大小,监听下载进度,清除缓存)。
50+
Java版本工具类都在EasyGlide当中,其中封装了常用的图片加载方法。包含基本常用功能(圆形,黑白,圆角矩形,高斯模糊,变换大小,监听下载进度,清除缓存)。
5051
```java
51-
5252
EasyGlide.loadImage(this, url4, iv2);
5353

5454
EasyGlide.loadImage(this, url4, iv2, new RequestListener());
@@ -77,14 +77,52 @@ EasyGlide.clearImage(this,imageView);
7777

7878
```
7979

80+
- Kotlin使用扩展函数,调用更加简单方便直观。
81+
```kotlin
82+
iv_0.loadImage(this, url4,onProgressListener = object :OnProgressListener{
83+
override fun onProgress(isComplete: Boolean, percentage: Int, bytesRead: Long, totalBytes: Long) {
84+
// 跟踪进度
85+
if (isComplete) {
86+
circleProgressView.visibility = View.GONE
87+
}
88+
circleProgressView.progress = percentage
89+
}
90+
})
91+
92+
iv_1.setOnClickListener { downloadImage() }
93+
iv_1.loadImage(this, url3)
94+
iv_2.loadImage(this, url4, requestListener = object : RequestListener<Drawable?> {
95+
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable?>?, isFirstResource: Boolean): Boolean {
96+
Toast.makeText(application, R.string.load_failed, Toast.LENGTH_LONG).show()
97+
return false
98+
}
99+
100+
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable?>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
101+
Toast.makeText(application, R.string.load_success, Toast.LENGTH_LONG).show()
102+
return false
103+
}
104+
})
105+
106+
iv_3.loadBlurImage(this, url4)
107+
iv_4.loadCircleImage(this, url4)
108+
iv_5.loadRoundCornerImage(this, url4)
109+
iv_6.loadGrayImage(this, url4)
110+
iv_7.loadResizeXYImage(this, url2, 800, 200)
111+
iv_8.loadImageWithTransformation(this, url2, GrayscaleTransformation(), RoundedCornersTransformation(50, 0))
112+
iv_9.loadCircleWithBorderImage(this, url2)
113+
iv_10.loadImageWithTransformation(this, url2, BlurTransformation(this, 20), GrayscaleTransformation(), CircleCrop())
114+
iv_11.loadImage(this, R.drawable.test)
115+
iv_12.loadImage(this, "")
116+
iv_13.loadBorderImage(this, url2)
117+
```
118+
80119
这些函数可能不能满足需求多种多样的你,所以你也可以通过实现```loadImage(Context context, GlideConfigImpl config)```模仿EasyGlide来对EasyGlide进行扩充。也欢迎直接替issue给我,我来帮您扩充。
81120

82-
你可以尽早的设置全局placeholder,当然也可以单独设置placeholder。
121+
你可以尽早的设置全局默认placeholder,当然也可以单独设置placeholder。
83122
```java
84123
EasyGlide.placeHolderImageView = R.color.red;
85124

86125
EasyGlide.circlePlaceholderImageView = R.color.red;
87-
88126
```
89127

90128
## 图片下载

0 commit comments

Comments
 (0)