Minor changes

This commit is contained in:
inorichi
2015-12-02 11:53:32 +01:00
parent 96f6e28c68
commit ab48686262
4 changed files with 18 additions and 16 deletions

View File

@@ -340,6 +340,7 @@ public class DownloadManager {
public void deleteChapter(Source source, Manga manga, Chapter chapter) {
File path = getAbsoluteChapterDirectory(source, manga, chapter);
DiskUtils.deleteFiles(path);
queue.remove(chapter);
}
public DownloadQueue getQueue() {

View File

@@ -35,7 +35,6 @@ public class Download {
this.source = source;
this.manga = manga;
this.chapter = chapter;
this.status = QUEUE;
}
public int getStatus() {

View File

@@ -3,7 +3,7 @@ package eu.kanade.mangafeed.data.download.model;
import java.util.ArrayList;
import java.util.List;
import eu.kanade.mangafeed.data.download.model.Download;
import eu.kanade.mangafeed.data.database.models.Chapter;
import rx.Observable;
import rx.subjects.PublishSubject;
@@ -19,14 +19,25 @@ public class DownloadQueue {
public void add(Download download) {
download.setStatusSubject(statusSubject);
download.setStatus(Download.QUEUE);
queue.add(download);
}
public void remove(Download download) {
queue.remove(download);
download.setStatus(Download.NOT_DOWNLOADED);
download.setStatusSubject(null);
}
public void remove(Chapter chapter) {
for (Download download : queue) {
if (download.chapter.id == chapter.id) {
remove(download);
break;
}
}
}
public List<Download> get() {
return queue;
}