Remove debug println logging and unused TAG constant

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-15 11:24:30 +08:00
parent c74de5f151
commit f189c188c7
4 changed files with 0 additions and 21 deletions

View File

@ -47,14 +47,12 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
val currentMonth: Int get() = selectedDate.month.number val currentMonth: Int get() = selectedDate.month.number
fun selectDate(date: LocalDate) { fun selectDate(date: LocalDate) {
println("CalendarViewModel: selectDate $date (was $selectedDate)")
selectedDate = date selectedDate = date
} }
fun onDrag(delta: Float) { fun onDrag(delta: Float) {
coroutineScope.launch { coroutineScope.launch {
val new = (_collapseAnimatable.value + delta).coerceIn(0f, 1f) val new = (_collapseAnimatable.value + delta).coerceIn(0f, 1f)
println("CalendarViewModel: onDrag delta=$delta, progress=${_collapseAnimatable.value} -> $new")
_collapseAnimatable.snapTo(new) _collapseAnimatable.snapTo(new)
} }
} }
@ -63,20 +61,17 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
fun onDragEnd() { fun onDragEnd() {
coroutineScope.launch { coroutineScope.launch {
val current = _collapseAnimatable.value val current = _collapseAnimatable.value
println("CalendarViewModel: onDragEnd current=$current, threshold=$COLLAPSE_THRESHOLD")
if (current > COLLAPSE_THRESHOLD) { if (current > COLLAPSE_THRESHOLD) {
_collapseAnimatable.animateTo( _collapseAnimatable.animateTo(
targetValue = 1f, targetValue = 1f,
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f) animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
) )
isCollapsed = true isCollapsed = true
println("CalendarViewModel: collapsed=true")
} else { } else {
_collapseAnimatable.animateTo( _collapseAnimatable.animateTo(
targetValue = 0f, targetValue = 0f,
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f) animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
) )
println("CalendarViewModel: snapped back to 0f")
} }
} }
} }
@ -85,7 +80,6 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
fun onExpandDrag(delta: Float) { fun onExpandDrag(delta: Float) {
coroutineScope.launch { coroutineScope.launch {
val new = (_collapseAnimatable.value + delta).coerceIn(0f, 1f) val new = (_collapseAnimatable.value + delta).coerceIn(0f, 1f)
println("CalendarViewModel: onExpandDrag delta=$delta, progress=${_collapseAnimatable.value} -> $new")
_collapseAnimatable.snapTo(new) _collapseAnimatable.snapTo(new)
} }
} }
@ -94,20 +88,17 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
fun onExpandDragEnd() { fun onExpandDragEnd() {
coroutineScope.launch { coroutineScope.launch {
val current = _collapseAnimatable.value val current = _collapseAnimatable.value
println("CalendarViewModel: onExpandDragEnd current=$current, threshold=$COLLAPSE_THRESHOLD")
if (current < COLLAPSE_THRESHOLD) { if (current < COLLAPSE_THRESHOLD) {
_collapseAnimatable.animateTo( _collapseAnimatable.animateTo(
targetValue = 0f, targetValue = 0f,
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f) animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
) )
isCollapsed = false isCollapsed = false
println("CalendarViewModel: expanded=false")
} else { } else {
_collapseAnimatable.animateTo( _collapseAnimatable.animateTo(
targetValue = 1f, targetValue = 1f,
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f) animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
) )
println("CalendarViewModel: snapped back to 1f")
} }
} }
} }

View File

@ -33,7 +33,6 @@ fun BottomCard(
) { ) {
val density = LocalDensity.current val density = LocalDensity.current
val dragRange = with(density) { DRAG_RANGE_DP.dp.toPx() } val dragRange = with(density) { DRAG_RANGE_DP.dp.toPx() }
println("BottomCard: isCollapsed=${viewModel.isCollapsed}, dragRange=$dragRange, progress=${viewModel.collapseProgress}")
Surface( Surface(
modifier = modifier modifier = modifier

View File

@ -116,7 +116,6 @@ fun CalendarMonthPage(
if (weekIndex == 0 && rowHeightPx == 0) { if (weekIndex == 0 && rowHeightPx == 0) {
Modifier.onSizeChanged { size -> Modifier.onSizeChanged { size ->
if (size.height > 0) { if (size.height > 0) {
println("CalendarMonthPage: measured rowHeight=${size.height}px, reporting to parent")
onRowHeightMeasured?.invoke(size.height) onRowHeightMeasured?.invoke(size.height)
} }
} }

View File

@ -31,8 +31,6 @@ import kotlin.math.abs
import kotlin.time.Clock import kotlin.time.Clock
import plus.rua.project.CalendarViewModel import plus.rua.project.CalendarViewModel
private const val TAG = "CalendarMonthView"
/** /**
* 日历主界面包含月/周视图切换和折叠动画 * 日历主界面包含月/周视图切换和折叠动画
* *
@ -61,10 +59,8 @@ fun CalendarMonthView(
val pagerState = rememberPagerState(initialPage = START_PAGE, pageCount = { Int.MAX_VALUE }) val pagerState = rememberPagerState(initialPage = START_PAGE, pageCount = { Int.MAX_VALUE })
val p = viewModel.collapseProgress val p = viewModel.collapseProgress
println("$TAG: collapseProgress=$p, isCollapsed=${viewModel.isCollapsed}")
val headerHeightPx = monthHeaderHeightPx + weekdayHeaderHeightPx val headerHeightPx = monthHeaderHeightPx + weekdayHeaderHeightPx
val rowPaddingPx = with(density) { ROW_PADDING_DP.dp.toPx() }.toInt() val rowPaddingPx = with(density) { ROW_PADDING_DP.dp.toPx() }.toInt()
println("$TAG: headerHeightPx=$headerHeightPx (month=$monthHeaderHeightPx, weekday=$weekdayHeaderHeightPx), rowPaddingPx=$rowPaddingPx")
val interpolatedWeeks by remember { val interpolatedWeeks by remember {
derivedStateOf { derivedStateOf {
@ -89,8 +85,6 @@ fun CalendarMonthView(
(cellWidth + rowPadding).toInt() (cellWidth + rowPadding).toInt()
} else 0 } else 0
println("$TAG: screenWidthPx=$screenWidthPx, screenHeightPx=$screenHeightPx, estimatedRowHeightPx=$estimatedRowHeightPx, measuredRowHeightPx=$rowHeightPx")
val effectiveRowHeightPx = if (rowHeightPx > 0) rowHeightPx else estimatedRowHeightPx val effectiveRowHeightPx = if (rowHeightPx > 0) rowHeightPx else estimatedRowHeightPx
// 折叠时网格高度公式(与 CalendarMonthPage 一致): // 折叠时网格高度公式(与 CalendarMonthPage 一致):
@ -110,7 +104,6 @@ fun CalendarMonthView(
val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx
val cardHeightPx = if (screenHeightPx > 0 && calendarAreaHeightPx > 0) screenHeightPx - calendarAreaHeightPx else 0 val cardHeightPx = if (screenHeightPx > 0 && calendarAreaHeightPx > 0) screenHeightPx - calendarAreaHeightPx else 0
println("$TAG: effectiveRowHeightPx=$effectiveRowHeightPx, effectiveWeeks=$effectiveWeeks, gridHeightPx=$gridHeightPx, calendarAreaHeightPx=$calendarAreaHeightPx, cardHeightPx=$cardHeightPx")
// 当 rowHeightPx 已知时,用计算的高度约束 pager否则让 pager 自由扩展以测量行高 // 当 rowHeightPx 已知时,用计算的高度约束 pager否则让 pager 自由扩展以测量行高
val pagerModifier = if (rowHeightPx > 0 && gridHeightPx > 0) { val pagerModifier = if (rowHeightPx > 0 && gridHeightPx > 0) {
@ -146,7 +139,6 @@ fun CalendarMonthView(
) )
// 完全折叠且无动画时显示 WeekPager否则显示 CalendarPager含下拉恢复过程 // 完全折叠且无动画时显示 WeekPager否则显示 CalendarPager含下拉恢复过程
if (viewModel.isCollapsed && viewModel.collapseProgress >= 1f) { if (viewModel.isCollapsed && viewModel.collapseProgress >= 1f) {
println("$TAG: Showing WeekPager (isCollapsed=true, progress=${viewModel.collapseProgress})")
WeekPager( WeekPager(
selectedDate = viewModel.selectedDate, selectedDate = viewModel.selectedDate,
today = today, today = today,
@ -158,7 +150,6 @@ fun CalendarMonthView(
} }
) )
} else { } else {
println("$TAG: Showing CalendarPager (isCollapsed=${viewModel.isCollapsed}, progress=${viewModel.collapseProgress})")
CalendarPager( CalendarPager(
selectedDate = viewModel.selectedDate, selectedDate = viewModel.selectedDate,
today = today, today = today,
@ -181,7 +172,6 @@ fun CalendarMonthView(
} }
if (cardHeightPx > 0) { if (cardHeightPx > 0) {
println("$TAG: BottomCard height=${with(density) { cardHeightPx.toDp() }}")
BottomCard( BottomCard(
viewModel = viewModel, viewModel = viewModel,
modifier = Modifier modifier = Modifier