Skip to content

English Translation #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
# ImageLoaderFramework
- **打造统一的图片加载框架,融合Glide,Fresco,一套API兼容两种加载方式**
- 两个底层包Glide,Fresco可随时相互替换,而无需大幅修改业务代码
- **Create a unified image loading framework, merge Glide, Fresco, a set of API compatible two loading methods**

- Two underlying packages, Glide, Fresco can be replaced at any time without major modification of the business code.

- 图片加载模块作为手机常用的一个重要模块,我们需要保证对它有完全的控制力,以适应产品随时变化的需求,因此我们就需要整合自己的图片加载框架,将它和业务代码分离,不过分依赖哪一个包,保证必要时可以替换。
- The image loading module is an important module commonly used in mobile phones. We need to ensure that it has complete control over it to adapt to the changing needs of the product, so we need to integrate our image loading framework and separate it from the business code. Which package to rely on, to ensure that it can be replaced if necessary.

- 具体如何打造统一加载框架请参考这两篇文章《[封装并实现统一的图片加载架构](https://juejin.im/post/58b280b92f301e0068078669)》,《[项目重构之路——Fresco非入侵式替换Glide](https://juejin.im/post/592c319ea0bb9f005706a963)》
- For details on how to create a unified loading framework, please refer to the two articles "Encapsulating and Implementing a Unified Image Loading Architecture", "The Road to Project Reconstruction - Fresco Non-Invasive Replacement Glide".

- 使用方式:
How to use:
```
    // 下面两个依赖包可选,根据需求二选一即可,
    // The following two dependencies are optional, and you can choose one according to your needs.
   compile 'com.ladingwu.library:fresco:0.0.8'
   compile 'com.ladingwu.library:glide:0.0.8'
   // 这个是必须的
   // This is a must
compile "com.ladingwu.library:imageloader-framework:0.0.8"

```

- 初始化
- Initialization
```
ImageLoaderConfig config = new ImageLoaderConfig.Builder(LoaderEnum.GLIDE,new GlideImageLocader())
.maxMemory(40*1024*1024L) // 配置内存缓存,单位为Byte
.maxMemory(40*1024*1024L) // Configure the memory cache in units Byte
.build();
ImageLoaderManager.getInstance().init(this,config);

```
初始化代码需要在Application中完成。
The initialization code needs to be done in the Application.


- 图片加载统一调用接口
- Image loading unified call interface
```
showImage(@NonNull ImageLoaderOptions options);
```

> 该接口的具体实现Glide和Fresco各有不同
> The specific implementation of this interface is different from Glide and Fresco.


- 使用范例
- Example
```
      // 加载圆角图片
      // Loading rounded corners
ImageLoaderOptions op=new ImageLoaderOptions.Builder(img1,url).imageRadiusDp(12).build();
ImageLoaderManager.getInstance().showImage(op);



ImageLoaderOptions options=new ImageLoaderOptions.Builder(img2,url)
                                                   .blurImage(true)   // 高斯模糊    
.blurValue(35)   //高斯模糊程度
                                                   .isCircle()   // 圆图 
                                                    .placeholder(R.mipmap.ic_launcher)// 占位图
                                                   .blurImage(true)   // Gaussian blur
.blurValue(35)   // Gaussian blur
                                                   .isCircle()   // Circle chart 
                                                    .placeholder(R.mipmap.ic_launcher)// Place chart
.build();

       // 如果项目同时使用了Fresco和Glide,可以指定特定的加载框架加载图片                                     
 ImageLoaderManager.getInstance().showImage(options, LoaderEnum.GLIDE); // 选择通过Glide加载图片
       // If the project uses both Fresco and Glide, you can specify a specific loading frame to load the image.
 ImageLoaderManager.getInstance().showImage(options, LoaderEnum.GLIDE); // Choose to load images via Glide


```

## 2018-03-04 更新
## 2018-03-04 Update

- 添加了对Fresco内存缓存的配置功能(Glide暂时采用默认配置)。
- Added configuration features for Fresco memory cache (Glide temporarily uses the default configuration).



## 2018-02-01 更新
## 2018-02-01 Update

- 添加了对于Glide4.x版本的支持
- 添加了圆图,圆角,高斯模糊的支持,并且保证Glide和Fresco的效果大体相同
- Added support for Glide 4.x version
- Added support for circle, fillet, Gaussian blur, and guaranteed that Glide and Fresco have the same effect


## 2017-8-12 更新
## 2017-8-12 Update

- 添加图片暂停加载和恢复功能,方便优化处理
- Add image pause loading and recovery for easy optimization

```
// 暂停加载
// Pause loading
void pause(Context context);
// 恢复加载
// Resume loading
void resume(Context context);
```

Expand Down