Adjust manga FAB to only say "Start" if there's no unread chapters in unfiltered list
Closes #9479 (cherry picked from commit cf3f2d0380e5ab70211e6aab3f45bc81da43fcf4) # Conflicts: # app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt
This commit is contained in:
parent
e26360186a
commit
647f6e7721
@ -322,7 +322,7 @@ private fun MangaScreenSmallImpl(
|
||||
) {
|
||||
val chapterListState = rememberLazyListState()
|
||||
|
||||
val chapters = remember(state) { state.processedChapters.toList() }
|
||||
val chapters = remember(state) { state.processedChapters }
|
||||
// SY -->
|
||||
val metadataDescription = metadataDescription(state.source)
|
||||
// SY <--
|
||||
@ -393,7 +393,7 @@ private fun MangaScreenSmallImpl(
|
||||
) {
|
||||
ExtendedFloatingActionButton(
|
||||
text = {
|
||||
val id = if (chapters.fastAny { it.chapter.read }) {
|
||||
val id = if (state.chapters.fastAny { it.chapter.read }) {
|
||||
R.string.action_resume
|
||||
} else {
|
||||
R.string.action_start
|
||||
@ -624,7 +624,7 @@ fun MangaScreenLargeImpl(
|
||||
val layoutDirection = LocalLayoutDirection.current
|
||||
val density = LocalDensity.current
|
||||
|
||||
val chapters = remember(state) { state.processedChapters.toList() }
|
||||
val chapters = remember(state) { state.processedChapters }
|
||||
|
||||
// SY -->
|
||||
val metadataDescription = metadataDescription(state.source)
|
||||
@ -704,7 +704,7 @@ fun MangaScreenLargeImpl(
|
||||
) {
|
||||
ExtendedFloatingActionButton(
|
||||
text = {
|
||||
val id = if (chapters.fastAny { it.chapter.read }) {
|
||||
val id = if (state.chapters.fastAny { it.chapter.read }) {
|
||||
R.string.action_resume
|
||||
} else {
|
||||
R.string.action_start
|
||||
|
@ -183,7 +183,7 @@ class MangaInfoScreenModel(
|
||||
private val allChapters: List<ChapterItem>?
|
||||
get() = successState?.chapters
|
||||
|
||||
private val filteredChapters: Sequence<ChapterItem>?
|
||||
private val filteredChapters: List<ChapterItem>?
|
||||
get() = successState?.processedChapters
|
||||
|
||||
val chapterSwipeEndAction = libraryPreferences.swipeEndAction().get()
|
||||
@ -1051,7 +1051,7 @@ class MangaInfoScreenModel(
|
||||
}
|
||||
|
||||
private fun getUnreadChapters(): List<Chapter> {
|
||||
val chapterItems = if (skipFiltered) filteredChapters.orEmpty().toList() else allChapters.orEmpty()
|
||||
val chapterItems = if (skipFiltered) filteredChapters.orEmpty() else allChapters.orEmpty()
|
||||
return chapterItems
|
||||
.filter { (chapter, dlStatus) -> !chapter.read && dlStatus == Download.State.NOT_DOWNLOADED }
|
||||
.map { it.chapter }
|
||||
@ -1144,7 +1144,7 @@ class MangaInfoScreenModel(
|
||||
|
||||
fun markPreviousChapterRead(pointer: Chapter) {
|
||||
val successState = successState ?: return
|
||||
val chapters = filteredChapters.orEmpty().map { it.chapter }.toList()
|
||||
val chapters = filteredChapters.orEmpty().map { it.chapter }
|
||||
val prevChapters = if (successState.manga.sortDescending()) chapters.asReversed() else chapters
|
||||
val pointerPos = prevChapters.indexOf(pointer)
|
||||
if (pointerPos != -1) markChaptersRead(prevChapters.take(pointerPos), true)
|
||||
@ -1563,8 +1563,9 @@ sealed class MangaScreenState {
|
||||
// SY <--
|
||||
) : MangaScreenState() {
|
||||
|
||||
val processedChapters: Sequence<ChapterItem>
|
||||
get() = chapters.applyFilters(manga)
|
||||
val processedChapters by lazy {
|
||||
chapters.applyFilters(manga).toList()
|
||||
}
|
||||
|
||||
val trackingAvailable: Boolean
|
||||
get() = trackItems.isNotEmpty()
|
||||
|
Loading…
x
Reference in New Issue
Block a user