Skip to content

Commit b96870a

Browse files
committed
simplify.
1 parent 51eeb66 commit b96870a

File tree

1 file changed

+2
-8
lines changed
  • CoroutineAndroidSample/app/src/main/java/com/bennyhuo/kotlin/coroutines/android/legacy

1 file changed

+2
-8
lines changed

CoroutineAndroidSample/app/src/main/java/com/bennyhuo/kotlin/coroutines/android/legacy/AsyncTasks.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,9 @@ class ImageAsyncTaskWithCallback(
5555
) : AsyncTask<String, Int, List<Bitmap>>() {
5656

5757
override fun doInBackground(vararg params: String): List<Bitmap> {
58-
return params.mapIndexed { index, param ->
58+
return params.mapIndexed { index, url ->
5959
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)
60+
ImageManager.getBitmapSync(url)
6761
}.also { publishProgress(100) }
6862
}
6963

0 commit comments

Comments
 (0)