fix: 修复书架封面与更新标志显示
This commit is contained in:
3 files changed
+12
-8
No files matched your search
@@ -37,7 +37,11 @@ class CoverInterceptor : Interceptor {
|
|||||||
|
|
||||||
if (data is String && data.isNotBlank()) {
|
if (data is String && data.isNotBlank()) {
|
||||||
val sourceOrigin = request.parameters.value("sourceOrigin") as? String
|
val sourceOrigin = request.parameters.value("sourceOrigin") as? String
|
||||||
val source = sourceOrigin?.let { SourceHelp.getSource(it) }
|
val source = sourceOrigin?.let { origin ->
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
SourceHelp.getSource(origin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val cacheKey = "$data|$sourceOrigin"
|
val cacheKey = "$data|$sourceOrigin"
|
||||||
val cached = synchronized(resolvedUrlCache) {
|
val cached = synchronized(resolvedUrlCache) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import androidx.compose.foundation.rememberScrollState
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||||
|
import androidx.compose.material.icons.filled.Update
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@@ -627,6 +628,7 @@ fun BookItem(
|
|||||||
val book = bookUi.book
|
val book = bookUi.book
|
||||||
val unreadCount = book.getUnreadChapterNum()
|
val unreadCount = book.getUnreadChapterNum()
|
||||||
val unreadText = if (BookshelfConfig.showUnread && unreadCount > 0) unreadCount.toString() else null
|
val unreadText = if (BookshelfConfig.showUnread && unreadCount > 0) unreadCount.toString() else null
|
||||||
|
val showUpdateBadge = BookshelfConfig.showUnread && BookshelfConfig.showUnreadNew && book.isNew
|
||||||
val bookTypeLabel = if (BookshelfConfig.showTip) {
|
val bookTypeLabel = if (BookshelfConfig.showTip) {
|
||||||
when {
|
when {
|
||||||
book.isAudio -> stringResource(R.string.audio)
|
book.isAudio -> stringResource(R.string.audio)
|
||||||
@@ -658,6 +660,8 @@ fun BookItem(
|
|||||||
{
|
{
|
||||||
TextCard(
|
TextCard(
|
||||||
text = unreadText,
|
text = unreadText,
|
||||||
|
icon = if (showUpdateBadge) Icons.Default.Update else null,
|
||||||
|
iconSize = 12.dp,
|
||||||
cornerRadius = 4.dp,
|
cornerRadius = 4.dp,
|
||||||
horizontalPadding = 4.dp,
|
horizontalPadding = 4.dp,
|
||||||
verticalPadding = 0.dp
|
verticalPadding = 0.dp
|
||||||
@@ -676,7 +680,7 @@ fun BookItem(
|
|||||||
.aspectRatio(5f / 7f),
|
.aspectRatio(5f / 7f),
|
||||||
sourceOrigin = book.origin,
|
sourceOrigin = book.origin,
|
||||||
badgeText = if (layoutMode != 0) unreadText else null,
|
badgeText = if (layoutMode != 0) unreadText else null,
|
||||||
showBadgeDot = BookshelfConfig.showUnread && BookshelfConfig.showUnreadNew && book.isNew,
|
showBadgeDot = showUpdateBadge,
|
||||||
leftBottomText = matchedSourceLabel ?: bookTypeLabel,
|
leftBottomText = matchedSourceLabel ?: bookTypeLabel,
|
||||||
showLoadingPlaceholder = true,
|
showLoadingPlaceholder = true,
|
||||||
sharedTransitionScope = sharedTransitionScope,
|
sharedTransitionScope = sharedTransitionScope,
|
||||||
|
|||||||
@@ -83,9 +83,7 @@ fun BookCoverImage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val hasCustomDefault = !randomPath.isNullOrBlank()
|
val hasCustomDefault = !randomPath.isNullOrBlank()
|
||||||
var isOnlineCoverLoaded by remember(finalPath) {
|
var isOnlineCoverLoaded by remember(finalPath) { mutableStateOf(false) }
|
||||||
mutableStateOf(sharedCoverKey != null && finalPath != null)
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(finalPath) {
|
LaunchedEffect(finalPath) {
|
||||||
if (finalPath == null) {
|
if (finalPath == null) {
|
||||||
@@ -175,9 +173,7 @@ fun CoilBookCover(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val hasCustomDefault = !randomPath.isNullOrBlank()
|
val hasCustomDefault = !randomPath.isNullOrBlank()
|
||||||
var isOnlineCoverLoaded by remember(finalPath) {
|
var isOnlineCoverLoaded by remember(finalPath) { mutableStateOf(false) }
|
||||||
mutableStateOf(sharedCoverKey != null && finalPath != null)
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(finalPath) {
|
LaunchedEffect(finalPath) {
|
||||||
if (finalPath == null) {
|
if (finalPath == null) {
|
||||||
|
|||||||
Reference in new issue
Block a user