Remove debug println logging and unused TAG constant
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
c74de5f151
commit
f189c188c7
@ -47,14 +47,12 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
|
||||
val currentMonth: Int get() = selectedDate.month.number
|
||||
|
||||
fun selectDate(date: LocalDate) {
|
||||
println("CalendarViewModel: selectDate $date (was $selectedDate)")
|
||||
selectedDate = date
|
||||
}
|
||||
|
||||
fun onDrag(delta: Float) {
|
||||
coroutineScope.launch {
|
||||
val new = (_collapseAnimatable.value + delta).coerceIn(0f, 1f)
|
||||
println("CalendarViewModel: onDrag delta=$delta, progress=${_collapseAnimatable.value} -> $new")
|
||||
_collapseAnimatable.snapTo(new)
|
||||
}
|
||||
}
|
||||
@ -63,20 +61,17 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
|
||||
fun onDragEnd() {
|
||||
coroutineScope.launch {
|
||||
val current = _collapseAnimatable.value
|
||||
println("CalendarViewModel: onDragEnd current=$current, threshold=$COLLAPSE_THRESHOLD")
|
||||
if (current > COLLAPSE_THRESHOLD) {
|
||||
_collapseAnimatable.animateTo(
|
||||
targetValue = 1f,
|
||||
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
|
||||
)
|
||||
isCollapsed = true
|
||||
println("CalendarViewModel: collapsed=true")
|
||||
} else {
|
||||
_collapseAnimatable.animateTo(
|
||||
targetValue = 0f,
|
||||
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) {
|
||||
coroutineScope.launch {
|
||||
val new = (_collapseAnimatable.value + delta).coerceIn(0f, 1f)
|
||||
println("CalendarViewModel: onExpandDrag delta=$delta, progress=${_collapseAnimatable.value} -> $new")
|
||||
_collapseAnimatable.snapTo(new)
|
||||
}
|
||||
}
|
||||
@ -94,20 +88,17 @@ class CalendarViewModel(private val coroutineScope: CoroutineScope) {
|
||||
fun onExpandDragEnd() {
|
||||
coroutineScope.launch {
|
||||
val current = _collapseAnimatable.value
|
||||
println("CalendarViewModel: onExpandDragEnd current=$current, threshold=$COLLAPSE_THRESHOLD")
|
||||
if (current < COLLAPSE_THRESHOLD) {
|
||||
_collapseAnimatable.animateTo(
|
||||
targetValue = 0f,
|
||||
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
|
||||
)
|
||||
isCollapsed = false
|
||||
println("CalendarViewModel: expanded=false")
|
||||
} else {
|
||||
_collapseAnimatable.animateTo(
|
||||
targetValue = 1f,
|
||||
animationSpec = spring(dampingRatio = 0.8f, stiffness = 400f)
|
||||
)
|
||||
println("CalendarViewModel: snapped back to 1f")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,6 @@ fun BottomCard(
|
||||
) {
|
||||
val density = LocalDensity.current
|
||||
val dragRange = with(density) { DRAG_RANGE_DP.dp.toPx() }
|
||||
println("BottomCard: isCollapsed=${viewModel.isCollapsed}, dragRange=$dragRange, progress=${viewModel.collapseProgress}")
|
||||
|
||||
Surface(
|
||||
modifier = modifier
|
||||
|
||||
@ -116,7 +116,6 @@ fun CalendarMonthPage(
|
||||
if (weekIndex == 0 && rowHeightPx == 0) {
|
||||
Modifier.onSizeChanged { size ->
|
||||
if (size.height > 0) {
|
||||
println("CalendarMonthPage: measured rowHeight=${size.height}px, reporting to parent")
|
||||
onRowHeightMeasured?.invoke(size.height)
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,6 @@ import kotlin.math.abs
|
||||
import kotlin.time.Clock
|
||||
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 p = viewModel.collapseProgress
|
||||
println("$TAG: collapseProgress=$p, isCollapsed=${viewModel.isCollapsed}")
|
||||
val headerHeightPx = monthHeaderHeightPx + weekdayHeaderHeightPx
|
||||
val rowPaddingPx = with(density) { ROW_PADDING_DP.dp.toPx() }.toInt()
|
||||
println("$TAG: headerHeightPx=$headerHeightPx (month=$monthHeaderHeightPx, weekday=$weekdayHeaderHeightPx), rowPaddingPx=$rowPaddingPx")
|
||||
|
||||
val interpolatedWeeks by remember {
|
||||
derivedStateOf {
|
||||
@ -89,8 +85,6 @@ fun CalendarMonthView(
|
||||
(cellWidth + rowPadding).toInt()
|
||||
} else 0
|
||||
|
||||
println("$TAG: screenWidthPx=$screenWidthPx, screenHeightPx=$screenHeightPx, estimatedRowHeightPx=$estimatedRowHeightPx, measuredRowHeightPx=$rowHeightPx")
|
||||
|
||||
val effectiveRowHeightPx = if (rowHeightPx > 0) rowHeightPx else estimatedRowHeightPx
|
||||
|
||||
// 折叠时网格高度公式(与 CalendarMonthPage 一致):
|
||||
@ -110,7 +104,6 @@ fun CalendarMonthView(
|
||||
|
||||
val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx
|
||||
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 自由扩展以测量行高
|
||||
val pagerModifier = if (rowHeightPx > 0 && gridHeightPx > 0) {
|
||||
@ -146,7 +139,6 @@ fun CalendarMonthView(
|
||||
)
|
||||
// 完全折叠且无动画时显示 WeekPager,否则显示 CalendarPager(含下拉恢复过程)
|
||||
if (viewModel.isCollapsed && viewModel.collapseProgress >= 1f) {
|
||||
println("$TAG: Showing WeekPager (isCollapsed=true, progress=${viewModel.collapseProgress})")
|
||||
WeekPager(
|
||||
selectedDate = viewModel.selectedDate,
|
||||
today = today,
|
||||
@ -158,7 +150,6 @@ fun CalendarMonthView(
|
||||
}
|
||||
)
|
||||
} else {
|
||||
println("$TAG: Showing CalendarPager (isCollapsed=${viewModel.isCollapsed}, progress=${viewModel.collapseProgress})")
|
||||
CalendarPager(
|
||||
selectedDate = viewModel.selectedDate,
|
||||
today = today,
|
||||
@ -181,7 +172,6 @@ fun CalendarMonthView(
|
||||
}
|
||||
|
||||
if (cardHeightPx > 0) {
|
||||
println("$TAG: BottomCard height=${with(density) { cardHeightPx.toDp() }}")
|
||||
BottomCard(
|
||||
viewModel = viewModel,
|
||||
modifier = Modifier
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user