There was an error while loading. Please reload this page.
1 parent 51eeb66 commit b96870aCopy full SHA for b96870a
CoroutineAndroidSample/app/src/main/java/com/bennyhuo/kotlin/coroutines/android/legacy/AsyncTasks.kt
@@ -55,15 +55,9 @@ class ImageAsyncTaskWithCallback(
55
) : AsyncTask<String, Int, List<Bitmap>>() {
56
57
override fun doInBackground(vararg params: String): List<Bitmap> {
58
- return params.mapIndexed { index, param ->
+ return params.mapIndexed { index, url ->
59
publishProgress(index * 100 / params.size)
60
- val response = okHttpClient.newCall(
61
- Request.Builder().get().url(param).build()
62
- ).execute()
63
-
64
- response.body()?.byteStream()
65
- ?.let { BitmapFactory.decodeStream(it) }
66
- ?: throw HttpException(response)
+ ImageManager.getBitmapSync(url)
67
}.also { publishProgress(100) }
68
}
69
0 commit comments