|
@@ -55,6 +55,7 @@ import androidx.compose.material.icons.filled.Edit
|
|
|
import androidx.compose.material.icons.filled.Group
|
|
import androidx.compose.material.icons.filled.Group
|
|
|
import androidx.compose.material.icons.filled.Person
|
|
import androidx.compose.material.icons.filled.Person
|
|
|
import androidx.compose.material.icons.filled.Share
|
|
import androidx.compose.material.icons.filled.Share
|
|
|
|
|
+import androidx.compose.material.icons.filled.Shuffle
|
|
|
import androidx.compose.material.icons.filled.Timeline
|
|
import androidx.compose.material.icons.filled.Timeline
|
|
|
import androidx.compose.material.icons.outlined.Book
|
|
import androidx.compose.material.icons.outlined.Book
|
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
@@ -425,6 +426,7 @@ private fun BookInfoScreenContent(
|
|
|
) {
|
|
) {
|
|
|
BookInfoActions(
|
|
BookInfoActions(
|
|
|
inBookshelf = state.inBookshelf,
|
|
inBookshelf = state.inBookshelf,
|
|
|
|
|
+ shelfDuplicateCount = state.shelfDuplicateCount,
|
|
|
onShelfClick = { onIntent(BookInfoIntent.ShelfClick) },
|
|
onShelfClick = { onIntent(BookInfoIntent.ShelfClick) },
|
|
|
onTocClick = { onIntent(BookInfoIntent.TocClick) },
|
|
onTocClick = { onIntent(BookInfoIntent.TocClick) },
|
|
|
onGroupClick = { onIntent(BookInfoIntent.GroupClick) },
|
|
onGroupClick = { onIntent(BookInfoIntent.GroupClick) },
|
|
@@ -1344,6 +1346,7 @@ private fun BookInfoHeader(
|
|
|
@Composable
|
|
@Composable
|
|
|
private fun BookInfoActions(
|
|
private fun BookInfoActions(
|
|
|
inBookshelf: Boolean,
|
|
inBookshelf: Boolean,
|
|
|
|
|
+ shelfDuplicateCount: Int,
|
|
|
onShelfClick: () -> Unit,
|
|
onShelfClick: () -> Unit,
|
|
|
onTocClick: () -> Unit,
|
|
onTocClick: () -> Unit,
|
|
|
onGroupClick: () -> Unit,
|
|
onGroupClick: () -> Unit,
|
|
@@ -1370,12 +1373,29 @@ private fun BookInfoActions(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 书架里存在同作品副本时把书架按钮标出来,两种情况都用「换图标 + 换底色 + 换文案」表示:
|
|
|
|
|
+ // - 未入架:点击会弹冲突 Sheet,提前告诉用户这一步要问「共存还是迁移」;
|
|
|
|
|
+ // - 已入架:让用户看出「这本还有 N 个同名同作者副本」(点击仍是删除本书,行为不变)。
|
|
|
|
|
+ val hasShelfDuplicate = shelfDuplicateCount > 0
|
|
|
|
|
+ val conflictHighlight = hasShelfDuplicate && !inBookshelf
|
|
|
|
|
+ val duplicateHighlight = hasShelfDuplicate && inBookshelf
|
|
|
val shelfLabel = when {
|
|
val shelfLabel = when {
|
|
|
showShelfRemoveHint -> stringResource(R.string.click_to_remove)
|
|
showShelfRemoveHint -> stringResource(R.string.click_to_remove)
|
|
|
showLongPressGroupHint -> stringResource(R.string.long_press_group)
|
|
showLongPressGroupHint -> stringResource(R.string.long_press_group)
|
|
|
|
|
+ duplicateHighlight -> stringResource(R.string.shelf_duplicate_count, shelfDuplicateCount)
|
|
|
inBookshelf -> stringResource(R.string.already_in_bookshelf)
|
|
inBookshelf -> stringResource(R.string.already_in_bookshelf)
|
|
|
|
|
+ conflictHighlight -> stringResource(R.string.bookshelf_conflict_hint)
|
|
|
else -> stringResource(R.string.add_to_bookshelf)
|
|
else -> stringResource(R.string.add_to_bookshelf)
|
|
|
}
|
|
}
|
|
|
|
|
+ val shelfDescription = when {
|
|
|
|
|
+ conflictHighlight -> stringResource(R.string.bookshelf_conflict_hint_desc)
|
|
|
|
|
+ duplicateHighlight -> stringResource(
|
|
|
|
|
+ R.string.shelf_duplicate_count_desc,
|
|
|
|
|
+ shelfDuplicateCount,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ else -> shelfLabel
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Row(
|
|
Row(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
@@ -1386,8 +1406,23 @@ private fun BookInfoActions(
|
|
|
) {
|
|
) {
|
|
|
BookInfoActionCard(
|
|
BookInfoActionCard(
|
|
|
modifier = Modifier.weight(1f),
|
|
modifier = Modifier.weight(1f),
|
|
|
- icon = if (inBookshelf) Icons.Outlined.Book else Icons.Default.BookmarkAdd,
|
|
|
|
|
|
|
+ icon = when {
|
|
|
|
|
+ hasShelfDuplicate -> Icons.Default.Shuffle
|
|
|
|
|
+ inBookshelf -> Icons.Outlined.Book
|
|
|
|
|
+ else -> Icons.Default.BookmarkAdd
|
|
|
|
|
+ },
|
|
|
label = shelfLabel,
|
|
label = shelfLabel,
|
|
|
|
|
+ contentDescription = shelfDescription,
|
|
|
|
|
+ containerColor = if (hasShelfDuplicate) {
|
|
|
|
|
+ LegadoTheme.colorScheme.secondaryContainer
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LegadoTheme.colorScheme.surfaceContainerLow
|
|
|
|
|
+ },
|
|
|
|
|
+ contentColor = if (hasShelfDuplicate) {
|
|
|
|
|
+ LegadoTheme.colorScheme.onSecondaryContainer
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LegadoTheme.colorScheme.onSurface
|
|
|
|
|
+ },
|
|
|
onLongClick = onGroupClick,
|
|
onLongClick = onGroupClick,
|
|
|
onClick = {
|
|
onClick = {
|
|
|
if (!inBookshelf) {
|
|
if (!inBookshelf) {
|
|
@@ -1426,18 +1461,21 @@ private fun BookInfoActionCard(
|
|
|
modifier: Modifier = Modifier,
|
|
modifier: Modifier = Modifier,
|
|
|
icon: ImageVector,
|
|
icon: ImageVector,
|
|
|
label: String,
|
|
label: String,
|
|
|
|
|
+ contentDescription: String = label,
|
|
|
|
|
+ containerColor: Color = LegadoTheme.colorScheme.surfaceContainerLow,
|
|
|
|
|
+ contentColor: Color = LegadoTheme.colorScheme.onSurface,
|
|
|
onLongClick: (() -> Unit)? = null,
|
|
onLongClick: (() -> Unit)? = null,
|
|
|
onClick: () -> Unit
|
|
onClick: () -> Unit
|
|
|
) {
|
|
) {
|
|
|
GlassCard(
|
|
GlassCard(
|
|
|
modifier = modifier.semantics(mergeDescendants = true) {
|
|
modifier = modifier.semantics(mergeDescendants = true) {
|
|
|
role = Role.Button
|
|
role = Role.Button
|
|
|
- contentDescription = label
|
|
|
|
|
|
|
+ this.contentDescription = contentDescription
|
|
|
},
|
|
},
|
|
|
onLongClick = onLongClick,
|
|
onLongClick = onLongClick,
|
|
|
onClick = onClick,
|
|
onClick = onClick,
|
|
|
- containerColor = LegadoTheme.colorScheme.surfaceContainerLow,
|
|
|
|
|
- contentColor = LegadoTheme.colorScheme.onSurface,
|
|
|
|
|
|
|
+ containerColor = containerColor,
|
|
|
|
|
+ contentColor = contentColor,
|
|
|
) {
|
|
) {
|
|
|
Column(
|
|
Column(
|
|
|
modifier = Modifier
|
|
modifier = Modifier
|