mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 18:51:49 +01:00
Allow to mark all previous chapters as read
This commit is contained in:
parent
416fd128ba
commit
4bf15a5a2c
@ -254,6 +254,11 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onMarkPreviousAsRead(Chapter chapter) {
|
||||||
|
getPresenter().markPreviousChaptersAsRead(chapter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean onDownload(Observable<Chapter> chapters) {
|
protected boolean onDownload(Observable<Chapter> chapters) {
|
||||||
DownloadService.start(getActivity());
|
DownloadService.start(getActivity());
|
||||||
|
|
||||||
|
@ -99,6 +99,8 @@ public class ChaptersHolder extends FlexibleViewHolder {
|
|||||||
return adapter.getFragment().onDownload(chapter);
|
return adapter.getFragment().onDownload(chapter);
|
||||||
case R.id.action_delete:
|
case R.id.action_delete:
|
||||||
return adapter.getFragment().onDelete(chapter);
|
return adapter.getFragment().onDelete(chapter);
|
||||||
|
case R.id.action_mark_previous_as_read:
|
||||||
|
return adapter.getFragment().onMarkPreviousAsRead(item);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -207,6 +207,15 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
|
|||||||
.subscribe());
|
.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<Chapter> selectedChapters) {
|
public void downloadChapters(Observable<Chapter> selectedChapters) {
|
||||||
add(selectedChapters
|
add(selectedChapters
|
||||||
.toList()
|
.toList()
|
||||||
|
@ -22,4 +22,9 @@
|
|||||||
android:title="@string/action_mark_as_unread"
|
android:title="@string/action_mark_as_unread"
|
||||||
android:icon="@drawable/ic_action_undone_all"
|
android:icon="@drawable/ic_action_undone_all"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_mark_previous_as_read"
|
||||||
|
android:title="@string/action_mark_previous_as_read"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -19,6 +19,7 @@
|
|||||||
<string name="action_select_all">Select all</string>
|
<string name="action_select_all">Select all</string>
|
||||||
<string name="action_mark_as_read">Mark as read</string>
|
<string name="action_mark_as_read">Mark as read</string>
|
||||||
<string name="action_mark_as_unread">Mark as unread</string>
|
<string name="action_mark_as_unread">Mark as unread</string>
|
||||||
|
<string name="action_mark_previous_as_read">Mark previous as read</string>
|
||||||
<string name="action_download">Download</string>
|
<string name="action_download">Download</string>
|
||||||
<string name="action_delete">Delete</string>
|
<string name="action_delete">Delete</string>
|
||||||
<string name="action_update">Update</string>
|
<string name="action_update">Update</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user