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