From 83ca030be4b246a2c4ac6ad71442cca6be6a8d36 Mon Sep 17 00:00:00 2001 From: HapeLee <1321903405@qq.com> Date: Mon, 16 Mar 2026 01:05:51 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E5=8F=AF=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E5=92=8C?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=AB=A0=E8=8A=82=EF=BC=8C=E5=9C=A8=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E4=B9=A6=E7=B1=8D=E6=97=B6=E5=8F=AF=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=AD=97=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/toc/TocScreen.kt | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/toc/TocScreen.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocScreen.kt index fe7cfa994..06144efd8 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/TocScreen.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocScreen.kt @@ -155,9 +155,24 @@ fun TocScreen( val useReplace = viewModel.useReplace 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) { - 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 -> "书签管理" 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( modifier = Modifier .padding(start = 8.dp) .wrapContentSize() .clip(MaterialTheme.shapes.medium) .combinedClickable( + enabled = item.downloadState != DownloadState.LOCAL, onClick = { if (item.downloadState == DownloadState.NONE) { onDownloadClick() @@ -830,6 +855,10 @@ private fun StatusIcon( ) { val targetState = when { + downloadState == DownloadState.LOCAL -> { + if (showWordCount && !wordCount.isNullOrEmpty()) "SUCCESS_WORD_COUNT" else "EMPTY" + } + isDur -> "DUR" downloadState == DownloadState.DOWNLOADING -> "LOADING" downloadState == DownloadState.SUCCESS && showWordCount && !wordCount.isNullOrEmpty() -> "SUCCESS_WORD_COUNT" @@ -849,6 +878,10 @@ private fun StatusIcon( when (state) { + "EMPTY" -> { + Box(modifier = Modifier.size(24.dp)) + } + "DUR" -> { Icon( imageVector = Icons.Rounded.LocationOn,