Commit dd6c3969 authored by mengcuiguang's avatar mengcuiguang

apkmanager 优化

parent f70a4a1f
......@@ -104,13 +104,13 @@ object DownloadApkManager {
PRDownloader.download(url, cachePath, apkName)
.build()
.setOnProgressListener { progress ->
if (!activity!!.isFinishing()) {
if (activity != null && !activity!!.isFinishing()) {
downloadProgressDialog?.setProgress(progress)
}
}
.start(object : OnDownloadListener {
override fun onDownloadComplete() {
if (!activity!!.isFinishing()) {
if (activity != null && !activity!!.isFinishing()) {
downloadProgressDialog?.dismiss()
try {
mDownloadListener?.onDownloadSuccess(cachePath + apkName)
......@@ -123,7 +123,7 @@ object DownloadApkManager {
}
override fun onError(error: Error) {
if (!activity!!.isFinishing()) {
if (activity != null && !activity!!.isFinishing()) {
downloadProgressDialog?.dismiss()
CacheUtil.clearAllCache(context)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment