Allow partially read chapters to be marked as unread in updates screen (#8884)

* Allow partially read chapters to be marked as unread in updates screen

* Review changes

* Review changes 2
This commit is contained in:
zbue
2023-01-15 07:26:40 +08:00
committed by GitHub
parent 33a2219716
commit f301dc64f0
10 changed files with 125 additions and 69 deletions

View File

@@ -193,7 +193,7 @@ private fun UpdatesBottomBar(
}.takeIf { selected.fastAny { !it.update.read } },
onMarkAsUnreadClicked = {
onMultiMarkAsReadClicked(selected, false)
}.takeIf { selected.fastAny { it.update.read } },
}.takeIf { selected.fastAny { it.update.read || it.update.lastPageRead > 0L } },
onDownloadClicked = {
onDownloadChapter(selected, ChapterDownloadAction.START)
}.takeIf {

View File

@@ -38,6 +38,7 @@ import eu.kanade.presentation.components.ChapterDownloadAction
import eu.kanade.presentation.components.ChapterDownloadIndicator
import eu.kanade.presentation.components.ListGroupHeader
import eu.kanade.presentation.components.MangaCover
import eu.kanade.presentation.manga.components.DotSeparatorText
import eu.kanade.presentation.util.ReadItemAlpha
import eu.kanade.presentation.util.padding
import eu.kanade.presentation.util.selectedBackground
@@ -113,6 +114,14 @@ fun LazyListScope.updatesUiItems(
modifier = Modifier.animateItemPlacement(),
update = updatesItem.update,
selected = updatesItem.selected,
readProgress = updatesItem.update.lastPageRead
.takeIf { !updatesItem.update.read && it > 0L }
?.let {
stringResource(
R.string.chapter_progress,
it + 1,
)
},
onLongClick = {
onUpdateSelected(updatesItem, !updatesItem.selected, true, true)
},
@@ -139,6 +148,7 @@ fun UpdatesUiItem(
modifier: Modifier,
update: UpdatesWithRelations,
selected: Boolean,
readProgress: String?,
onClick: () -> Unit,
onLongClick: () -> Unit,
onClickCover: (() -> Unit)?,
@@ -203,8 +213,19 @@ fun UpdatesUiItem(
style = MaterialTheme.typography.bodySmall,
overflow = TextOverflow.Ellipsis,
onTextLayout = { textHeight = it.size.height },
modifier = Modifier.alpha(textAlpha),
modifier = Modifier
.weight(weight = 1f, fill = false)
.alpha(textAlpha),
)
if (readProgress != null) {
DotSeparatorText()
Text(
text = readProgress,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.alpha(ReadItemAlpha),
)
}
}
}
ChapterDownloadIndicator(