style: 代码清理 — 移除未使用的 import 和变量

- Platform.android.kt: 移除未使用的 kotlinx.coroutines.launch import
  和未使用的 scope 变量
- CalendarMonthView.kt: 移除未使用的 density 变量
- App.kt: 格式化缩进

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-19 18:29:41 +08:00
parent c651a74b9f
commit e5ce11128a
3 changed files with 14 additions and 6 deletions

View File

@ -4,7 +4,6 @@ import android.os.Build
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.launch
class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
@ -24,7 +23,7 @@ actual fun PredictiveBackHandler(
onCancel: () -> Unit
) {
if (Build.VERSION.SDK_INT >= 34) {
val scope = rememberCoroutineScope()
rememberCoroutineScope()
androidx.activity.compose.PredictiveBackHandler(enabled) { progress ->
try {
progress.collect { backEvent ->

View File

@ -57,11 +57,17 @@ fun App() {
if (targetState.ordinal > initialState.ordinal) {
// 正向导航:新页面从右侧滑入覆盖,旧页面略微左移+淡出
(slideInHorizontally { it } + fadeIn()) togetherWith
(slideOutHorizontally { -it / 4 } + fadeOut())
(slideOutHorizontally { -it / 4 } + fadeOut())
} else {
// 返回导航:新页面从左侧滑入,旧页面向右侧滑出
(slideInHorizontally(animationSpec = tween(250)) { -it } + fadeIn(animationSpec = tween(250))) togetherWith
(slideOutHorizontally(animationSpec = tween(250)) { it } + fadeOut(animationSpec = tween(250)))
(slideInHorizontally(animationSpec = tween(250)) { -it } + fadeIn(
animationSpec = tween(
250
)
)) togetherWith
(slideOutHorizontally(animationSpec = tween(250)) { it } + fadeOut(
animationSpec = tween(250)
))
}
},
modifier = Modifier.fillMaxSize()
@ -71,6 +77,7 @@ fun App() {
modifier = Modifier,
onNavigateToAbout = { currentScreen = Screen.About }
)
Screen.About -> {
PredictiveBackHandler(
enabled = backProgress == 0f,
@ -88,6 +95,7 @@ fun App() {
}
)
}
Screen.Licenses -> {
PredictiveBackHandler(
enabled = backProgress == 0f,

View File

@ -89,7 +89,7 @@ fun CalendarMonthView(
@Suppress("DEPRECATION") // monthNumber 无替代 APIkotlinx-datetime 尚未提供新接口
val currentMonth by remember { derivedStateOf { viewModel.selectedDate.month.number } }
val density = LocalDensity.current
LocalDensity.current
var rowHeightPx by remember { mutableIntStateOf(0) }
var screenWidthPx by remember { mutableIntStateOf(0) }
@ -448,6 +448,7 @@ private fun CalendarPagerArea(
weekMonday
}
}
else -> weekMonday
}
viewModel.selectDate(date)