Allow reading downloaded chapters

This commit is contained in:
inorichi
2015-11-03 21:27:56 +01:00
parent 62ae572c72
commit 11638ae917
20 changed files with 93 additions and 19 deletions

View File

@@ -48,10 +48,9 @@ public class DownloadManager {
.subscribe();
}
private Observable<Page> downloadChapter(Manga manga, Chapter chapter) {
public Observable<Page> downloadChapter(Manga manga, Chapter chapter) {
final Source source = sourceManager.get(manga.source);
final File chapterDirectory = new File(
preferences.getDownloadsDirectory(), getChapterDirectory(source, manga, chapter));
final File chapterDirectory = getAbsoluteChapterDirectory(source, manga, chapter);
return source
.pullPageListFromNetwork(chapter.url)
@@ -64,8 +63,13 @@ public class DownloadManager {
// Start downloading images
.flatMap(page -> getDownloadedImage(page, source, chapterDirectory));
}
public File getAbsoluteChapterDirectory(Source source, Manga manga, Chapter chapter) {
return new File(preferences.getDownloadsDirectory(),
getChapterDirectory(source, manga, chapter));
}
private String getChapterDirectory(Source source, Manga manga, Chapter chapter) {
public String getChapterDirectory(Source source, Manga manga, Chapter chapter) {
return source.getName() +
File.separator +
manga.title.replaceAll("[^a-zA-Z0-9.-]", "_") +

View File

@@ -32,6 +32,12 @@ public class Chapter {
@StorIOSQLiteColumn(name = ChaptersTable.COLUMN_DATE_UPLOAD)
public long date_upload;
public int downloaded;
public static final int UNKNOWN = 0;
public static final int NOT_DOWNLOADED = 1;
public static final int DOWNLOADED = 2;
public Chapter() {}