Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ import com.xiaoyv.bangumi.shared.ui.component.action.LocalActionHandler
import com.xiaoyv.bangumi.shared.ui.component.bar.BgmTopAppBar
import com.xiaoyv.bangumi.shared.ui.component.chip.DropMenuActionButton
import com.xiaoyv.bangumi.shared.ui.component.image.BlurImage
import com.xiaoyv.bangumi.shared.ui.component.image.ImageColorState
import com.xiaoyv.bangumi.shared.ui.component.image.StateImage
import com.xiaoyv.bangumi.shared.ui.component.image.rememberImageColorState
import com.xiaoyv.bangumi.shared.ui.component.layout.BgmCollapsingScaffold
import com.xiaoyv.bangumi.shared.ui.component.layout.LocalCollapsingPullRefresh
import com.xiaoyv.bangumi.shared.ui.component.layout.state.StateLayout
Expand Down Expand Up @@ -102,14 +104,23 @@ private fun GroupsDetailScreen(
onUiEvent: (GroupsDetailEvent.UI) -> Unit,
onActionEvent: (GroupsDetailEvent.Action) -> Unit,
) {
val imageColorState = rememberImageColorState()

BgmCollapsingScaffold(
modifier = Modifier.fillMaxSize(),
topBar = {
val iconColor = androidx.compose.ui.graphics.lerp(
imageColorState.contentColor,
MaterialTheme.colorScheme.onSurface,
it
)
BgmTopAppBar(
title = baseState.content { group.title },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface.copy(alpha = it),
titleContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = it),
navigationIconContentColor = iconColor,
actionIconContentColor = iconColor
),
actions = {
baseState.content {
Expand Down Expand Up @@ -139,6 +150,7 @@ private fun GroupsDetailScreen(
GroupsDetailScreenHeader(
state = this,
padding = it,
imageColorState = imageColorState,
onUiEvent = onUiEvent,
onActionEvent = onActionEvent
)
Expand All @@ -162,6 +174,7 @@ private fun GroupsDetailScreen(
private fun GroupsDetailScreenHeader(
state: GroupsDetailState,
padding: PaddingValues,
imageColorState: ImageColorState,
onUiEvent: (GroupsDetailEvent.UI) -> Unit,
onActionEvent: (GroupsDetailEvent.Action) -> Unit,
) {
Expand All @@ -170,7 +183,8 @@ private fun GroupsDetailScreenHeader(
modifier = Modifier.matchParentSize(),
model = state.group.images.displayGridImage,
contentDescription = state.group.name,
contentScale = ContentScale.Crop
contentScale = ContentScale.Crop,
onState = imageColorState.onImageState
)

Box(
Expand All @@ -190,8 +204,8 @@ private fun GroupsDetailScreenHeader(
.padding(vertical = LayoutPaddingHalf),
colors = ListItemDefaults.colors(
containerColor = Color.Transparent,
headlineColor = MaterialTheme.colorScheme.onPrimary,
supportingColor = MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.7f)
headlineColor = imageColorState.contentColor,
supportingColor = imageColorState.contentColorSecondary
),
leadingContent = {
StateImage(
Expand Down Expand Up @@ -227,9 +241,9 @@ private fun GroupsDetailScreenHeader(
OutlinedButton(
shape = MaterialTheme.shapes.small,
colors = ButtonDefaults.outlinedButtonColors(
contentColor = if (state.group.isJoined) MaterialTheme.colorScheme.onPrimary else StarColor,
contentColor = if (state.group.isJoined) imageColorState.contentColor else StarColor,
),
border = BorderStroke(1.dp, if (state.group.isJoined) MaterialTheme.colorScheme.onPrimary else StarColor),
border = BorderStroke(1.dp, if (state.group.isJoined) imageColorState.contentColor else StarColor),
onClick = { onActionEvent(GroupsDetailEvent.Action.OnToggleJoinGroup) }
) {
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ import com.xiaoyv.bangumi.shared.ui.component.action.LocalActionHandler
import com.xiaoyv.bangumi.shared.ui.component.bar.BgmTopAppBar
import com.xiaoyv.bangumi.shared.ui.component.chip.DropMenuActionButton
import com.xiaoyv.bangumi.shared.ui.component.image.BlurImage
import com.xiaoyv.bangumi.shared.ui.component.image.ImageColorState
import com.xiaoyv.bangumi.shared.ui.component.image.StateImage
import com.xiaoyv.bangumi.shared.ui.component.image.rememberImageColorState
import com.xiaoyv.bangumi.shared.ui.component.layout.BgmCollapsingScaffold
import com.xiaoyv.bangumi.shared.ui.component.layout.LocalCollapsingPullRefresh
import com.xiaoyv.bangumi.shared.ui.component.layout.state.StateLayout
Expand Down Expand Up @@ -98,14 +100,23 @@ private fun IndexDetailScreen(
onUiEvent: (IndexDetailEvent.UI) -> Unit,
onActionEvent: (IndexDetailEvent.Action) -> Unit,
) {
val imageColorState = rememberImageColorState()

BgmCollapsingScaffold(
modifier = Modifier.fillMaxSize(),
topBar = {
val iconColor = androidx.compose.ui.graphics.lerp(
imageColorState.contentColor,
MaterialTheme.colorScheme.onSurface,
it
)
BgmTopAppBar(
title = baseState.content { index.title },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface.copy(alpha = it),
titleContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = it),
navigationIconContentColor = iconColor,
actionIconContentColor = iconColor
),
actions = {
baseState.content {
Expand Down Expand Up @@ -142,6 +153,7 @@ private fun IndexDetailScreen(
IndexDetailScreenHeader(
state = this,
padding = it,
imageColorState = imageColorState,
onUiEvent = onUiEvent,
onActionEvent = onActionEvent
)
Expand All @@ -164,6 +176,7 @@ private fun IndexDetailScreen(
private fun IndexDetailScreenHeader(
state: IndexDetailState,
padding: PaddingValues,
imageColorState: ImageColorState,
onUiEvent: (IndexDetailEvent.UI) -> Unit,
onActionEvent: (IndexDetailEvent.Action) -> Unit,
) {
Expand All @@ -172,7 +185,8 @@ private fun IndexDetailScreenHeader(
modifier = Modifier.matchParentSize(),
model = state.index.creator.avatar.displayGridImage,
contentDescription = state.index.title,
contentScale = ContentScale.Crop
contentScale = ContentScale.Crop,
onState = imageColorState.onImageState
)

Box(
Expand All @@ -192,8 +206,8 @@ private fun IndexDetailScreenHeader(
.padding(vertical = LayoutPaddingHalf),
colors = ListItemDefaults.colors(
containerColor = Color.Transparent,
headlineColor = MaterialTheme.colorScheme.onPrimary,
supportingColor = MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.7f)
headlineColor = imageColorState.contentColor,
supportingColor = imageColorState.contentColorSecondary
),
leadingContent = {
StateImage(
Expand Down Expand Up @@ -225,7 +239,7 @@ private fun IndexDetailScreenHeader(
)
Text(
text = buildAnnotatedString {
withStyle(SpanStyle(fontWeight = FontWeight.Medium, color = MaterialTheme.colorScheme.onPrimary)) {
withStyle(SpanStyle(fontWeight = FontWeight.Medium, color = imageColorState.contentColor)) {
append(state.index.creator.nickname)
}
append(" 创建 ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ import com.xiaoyv.bangumi.shared.data.manager.shared.currentUser
import com.xiaoyv.bangumi.shared.ui.component.bar.BgmTopAppBar
import com.xiaoyv.bangumi.shared.ui.component.chip.DropMenuActionButton
import com.xiaoyv.bangumi.shared.ui.component.image.BlurImage
import com.xiaoyv.bangumi.shared.ui.component.image.ImageColorState
import com.xiaoyv.bangumi.shared.ui.component.image.StateImage
import com.xiaoyv.bangumi.shared.ui.component.image.rememberImageColorState
import com.xiaoyv.bangumi.shared.ui.component.layout.BgmCollapsingScaffold
import com.xiaoyv.bangumi.shared.ui.component.layout.BgmRequireLoginLayout
import com.xiaoyv.bangumi.shared.ui.component.layout.LocalCollapsingPullRefresh
Expand Down Expand Up @@ -109,14 +111,25 @@ private fun ProfileScreen(
val scrollState = rememberScrollState()
val user = currentUser()
val sharedState = LocalSharedState.current
val imageColorState = rememberImageColorState()

BgmCollapsingScaffold(
modifier = Modifier.fillMaxSize(),
state = scrollState,
topBar = {
val iconColor = androidx.compose.ui.graphics.lerp(
imageColorState.contentColor,
MaterialTheme.colorScheme.onSurface,
it
)
BgmTopAppBar(
title = currentUser().nickname,
colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.surface.copy(alpha = it)),
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface.copy(alpha = it),
titleContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = it),
navigationIconContentColor = iconColor,
actionIconContentColor = iconColor
),
navigationIcon = {
DropMenuActionButton(
imageVector = BgmIcons.Menu,
Expand Down Expand Up @@ -177,7 +190,7 @@ private fun ProfileScreen(
},
collapse = {
baseState.content {
ProfileScreenHeader(state = this, it, onUiEvent, onActionEvent)
ProfileScreenHeader(state = this, it, imageColorState, onUiEvent, onActionEvent)
}
}
) {
Expand All @@ -199,6 +212,7 @@ private fun ProfileScreen(
private fun ProfileScreenHeader(
state: ProfileState,
padding: PaddingValues,
imageColorState: ImageColorState,
onUiEvent: (ProfileEvent.UI) -> Unit,
onActionEvent: (ProfileEvent.Action) -> Unit,
) {
Expand All @@ -215,7 +229,8 @@ private fun ProfileScreenHeader(
modifier = Modifier.fillMaxSize(),
model = avatar,
contentDescription = stringResource(Res.string.global_image),
androidSampling = if (avatar.isBlank()) 20f else 5f
androidSampling = if (avatar.isBlank()) 20f else 5f,
onState = imageColorState.onImageState
)

Column(
Expand Down Expand Up @@ -247,13 +262,13 @@ private fun ProfileScreenHeader(
modifier = Modifier.padding(top = LayoutPaddingHalf),
text = currentUser.nickname.ifBlank { stringResource(Res.string.login_first_tip) },
style = MaterialTheme.typography.titleLarge.copy(
color = MaterialTheme.colorScheme.surface
color = imageColorState.contentColor
)
)
Text(
text = "@" + currentUser.username.ifBlank { "bangumi" },
style = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.surface
color = imageColorState.contentColor
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object DefaultNavigationSuiteScaffoldOverride : NavigationSuiteScaffoldOverride
NavigationItemIcon(icon = it.icon, badge = it.badge)

ProvideContentColorTextStyle(
contentColor = contentColor,
contentColor = MaterialTheme.colorScheme.primary,
textStyle = MaterialTheme.typography.bodySmall,
content = {
it.label?.invoke()
Expand All @@ -87,7 +87,7 @@ internal fun ProvideContentColorTextStyle(
textStyle: TextStyle,
content: @Composable () -> Unit,
) {
val mergedStyle = LocalTextStyle.current.merge(textStyle)
val mergedStyle = LocalTextStyle.current.merge(textStyle).copy(color = contentColor)
CompositionLocalProvider(
LocalContentColor provides contentColor,
LocalTextStyle provides mergedStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,33 @@ fun MainScreen(
NavigationSuiteScaffold(
navigationSuiteItems = {
bottomTabs.forEach { item ->
val selected = backStack.current == item.first
item(
modifier = Modifier.padding(bottom = if (isWideScreen) LayoutPadding else 0.dp),
label = {
Text(
text = stringResource(item.second.label),
maxLines = 1,
overflow = TextOverflow.Ellipsis
overflow = TextOverflow.Ellipsis,
color = if (selected) {
MaterialTheme.colorScheme.primary
} else {
MaterialTheme.colorScheme.onSurfaceVariant
}
)
},
icon = { Icon(item.second.icon, stringResource(item.second.label)) },
selected = backStack.current == item.first,
icon = {
Icon(
item.second.icon,
stringResource(item.second.label),
tint = if (selected) {
MaterialTheme.colorScheme.primary
} else {
MaterialTheme.colorScheme.onSurfaceVariant
}
)
},
selected = selected,
badge = {
val appState = LocalSharedState.current
val unreadCnt = appState.unreadNotification + appState.unreadMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ import com.xiaoyv.bangumi.shared.ui.component.bar.BgmTopAppBar
import com.xiaoyv.bangumi.shared.ui.component.chip.DropMenuActionButton
import com.xiaoyv.bangumi.shared.ui.component.dialog.sheet.rememberSheetDialogState
import com.xiaoyv.bangumi.shared.ui.component.image.BlurImage
import com.xiaoyv.bangumi.shared.ui.component.image.ImageColorState
import com.xiaoyv.bangumi.shared.ui.component.image.StateImage
import com.xiaoyv.bangumi.shared.ui.component.image.rememberImageColorState
import com.xiaoyv.bangumi.shared.ui.component.layout.BgmCollapsingScaffold
import com.xiaoyv.bangumi.shared.ui.component.layout.LocalCollapsingPullRefresh
import com.xiaoyv.bangumi.shared.ui.component.layout.state.StateLayout
Expand Down Expand Up @@ -121,15 +123,24 @@ private fun MonoDetailScreen(
onUiEvent: (MonoDetailEvent.UI) -> Unit,
onActionEvent: (MonoDetailEvent.Action) -> Unit,
) {
val imageColorState = rememberImageColorState()

BgmCollapsingScaffold(
modifier = Modifier.fillMaxSize(),
topBar = {
val iconColor = androidx.compose.ui.graphics.lerp(
imageColorState.contentColor,
MaterialTheme.colorScheme.onSurface,
it
)
BgmTopAppBar(
modifier = Modifier.fillMaxWidth(),
title = baseState.payload?.mono?.displayName,
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.surface.copy(alpha = it),
titleContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = it)
titleContentColor = MaterialTheme.colorScheme.onSurface.copy(alpha = it),
navigationIconContentColor = iconColor,
actionIconContentColor = iconColor
),
actions = {
baseState.content {
Expand Down Expand Up @@ -197,6 +208,7 @@ private fun MonoDetailScreen(
.background(MaterialTheme.colorScheme.secondaryContainer),
insets = it,
state = this,
imageColorState = imageColorState,
onUiEvent = onUiEvent,
onActionEvent = onActionEvent
)
Expand Down Expand Up @@ -227,6 +239,7 @@ private fun MonoDetailScreenHeader(
modifier: Modifier,
insets: PaddingValues,
state: MonoDetailState,
imageColorState: ImageColorState,
onUiEvent: (MonoDetailEvent.UI) -> Unit,
onActionEvent: (MonoDetailEvent.Action) -> Unit,
) {
Expand All @@ -235,7 +248,8 @@ private fun MonoDetailScreenHeader(
modifier = Modifier.matchParentSize(),
contentScale = ContentScale.FillBounds,
model = state.mono.images.displayGridImage,
contentDescription = state.mono.displayName
contentDescription = state.mono.displayName,
onState = imageColorState.onImageState
)

Row(
Expand Down Expand Up @@ -275,7 +289,7 @@ private fun MonoDetailScreenHeader(
Text(
text = state.mono.displayName,
style = MaterialTheme.typography.titleLarge,
color = MaterialTheme.colorScheme.onPrimary,
color = imageColorState.contentColor,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
Expand All @@ -284,15 +298,15 @@ private fun MonoDetailScreenHeader(
modifier = Modifier.basicMarquee(),
text = state.mono.name,
style = MaterialTheme.typography.bodyLarge,
color = MaterialTheme.colorScheme.onPrimary,
color = imageColorState.contentColor,
maxLines = 1,
)

// 职业
Text(
text = "",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.75f),
color = imageColorState.contentColorSecondary,
maxLines = 1,
overflow = TextOverflow.MiddleEllipsis,
)
Expand Down
Loading
Loading