|
@@ -155,9 +155,24 @@ fun TocScreen(
|
|
|
val useReplace = viewModel.useReplace
|
|
val useReplace = viewModel.useReplace
|
|
|
val showWordCount = viewModel.showWordCount
|
|
val showWordCount = viewModel.showWordCount
|
|
|
|
|
|
|
|
- val subtitle = remember(pagerState.currentPage, book?.durChapterTitle) {
|
|
|
|
|
|
|
+ val subtitle = remember(
|
|
|
|
|
+ pagerState.currentPage,
|
|
|
|
|
+ book?.durChapterTitle,
|
|
|
|
|
+ book?.durChapterIndex,
|
|
|
|
|
+ book?.totalChapterNum
|
|
|
|
|
+ ) {
|
|
|
when (pagerState.currentPage) {
|
|
when (pagerState.currentPage) {
|
|
|
- 0 -> book?.durChapterTitle
|
|
|
|
|
|
|
+ 0 -> {
|
|
|
|
|
+ val durTitle = book?.durChapterTitle ?: ""
|
|
|
|
|
+ val durIndex = (book?.durChapterIndex ?: 0) + 1
|
|
|
|
|
+ val totalNum = book?.totalChapterNum ?: 0
|
|
|
|
|
+ if (totalNum > 0) {
|
|
|
|
|
+ "$durTitle · $durIndex / $totalNum 章"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ durTitle
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
1 -> "书签管理"
|
|
1 -> "书签管理"
|
|
|
else -> null
|
|
else -> null
|
|
|
}
|
|
}
|
|
@@ -733,13 +748,23 @@ fun ChapterItem(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (item.downloadState != DownloadState.LOCAL) {
|
|
|
|
|
|
|
+ val showStatusIcon =
|
|
|
|
|
+ remember(item.isDur, item.downloadState, item.wordCount, showWordCount) {
|
|
|
|
|
+ if (item.downloadState == DownloadState.LOCAL) {
|
|
|
|
|
+ showWordCount && !item.wordCount.isNullOrEmpty()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (showStatusIcon) {
|
|
|
Box(
|
|
Box(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
|
.padding(start = 8.dp)
|
|
.padding(start = 8.dp)
|
|
|
.wrapContentSize()
|
|
.wrapContentSize()
|
|
|
.clip(MaterialTheme.shapes.medium)
|
|
.clip(MaterialTheme.shapes.medium)
|
|
|
.combinedClickable(
|
|
.combinedClickable(
|
|
|
|
|
+ enabled = item.downloadState != DownloadState.LOCAL,
|
|
|
onClick = {
|
|
onClick = {
|
|
|
if (item.downloadState == DownloadState.NONE) {
|
|
if (item.downloadState == DownloadState.NONE) {
|
|
|
onDownloadClick()
|
|
onDownloadClick()
|
|
@@ -830,6 +855,10 @@ private fun StatusIcon(
|
|
|
) {
|
|
) {
|
|
|
|
|
|
|
|
val targetState = when {
|
|
val targetState = when {
|
|
|
|
|
+ downloadState == DownloadState.LOCAL -> {
|
|
|
|
|
+ if (showWordCount && !wordCount.isNullOrEmpty()) "SUCCESS_WORD_COUNT" else "EMPTY"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
isDur -> "DUR"
|
|
isDur -> "DUR"
|
|
|
downloadState == DownloadState.DOWNLOADING -> "LOADING"
|
|
downloadState == DownloadState.DOWNLOADING -> "LOADING"
|
|
|
downloadState == DownloadState.SUCCESS && showWordCount && !wordCount.isNullOrEmpty() -> "SUCCESS_WORD_COUNT"
|
|
downloadState == DownloadState.SUCCESS && showWordCount && !wordCount.isNullOrEmpty() -> "SUCCESS_WORD_COUNT"
|
|
@@ -849,6 +878,10 @@ private fun StatusIcon(
|
|
|
|
|
|
|
|
when (state) {
|
|
when (state) {
|
|
|
|
|
|
|
|
|
|
+ "EMPTY" -> {
|
|
|
|
|
+ Box(modifier = Modifier.size(24.dp))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
"DUR" -> {
|
|
"DUR" -> {
|
|
|
Icon(
|
|
Icon(
|
|
|
imageVector = Icons.Rounded.LocationOn,
|
|
imageVector = Icons.Rounded.LocationOn,
|