|
|
@ -31,7 +31,7 @@ object ImageProvider { |
|
|
|
indexCache[src] = bitmap |
|
|
|
indexCache[src] = bitmap |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getImage(book: Book, chapterIndex: Int, src: String): Bitmap? { |
|
|
|
fun getImage(book: Book, chapterIndex: Int, src: String, onUi: Boolean = false): Bitmap? { |
|
|
|
getCache(chapterIndex, src)?.let { |
|
|
|
getCache(chapterIndex, src)?.let { |
|
|
|
return it |
|
|
|
return it |
|
|
|
} |
|
|
|
} |
|
|
@ -48,7 +48,7 @@ object ImageProvider { |
|
|
|
out.flush() |
|
|
|
out.flush() |
|
|
|
out.close() |
|
|
|
out.close() |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else if (!onUi) { |
|
|
|
HttpHelper.getBytes(src, src)?.let { |
|
|
|
HttpHelper.getBytes(src, src)?.let { |
|
|
|
FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it) |
|
|
|
FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it) |
|
|
|
} |
|
|
|
} |
|
|
|