Skip to content

Commit 9e1e11b

Browse files
committed
Update README.md
1 parent fdbc164 commit 9e1e11b

2 files changed

Lines changed: 97 additions & 6 deletions

File tree

README-zh.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# ProgressManager
2+
[ ![Bintray](https://img.shields.io/badge/bintray-v1.1-brightgreen.svg) ](https://bintray.com/jessyancoding/maven/progressmanager/1.1/link)
3+
[ ![Build Status](https://travis-ci.org/JessYanCoding/ProgressManager.svg?branch=master) ](https://travis-ci.org/JessYanCoding/ProgressManager)
4+
[ ![API](https://img.shields.io/badge/API-14%2B-blue.svg?style=flat-square) ](https://developer.android.com/about/versions/android-4.0.html)
5+
[ ![License](http://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square) ](http://www.apache.org/licenses/LICENSE-2.0)
6+
7+
8+
## Listen the progress of downloading and uploading in Okhttp (compatible Retrofit and Glide).
9+
10+
11+
## Overview
12+
![gif](arts/progressManager.gif)
13+
14+
15+
## Introduction
16+
**ProgressManager** 一行代码即可监听 **App** 中所有网络链接的上传以及下载进度,包括 **Glide** 的图片加载进度,实现原理类似 **EventBus**,你可在 **App** 中的任何地方,将多个监听器,以 **Url** 地址作为标识符,注册到本框架,当此 **Url** 地址存在下载或者上传的动作时,框架会主动调用所有使用此 **Url** 地址注册过的监听器,达到多个模块的同步更新
17+
18+
## Feature
19+
* 使用简单,只需一行代码即可实现进度监听
20+
21+
* 低耦合,实际请求端和进度接收端并不存在直接或间接的关联关系,即可以在 **App** 任何地方接收进度信息
22+
* 侵入性低,使用本框架你并不需要更改之前进行上传或下载的代码,即使用或不使用本框架并不会影响到原有的代码
23+
* 多端同步,同一个数据源的上传或下载进度可以指定多个不同的接收端,少去了使用 **EventBus** 实现多个端口同步更新进度
24+
* 自动管理监听器,少去了手动注销监听器的烦恼
25+
* 默认运行在主线层,少去了切换线程的烦恼
26+
* 多平台支持,支持 **Okhttp** , **Retrofit** , **Glide**
27+
28+
## Download
29+
``` gradle
30+
compile 'me.jessyan:progressmanager:1.1'
31+
```
32+
33+
## Usage
34+
### Step 1
35+
``` java
36+
// 构建 OkHttpClient 时,将 OkHttpClient.Builder() 传入 with() 方法,进行初始化配置
37+
OkHttpClient = ProgressManager.getInstance().with(new OkHttpClient.Builder())
38+
.build();
39+
```
40+
41+
### Step 2
42+
``` java
43+
// Glide 下载监听
44+
ProgressManager.getInstance().addResponseListener(IMAGE_URL, getGlideListener());
45+
46+
47+
// Okhttp/Retofit 下载监听
48+
ProgressManager.getInstance().addResponseListener(DOWNLOAD_URL, getDownloadListener());
49+
50+
51+
// Okhttp/Retofit 上传监听
52+
ProgressManager.getInstance().addRequestLisenter(UPLOAD_URL, getUploadListener());
53+
```
54+
55+
56+
## ProGuard
57+
```
58+
-keep class me.jessyan.progressmanager.** { *; }
59+
-keep interface me.jessyan.progressmanager.** { *; }
60+
```
61+
62+
63+
## About Me
64+
* **Email**: <jess.yan.effort@gmail.com>
65+
* **Home**: <http://jessyan.me>
66+
* **掘金**: <https://gold.xitu.io/user/57a9dbd9165abd0061714613>
67+
* **简书**: <http://www.jianshu.com/u/1d0c0bc634db>
68+
69+
## License
70+
```
71+
Copyright 2017, jessyan
72+
73+
Licensed under the Apache License, Version 2.0 (the "License");
74+
you may not use this file except in compliance with the License.
75+
You may obtain a copy of the License at
76+
77+
http://www.apache.org/licenses/LICENSE-2.0
78+
79+
Unless required by applicable law or agreed to in writing, software
80+
distributed under the License is distributed on an "AS IS" BASIS,
81+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82+
See the License for the specific language governing permissions and
83+
limitations under the License.
84+
```

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77

88
## Listen the progress of downloading and uploading in Okhttp (compatible Retrofit and Glide).
99

10+
[中文说明](README-zh.md)
1011

1112
## Overview
1213
![gif](arts/progressManager.gif)
1314

1415

15-
## Introduction
16-
**ProgressManager** 一行代码即可监听 **App** 中所有网络链接的上传以及下载进度,包括 **Glide** 的图片加载进度,实现原理类似 **EventBus**,你可在 **App** 中的任何地方,将多个监听器,以 **Url** 地址作为标识符,注册到本框架,当此 **Url** 地址存在下载或者上传的动作时,框架会主动调用所有使用此 **Url** 地址注册过的监听器,达到多个模块的同步更新
16+
## Feature
17+
* Easy to use, just a line of code to listen progress
1718

19+
* Low coupling, the actual request and the progress of the receiver does not exist directly or indirectly, that can be anywhere in **App** to receive progress information
20+
* Low intrusion, use this framework you do not need to change the code before uploading or downloading, ie using or not using this framework does not affect the original code
21+
* Multi-end synchronization, the same data source upload or download progress can specify a number of different receivers, less to use **EventBus** achieve multiple port synchronization update progress
22+
* Automatic management of the listener, less to manually cancel the trouble of the listener
23+
* The default run in the main line layer, less to switch the thread of trouble
24+
* Multi-platform support, support **Okhttp**, **Retrofit**, **Glide**
1825

1926
## Download
2027
``` gradle
@@ -24,22 +31,22 @@
2431
## Usage
2532
### Step 1
2633
``` java
27-
//构建 OkHttpClient 时,将 OkHttpClient.Builder() 传入 with() 方法,进行初始化配置
34+
// When building OkHttpClient, the OkHttpClient.Builder() is passed to the with() method to initialize the configuration
2835
OkHttpClient = ProgressManager.getInstance().with(new OkHttpClient.Builder())
2936
.build();
3037
```
3138

3239
### Step 2
3340
``` java
34-
//Glide 下载监听
41+
// Glide load
3542
ProgressManager.getInstance().addResponseListener(IMAGE_URL, getGlideListener());
3643

3744

38-
//Okhttp/Retofit 下载监听
45+
// Okhttp/Retofit download
3946
ProgressManager.getInstance().addResponseListener(DOWNLOAD_URL, getDownloadListener());
4047

4148

42-
//Okhttp/Retofit 上传监听
49+
// Okhttp/Retofit upload
4350
ProgressManager.getInstance().addRequestLisenter(UPLOAD_URL, getUploadListener());
4451
```
4552

0 commit comments

Comments
 (0)