Allow to share images when reading online. Move chapter cache to external cache dir. Dependency updates.

This commit is contained in:
len
2016-11-29 21:37:35 +01:00
parent 86b8712dd1
commit d30c019b89
12 changed files with 51 additions and 71 deletions
@@ -41,8 +41,8 @@ class DownloadProvider(private val context: Context) {
*/
internal fun getMangaDir(source: Source, manga: Manga): UniFile {
return downloadsDir
.subFile(getSourceDirName(source))!!
.subFile(getMangaDirName(manga))!!
.createDirectory(getSourceDirName(source))
.createDirectory(getMangaDirName(manga))
}
/**
@@ -247,7 +247,7 @@ class Downloader(private val context: Context, private val provider: DownloadPro
private fun downloadChapter(download: Download): Observable<Download> {
val chapterDirname = provider.getChapterDirName(download.chapter)
val mangaDir = provider.getMangaDir(download.source, download.manga)
val tmpDir = mangaDir.subFile("${chapterDirname}_tmp")!!
val tmpDir = mangaDir.createDirectory("${chapterDirname}_tmp")
val pageListObservable = if (download.pages == null) {
// Pull page list from network and add them to download object
@@ -262,8 +262,6 @@ class Downloader(private val context: Context, private val provider: DownloadPro
return pageListObservable
.doOnNext { pages ->
tmpDir.ensureDir()
// Delete all temporary (unfinished) files
tmpDir.listFiles()
?.filter { it.name!!.endsWith(".tmp") }