File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,29 @@ kapt "com.github.catch-pig.kotlin-mvp:compiler:last_version"
262262 ```
263263
264264 + 调用下载方法download([DownloadInfo](./mvp/src/main/java/com/catchpig/mvp/bean/DownloadInfo.kt),[DownloadCallback](./mvp/src/main/java/com/catchpig/mvp/listener/DownloadCallback.kt))
265+ ```
266+ val downloadInfo = DownloadInfo("https://wanandroid.com/","blogimgs/2d120094-e1ee-47fb-a155-6eb4ca49d01f.apk")
267+ model.download(downloadInfo,object : DownloadCallback {
268+ override fun onStart() {
269+
270+ }
271+
272+ override fun onSuccess(path: String) {
273+ view.activity().installApk(path)
274+ }
275+
276+ override fun onComplete() {
277+ }
278+
279+ override fun onProgress(readLength: Long, countLength: Long) {
280+ view.setDownloadProgress((readLength*100/countLength).toInt())
281+ }
282+
283+ override fun onError(t: Throwable) {
284+ println(t.message)
285+ }
286+ })
287+ ```
265288 * DownloadInfo
266289
267290 ```
You can’t perform that action at this time.
0 commit comments