feat: HomeScreen 统计卡片点击导航至阅读记录/阅读总览
This commit is contained in:
@@ -169,6 +169,9 @@ fun MainActivity.mainEntryProvider(
|
|||||||
onNavigateToReadRecord = {
|
onNavigateToReadRecord = {
|
||||||
onNavigateToRoute(MainRouteReadRecord)
|
onNavigateToRoute(MainRouteReadRecord)
|
||||||
},
|
},
|
||||||
|
onNavigateToReadRecordOverview = {
|
||||||
|
onNavigateToRoute(MainRouteReadRecordOverview)
|
||||||
|
},
|
||||||
onNavigateToHighlightTagRule = {
|
onNavigateToHighlightTagRule = {
|
||||||
onNavigateToRoute(MainRouteHighlightTagRule)
|
onNavigateToRoute(MainRouteHighlightTagRule)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ fun MainScreen(
|
|||||||
onNavigateToRssFavorites: () -> Unit,
|
onNavigateToRssFavorites: () -> Unit,
|
||||||
onNavigateToRuleSub: () -> Unit,
|
onNavigateToRuleSub: () -> Unit,
|
||||||
onNavigateToReadRecord: () -> Unit,
|
onNavigateToReadRecord: () -> Unit,
|
||||||
|
onNavigateToReadRecordOverview: () -> Unit,
|
||||||
onNavigateToHighlightTagRule: () -> Unit,
|
onNavigateToHighlightTagRule: () -> Unit,
|
||||||
onNavigateToAbout: () -> Unit,
|
onNavigateToAbout: () -> Unit,
|
||||||
sharedTransitionScope: SharedTransitionScope? = null,
|
sharedTransitionScope: SharedTransitionScope? = null,
|
||||||
@@ -392,6 +393,8 @@ fun MainScreen(
|
|||||||
context.startActivityForBook(book)
|
context.startActivityForBook(book)
|
||||||
},
|
},
|
||||||
onOpenBackupSettings = onNavigateToBackupSettings,
|
onOpenBackupSettings = onNavigateToBackupSettings,
|
||||||
|
onNavigateToReadRecord = onNavigateToReadRecord,
|
||||||
|
onNavigateToReadRecordOverview = onNavigateToReadRecordOverview,
|
||||||
sharedTransitionScope = sharedTransitionScope,
|
sharedTransitionScope = sharedTransitionScope,
|
||||||
animatedVisibilityScope = animatedVisibilityScope,
|
animatedVisibilityScope = animatedVisibilityScope,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ import kotlin.math.roundToInt
|
|||||||
fun HomeRouteScreen(
|
fun HomeRouteScreen(
|
||||||
onOpenBook: (Book) -> Unit,
|
onOpenBook: (Book) -> Unit,
|
||||||
onOpenBackupSettings: () -> Unit,
|
onOpenBackupSettings: () -> Unit,
|
||||||
|
onNavigateToReadRecord: () -> Unit,
|
||||||
|
onNavigateToReadRecordOverview: () -> Unit,
|
||||||
sharedTransitionScope: SharedTransitionScope? = null,
|
sharedTransitionScope: SharedTransitionScope? = null,
|
||||||
animatedVisibilityScope: AnimatedVisibilityScope? = null,
|
animatedVisibilityScope: AnimatedVisibilityScope? = null,
|
||||||
viewModel: HomeViewModel = koinViewModel(),
|
viewModel: HomeViewModel = koinViewModel(),
|
||||||
@@ -178,6 +180,8 @@ fun HomeRouteScreen(
|
|||||||
HomeScreen(
|
HomeScreen(
|
||||||
state = state,
|
state = state,
|
||||||
onIntent = viewModel::onIntent,
|
onIntent = viewModel::onIntent,
|
||||||
|
onNavigateToReadRecord = onNavigateToReadRecord,
|
||||||
|
onNavigateToReadRecordOverview = onNavigateToReadRecordOverview,
|
||||||
sharedTransitionScope = sharedTransitionScope,
|
sharedTransitionScope = sharedTransitionScope,
|
||||||
animatedVisibilityScope = animatedVisibilityScope,
|
animatedVisibilityScope = animatedVisibilityScope,
|
||||||
)
|
)
|
||||||
@@ -188,6 +192,8 @@ fun HomeRouteScreen(
|
|||||||
fun HomeScreen(
|
fun HomeScreen(
|
||||||
state: HomeUiState,
|
state: HomeUiState,
|
||||||
onIntent: (HomeIntent) -> Unit,
|
onIntent: (HomeIntent) -> Unit,
|
||||||
|
onNavigateToReadRecord: () -> Unit = {},
|
||||||
|
onNavigateToReadRecordOverview: () -> Unit = {},
|
||||||
sharedTransitionScope: SharedTransitionScope? = null,
|
sharedTransitionScope: SharedTransitionScope? = null,
|
||||||
animatedVisibilityScope: AnimatedVisibilityScope? = null,
|
animatedVisibilityScope: AnimatedVisibilityScope? = null,
|
||||||
) {
|
) {
|
||||||
@@ -231,6 +237,7 @@ fun HomeScreen(
|
|||||||
title = stringResource(R.string.home_total_read_books),
|
title = stringResource(R.string.home_total_read_books),
|
||||||
value = state.totalReadBooks.toString(),
|
value = state.totalReadBooks.toString(),
|
||||||
unit = stringResource(R.string.unit_books),
|
unit = stringResource(R.string.unit_books),
|
||||||
|
onClick = onNavigateToReadRecord,
|
||||||
)
|
)
|
||||||
StatisticCard(
|
StatisticCard(
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
@@ -238,6 +245,7 @@ fun HomeScreen(
|
|||||||
title = stringResource(R.string.home_total_reading_time),
|
title = stringResource(R.string.home_total_reading_time),
|
||||||
value = String.format("%.1f", state.totalReadTimeMillis / 3_600_000.0),
|
value = String.format("%.1f", state.totalReadTimeMillis / 3_600_000.0),
|
||||||
unit = stringResource(R.string.unit_hours),
|
unit = stringResource(R.string.unit_hours),
|
||||||
|
onClick = onNavigateToReadRecordOverview,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -481,9 +489,11 @@ private fun StatisticCard(
|
|||||||
title: String,
|
title: String,
|
||||||
value: String,
|
value: String,
|
||||||
unit: String,
|
unit: String,
|
||||||
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
NormalCard(
|
NormalCard(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
|
onClick = onClick,
|
||||||
cornerRadius = 20.dp,
|
cornerRadius = 20.dp,
|
||||||
containerColor = LegadoTheme.colorScheme.surfaceContainer,
|
containerColor = LegadoTheme.colorScheme.surfaceContainer,
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user