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
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android {
minSdk 31
targetSdk 35
versionCode 5
versionName "2025.06.20_01"
versionName "2025.06.29"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The versionName format has changed from YYYY.MM.DD_BUILD to YYYY.MM.DD. If the _BUILD suffix was previously used to denote a specific build or patch version for a given day, its removal might lead to a loss of granularity in version tracking. Consider maintaining a consistent versioning scheme, especially if automated tools or release processes rely on such details for traceability.

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ fun SettingsItem(
) {
// 根据 position 决定圆角形状
val shape = when (position) {
GroupPosition.TOP -> RoundedCornerShape(topStart = 24.dp, topEnd = 24.dp, bottomStart = 4.dp, bottomEnd = 4.dp)
GroupPosition.MIDDLE -> RoundedCornerShape(4.dp)
GroupPosition.BOTTOM -> RoundedCornerShape(topStart = 4.dp, topEnd = 4.dp, bottomStart = 24.dp, bottomEnd = 24.dp)
GroupPosition.TOP -> RoundedCornerShape(topStart = 24.dp, topEnd = 24.dp, bottomStart = 8.dp, bottomEnd = 8.dp)
GroupPosition.MIDDLE -> RoundedCornerShape(8.dp)
GroupPosition.BOTTOM -> RoundedCornerShape(topStart = 8.dp, topEnd = 8.dp, bottomStart = 24.dp, bottomEnd = 24.dp)
GroupPosition.SINGLE -> RoundedCornerShape(24.dp) // 上下都是大圆角
}

Expand Down
52 changes: 25 additions & 27 deletions app/src/main/java/com/maary/liveinpeace/ui/screen/SettingsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
Expand All @@ -39,6 +40,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.google.accompanist.permissions.ExperimentalPermissionsApi
Expand Down Expand Up @@ -73,37 +75,33 @@ fun SettingsScreen(settingsViewModel: SettingsViewModel = viewModel()) {
topBar = {
TopAppBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.inversePrimary,
titleContentColor = MaterialTheme.colorScheme.primary,
navigationIconContentColor = MaterialTheme.colorScheme.primary,
actionIconContentColor = MaterialTheme.colorScheme.primary
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
titleContentColor = MaterialTheme.colorScheme.tertiary,
navigationIconContentColor = MaterialTheme.colorScheme.tertiary,
actionIconContentColor = MaterialTheme.colorScheme.tertiary
),
title = {
Text(stringResource(R.string.app_name),
style = Typography.titleLarge.copy(
fontWeight = FontWeight.Black,
fontStyle = FontStyle.Italic
)
)
Text(
modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.app_name),
textAlign = TextAlign.Center)
},
navigationIcon = {
IconButton(onClick = {
//exit the settings screen
// this could be a popBackStack or finish depending on your navigation setup
// For example, if using Jetpack Navigation:
(context as? Activity)?.finish()
// If using a navigation component, you might want to use:
// navController.popBackStack()
}) {
IconButton(
onClick = { (context as? Activity)?.finish() },
colors = IconButtonDefaults.iconButtonColors(containerColor = MaterialTheme.colorScheme.tertiary,
contentColor = MaterialTheme.colorScheme.onTertiary)) {
Icon(imageVector = Icons.Default.Close,
contentDescription = stringResource(R.string.exit))
}
},
actions = {
IconButton(onClick = {
val intent = Intent(context, HistoryActivity::class.java)
context.startActivity(intent)
} ) {
IconButton(
onClick = {
val intent = Intent(context, HistoryActivity::class.java)
context.startActivity(intent) },
colors = IconButtonDefaults.iconButtonColors(containerColor = MaterialTheme.colorScheme.tertiary,
contentColor = MaterialTheme.colorScheme.onTertiary)) {
Icon(painter = painterResource(R.drawable.ic_action_history),
contentDescription = stringResource(R.string.connections_history))
}
Expand All @@ -116,7 +114,7 @@ fun SettingsScreen(settingsViewModel: SettingsViewModel = viewModel()) {
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.background(MaterialTheme.colorScheme.inversePrimary)
.background(MaterialTheme.colorScheme.tertiaryContainer)
){

/**
Expand All @@ -135,17 +133,17 @@ fun SettingsScreen(settingsViewModel: SettingsViewModel = viewModel()) {

SettingsItem(
position = if (isForegroundEnabled) GroupPosition.TOP else GroupPosition.SINGLE,
containerColor = MaterialTheme.colorScheme.tertiaryContainer) {
containerColor = MaterialTheme.colorScheme.primaryContainer) {
SwitchRow(
title = stringResource(id = R.string.default_channel),
state = isForegroundEnabled,
onCheckedChange = { settingsViewModel.foregroundSwitch() },
switchColor = MaterialTheme.colorScheme.tertiary)
switchColor = MaterialTheme.colorScheme.primary)
}

AnimatedVisibility(visible = isForegroundEnabled) {
SettingsItem( position = GroupPosition.BOTTOM,
containerColor = MaterialTheme.colorScheme.tertiaryContainer) {
containerColor = MaterialTheme.colorScheme.primaryContainer) {
TextContent(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -158,7 +156,7 @@ fun SettingsScreen(settingsViewModel: SettingsViewModel = viewModel()) {
.padding(start = 16.dp, top = 8.dp, end = 16.dp, bottom = 8.dp),
title = stringResource(id = R.string.notification_settings),
description = stringResource(R.string.notification_settings_description),
color = MaterialTheme.colorScheme.tertiary
color = MaterialTheme.colorScheme.primary
)
}
}
Expand Down
Loading