发送
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.PinkOV">
|
android:theme="@style/Theme.PinkOV">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import android.os.Bundle
|
|||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
|
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -12,11 +14,15 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.tooling.preview.PreviewScreenSizes
|
import androidx.compose.ui.tooling.preview.PreviewScreenSizes
|
||||||
import com.pinkbear.pinkov.navigation.AppDestinations
|
import com.pinkbear.pinkov.navigation.AppDestinations
|
||||||
import com.pinkbear.pinkov.ui.page.HomePage
|
import com.pinkbear.pinkov.ui.page.HomePage
|
||||||
import com.pinkbear.pinkov.ui.page.MinePage
|
import com.pinkbear.pinkov.ui.page.MinePage
|
||||||
|
import com.pinkbear.pinkov.ui.page.RecordsPage
|
||||||
import com.pinkbear.pinkov.ui.page.ScanPage
|
import com.pinkbear.pinkov.ui.page.ScanPage
|
||||||
import com.pinkbear.pinkov.ui.theme.PinkOVTheme
|
import com.pinkbear.pinkov.ui.theme.PinkOVTheme
|
||||||
|
|
||||||
@@ -48,11 +54,20 @@ fun PinkOVApp() {
|
|||||||
item(
|
item(
|
||||||
icon = {
|
icon = {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(it.icon),
|
modifier = Modifier.size(22.dp),
|
||||||
contentDescription = it.label
|
painter = painterResource(it.icon),
|
||||||
|
contentDescription = it.label,
|
||||||
|
tint = if (it == currentDestination) MaterialTheme.colorScheme.primary
|
||||||
|
else MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
},
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
it.label,
|
||||||
|
color = if (it == currentDestination) MaterialTheme.colorScheme.primary
|
||||||
|
else MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
label = { Text(it.label) },
|
|
||||||
selected = it == currentDestination,
|
selected = it == currentDestination,
|
||||||
onClick = { currentDestination = it }
|
onClick = { currentDestination = it }
|
||||||
)
|
)
|
||||||
@@ -63,6 +78,7 @@ fun PinkOVApp() {
|
|||||||
AppDestinations.HOME -> HomePage(
|
AppDestinations.HOME -> HomePage(
|
||||||
onScanClick = { showScanPage = true }
|
onScanClick = { showScanPage = true }
|
||||||
)
|
)
|
||||||
|
AppDestinations.RECORDS -> RecordsPage()
|
||||||
AppDestinations.MINE -> MinePage()
|
AppDestinations.MINE -> MinePage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ enum class AppDestinations(
|
|||||||
val icon: Int,
|
val icon: Int,
|
||||||
) {
|
) {
|
||||||
HOME("Home", R.drawable.ic_home),
|
HOME("Home", R.drawable.ic_home),
|
||||||
|
RECORDS("Records", R.drawable.ic_records),
|
||||||
MINE("Mine", R.drawable.ic_mine),
|
MINE("Mine", R.drawable.ic_mine),
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.draw.scale
|
import androidx.compose.ui.draw.scale
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
@@ -62,7 +63,11 @@ fun HomePage(
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.fillMaxHeight(1f / 3f),
|
.fillMaxHeight(1f / 3f)
|
||||||
|
) {
|
||||||
|
// Scan button (centered)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
// Breathing animation for the scan button
|
// Breathing animation for the scan button
|
||||||
@@ -81,13 +86,21 @@ fun HomePage(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(150.dp)
|
.size(150.dp)
|
||||||
.scale(breathScale)
|
.scale(breathScale)
|
||||||
|
.background(
|
||||||
|
brush = Brush.radialGradient(
|
||||||
|
colors = listOf(
|
||||||
|
Color(0xFFFFA3D3), // center: RGB(255, 163, 211)
|
||||||
|
Color(0xFFFF8BBC), // edge: RGB(255, 139, 188)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shape = CircleShape
|
||||||
|
)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(MaterialTheme.colorScheme.primary)
|
|
||||||
.clickable { onScanClick() },
|
.clickable { onScanClick() },
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "扫描",
|
text = "扫描试纸",
|
||||||
color = MaterialTheme.colorScheme.onPrimary,
|
color = MaterialTheme.colorScheme.onPrimary,
|
||||||
fontSize = 18.sp,
|
fontSize = 18.sp,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
@@ -95,14 +108,32 @@ fun HomePage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = MaterialTheme.colorScheme.outlineVariant)
|
// Bottom-only shadow gradient
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomCenter)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(8.dp)
|
||||||
|
.background(
|
||||||
|
brush = Brush.verticalGradient(
|
||||||
|
colors = listOf(
|
||||||
|
Color.Transparent,
|
||||||
|
Color.Black.copy(alpha = 0.03f),
|
||||||
|
Color.Black.copy(alpha = 0.08f),
|
||||||
|
Color.Black.copy(alpha = 0.14f),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Bottom 2/3: Result list ----
|
// ---- Bottom 2/3: Result list ----
|
||||||
if (records.isEmpty()) {
|
if (records.isEmpty()) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.fillMaxHeight(),
|
.fillMaxHeight()
|
||||||
|
.background(MaterialTheme.colorScheme.surfaceVariant),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -116,8 +147,10 @@ fun HomePage(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
|
.background(MaterialTheme.colorScheme.surfaceVariant)
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
// Header row
|
// Header row
|
||||||
RecordHeaderRow()
|
RecordHeaderRow()
|
||||||
}
|
}
|
||||||
@@ -126,10 +159,7 @@ fun HomePage(
|
|||||||
record = record,
|
record = record,
|
||||||
onLongPress = { recordToDelete = record }
|
onLongPress = { recordToDelete = record }
|
||||||
)
|
)
|
||||||
HorizontalDivider(
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
thickness = 0.5.dp,
|
|
||||||
color = MaterialTheme.colorScheme.outlineVariant
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,8 +199,8 @@ private fun RecordHeaderRow() {
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(MaterialTheme.colorScheme.surfaceVariant)
|
||||||
.padding(vertical = 8.dp, horizontal = 4.dp),
|
.padding(vertical = 8.dp, horizontal = 16.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -209,7 +239,8 @@ private fun RecordHeaderRow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single record row. Image column takes ~40% of screen width.
|
* A single record card with rounded corners and subtle shadow.
|
||||||
|
* Image column takes ~40% of card width.
|
||||||
*/
|
*/
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -236,15 +267,22 @@ private fun RecordRow(
|
|||||||
else -> Color.White
|
else -> Color.White
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Card(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
onClick = { /* Click could open detail view in future */ },
|
onClick = { /* Click could open detail view in future */ },
|
||||||
onLongClick = onLongPress
|
onLongClick = onLongPress
|
||||||
)
|
),
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp),
|
||||||
.padding(vertical = 6.dp, horizontal = 4.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp, horizontal = 8.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
// Result value
|
// Result value
|
||||||
@@ -301,6 +339,7 @@ private fun RecordRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.pinkbear.pinkov.ui.page
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.tooling.preview.PreviewScreenSizes
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.pinkbear.pinkov.ui.theme.PinkOVTheme
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun RecordsPage(modifier: Modifier = Modifier) {
|
||||||
|
Scaffold(modifier = modifier) { innerPadding ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(innerPadding),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
Text(
|
||||||
|
text = "经期记录",
|
||||||
|
color = MaterialTheme.colorScheme.onSurface,
|
||||||
|
fontSize = 18.sp
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
Text(
|
||||||
|
text = "日历与经期记录功能即将上线",
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreviewScreenSizes
|
||||||
|
@Composable
|
||||||
|
private fun RecordsPagePreview() {
|
||||||
|
PinkOVTheme {
|
||||||
|
RecordsPage()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,12 @@ package com.pinkbear.pinkov.ui.theme
|
|||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
val Purple80 = Color(0xFFD0BCFF)
|
// Pink palette — dark theme
|
||||||
val PurpleGrey80 = Color(0xFFCCC2DC)
|
val Pink80 = Color(0xFFFF8BBC) // primary: RGB(255, 139, 188)
|
||||||
val Pink80 = Color(0xFFEFB8C8)
|
val PinkGrey80 = Color(0xFFFFA3D3) // secondary: RGB(255, 163, 211)
|
||||||
|
val Rose80 = Color(0xFFFFC1D4) // tertiary
|
||||||
|
|
||||||
val Purple40 = Color(0xFF6650a4)
|
// Pink palette — light theme
|
||||||
val PurpleGrey40 = Color(0xFF625b71)
|
val Pink40 = Color(0xFFFF8BBC) // primary: RGB(255, 139, 188)
|
||||||
val Pink40 = Color(0xFF7D5260)
|
val PinkGrey40 = Color(0xFFEC80A4) // secondary
|
||||||
|
val Rose40 = Color(0xFFFFA3D3) // tertiary: RGB(255, 163, 211)
|
||||||
@@ -12,15 +12,15 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
private val DarkColorScheme = darkColorScheme(
|
private val DarkColorScheme = darkColorScheme(
|
||||||
primary = Purple80,
|
primary = Pink80,
|
||||||
secondary = PurpleGrey80,
|
secondary = PinkGrey80,
|
||||||
tertiary = Pink80
|
tertiary = Rose80
|
||||||
)
|
)
|
||||||
|
|
||||||
private val LightColorScheme = lightColorScheme(
|
private val LightColorScheme = lightColorScheme(
|
||||||
primary = Purple40,
|
primary = Pink40,
|
||||||
secondary = PurpleGrey40,
|
secondary = PinkGrey40,
|
||||||
tertiary = Pink40
|
tertiary = Rose40
|
||||||
|
|
||||||
/* Other default colors to override
|
/* Other default colors to override
|
||||||
background = Color(0xFFFFFBFE),
|
background = Color(0xFFFFFBFE),
|
||||||
@@ -37,7 +37,7 @@ private val LightColorScheme = lightColorScheme(
|
|||||||
fun PinkOVTheme(
|
fun PinkOVTheme(
|
||||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
// Dynamic color is available on Android 12+
|
// Dynamic color is available on Android 12+
|
||||||
dynamicColor: Boolean = true,
|
dynamicColor: Boolean = false,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
val colorScheme = when {
|
val colorScheme = when {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M200,880Q167,880 143.5,856.5Q120,833 120,800L120,240Q120,207 143.5,183.5Q167,160 200,160L240,160L240,80L320,80L320,160L640,160L640,80L720,80L720,160L760,160Q793,160 816.5,183.5Q840,207 840,240L840,800Q840,833 816.5,856.5Q793,880 760,880L200,880ZM200,800L760,800Q760,800 760,800Q760,800 760,800L760,400L200,400L200,800Q200,800 200,800Q200,800 200,800ZM200,320L760,320L760,240Q760,240 760,240Q760,240 760,240L200,240Q200,240 200,240Q200,240 200,240L200,320ZM440,560L440,480L520,480L520,560L440,560ZM280,560L280,480L360,480L360,560L280,560ZM600,680L600,600L680,600L680,680L600,680ZM440,680L440,600L520,600L520,680L440,680ZM280,680L280,600L360,600L360,680L280,680ZM600,560L600,480L680,480L680,560L600,560Z" />
|
||||||
|
</vector>
|
||||||
Reference in New Issue
Block a user