Skip to content

Commit

Permalink
调整文件下载器的文档
Browse files Browse the repository at this point in the history
  • Loading branch information
catchpig committed Nov 29, 2020
1 parent 204cd70 commit 170e3eb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,29 @@ kapt "com.github.catch-pig.kotlin-mvp:compiler:last_version"
```

+ 调用下载方法download([DownloadInfo](./mvp/src/main/java/com/catchpig/mvp/bean/DownloadInfo.kt),[DownloadCallback](./mvp/src/main/java/com/catchpig/mvp/listener/DownloadCallback.kt))
```
val downloadInfo = DownloadInfo("https://wanandroid.com/","blogimgs/2d120094-e1ee-47fb-a155-6eb4ca49d01f.apk")
model.download(downloadInfo,object : DownloadCallback {
override fun onStart() {
}
override fun onSuccess(path: String) {
view.activity().installApk(path)
}
override fun onComplete() {
}
override fun onProgress(readLength: Long, countLength: Long) {
view.setDownloadProgress((readLength*100/countLength).toInt())
}
override fun onError(t: Throwable) {
println(t.message)
}
})
```
* DownloadInfo

```
Expand Down

0 comments on commit 170e3eb

Please sign in to comment.