Add an option to reencode images under the advanced tab. #262

This commit is contained in:
len
2016-04-21 15:31:07 +02:00
parent bd8b9febd2
commit 0a27d4e185
9 changed files with 50 additions and 7 deletions
@@ -228,7 +228,14 @@ class DownloadManager(private val context: Context, private val sourceManager: S
page.status = Page.DOWNLOAD_IMAGE
return source.getImageProgressResponse(page)
.flatMap {
it.body().source().saveTo(File(directory, filename))
try {
val file = File(directory, filename)
file.parentFile.mkdirs()
it.body().source().saveImageTo(file.outputStream(), preferences.reencodeImage())
} catch (e: Exception) {
it.body().close()
throw e
}
Observable.just(page)
}
.retry(2)