diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.java index 557655da0..0ecd4e939 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersFragment.java @@ -254,6 +254,11 @@ public class ChaptersFragment extends BaseRxFragment implemen return true; } + public boolean onMarkPreviousAsRead(Chapter chapter) { + getPresenter().markPreviousChaptersAsRead(chapter); + return true; + } + protected boolean onDownload(Observable chapters) { DownloadService.start(getActivity()); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.java index b7ffe2259..b57813e82 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersHolder.java @@ -99,6 +99,8 @@ public class ChaptersHolder extends FlexibleViewHolder { return adapter.getFragment().onDownload(chapter); case R.id.action_delete: return adapter.getFragment().onDelete(chapter); + case R.id.action_mark_previous_as_read: + return adapter.getFragment().onMarkPreviousAsRead(item); } return false; }); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java index 798ca4e07..de89c1c79 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersPresenter.java @@ -207,6 +207,15 @@ public class ChaptersPresenter extends BasePresenter { .subscribe()); } + public void markPreviousChaptersAsRead(Chapter selected) { + Observable.from(chapters) + .filter(c -> c.chapter_number > -1 && c.chapter_number < selected.chapter_number) + .doOnNext(c -> c.read = true) + .toList() + .flatMap(chapters -> db.insertChapters(chapters).asRxObservable()) + .subscribe(); + } + public void downloadChapters(Observable selectedChapters) { add(selectedChapters .toList() diff --git a/app/src/main/res/menu/chapter_single.xml b/app/src/main/res/menu/chapter_single.xml index 9137b2f80..36540bc66 100644 --- a/app/src/main/res/menu/chapter_single.xml +++ b/app/src/main/res/menu/chapter_single.xml @@ -22,4 +22,9 @@ android:title="@string/action_mark_as_unread" android:icon="@drawable/ic_action_undone_all" app:showAsAction="ifRoom"/> + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 22e0dc0ba..025323e9d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,6 +19,7 @@ Select all Mark as read Mark as unread + Mark previous as read Download Delete Update