mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 03:01:49 +01:00
Fix #541
This commit is contained in:
parent
a13ebc3975
commit
830f792824
@ -11,6 +11,13 @@ class ChaptersAdapter(val fragment: ChaptersFragment) : FlexibleAdapter<Chapters
|
||||
setHasStableIds(true)
|
||||
}
|
||||
|
||||
var items: List<ChapterModel>
|
||||
get() = mItems
|
||||
set(value) {
|
||||
mItems = value
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun updateDataSet(param: String) {
|
||||
}
|
||||
|
||||
@ -32,8 +39,4 @@ class ChaptersAdapter(val fragment: ChaptersFragment) : FlexibleAdapter<Chapters
|
||||
return mItems[position].id!!
|
||||
}
|
||||
|
||||
fun setItems(chapters: List<ChapterModel>) {
|
||||
mItems = chapters
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
initialFetchChapters()
|
||||
|
||||
destroyActionModeIfNeeded()
|
||||
adapter.setItems(chapters)
|
||||
adapter.items = chapters
|
||||
}
|
||||
|
||||
private fun initialFetchChapters() {
|
||||
@ -360,7 +360,11 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
}
|
||||
|
||||
fun markPreviousAsRead(chapter: ChapterModel) {
|
||||
presenter.markPreviousChaptersAsRead(chapter)
|
||||
val chapters = if (presenter.sortDescending()) adapter.items.reversed() else adapter.items
|
||||
val chapterPos = chapters.indexOf(chapter)
|
||||
if (chapterPos != -1) {
|
||||
presenter.markChaptersRead(chapters.take(chapterPos), true)
|
||||
}
|
||||
}
|
||||
|
||||
fun downloadChapters(chapters: List<ChapterModel>) {
|
||||
@ -370,7 +374,7 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
|
||||
fun bookmarkChapters(chapters: List<ChapterModel>, bookmarked: Boolean) {
|
||||
destroyActionModeIfNeeded()
|
||||
presenter.bookmarkChapters(chapters,bookmarked)
|
||||
presenter.bookmarkChapters(chapters, bookmarked)
|
||||
}
|
||||
|
||||
fun deleteChapters(chapters: List<ChapterModel>) {
|
||||
|
@ -288,19 +288,6 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the previous chapters to the selected one as read.
|
||||
* @param chapter the selected chapter.
|
||||
*/
|
||||
fun markPreviousChaptersAsRead(chapter: ChapterModel) {
|
||||
Observable.from(chapters)
|
||||
.filter { it.isRecognizedNumber && it.chapter_number < chapter.chapter_number }
|
||||
.doOnNext { it.read = true }
|
||||
.toList()
|
||||
.flatMap { db.updateChaptersProgress(it).asRxObservable() }
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the given list of chapters with the manager.
|
||||
* @param chapters the list of chapters to download.
|
||||
|
Loading…
Reference in New Issue
Block a user