diagnostics(mutual): log prefill scroll path under tag Look4SatMutual

Temporary Log.d probes at prefill, list-layout gate, scroll effect entry,
scrollToItem outcome and consume, to locate why the map Match prefill
scroll does not land on the device (Robolectric covers it). Bump 12.5.
This commit is contained in:
atsunatsu committed 2026-09-22 15:13:47 +08:00
1 parent dbf2229774
commit 94a1a4f7b7
3 files changed
+24 -3

No files matched your search

@@ -17,6 +17,7 @@
*/ */
package com.rtbishop.look4sat.feature.mutual package com.rtbishop.look4sat.feature.mutual
import android.util.Log
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically import androidx.compose.animation.expandVertically
import androidx.compose.animation.shrinkVertically import androidx.compose.animation.shrinkVertically
@@ -229,11 +230,17 @@ private fun MutualContent(
// page stays at the top). onGloballyPositioned fires on the first real // page stays at the top). onGloballyPositioned fires on the first real
// layout, so the subsequent scrollToItem always has a measured list. // layout, so the subsequent scrollToItem always has a measured list.
var listReady by remember { mutableStateOf(false) } var listReady by remember { mutableStateOf(false) }
Log.d(TAG, "composed: scrollToTimeRange=${state.scrollToTimeRange} matchIndex=${if (state.errorMessage != null) 2 else 1} listReady=$listReady")
LazyColumn( LazyColumn(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.onGloballyPositioned { listReady = true }, .onGloballyPositioned {
if (!listReady) {
Log.d(TAG, "lazy list laid out, opening prefill scroll gate")
listReady = true
}
},
state = listState, state = listState,
verticalArrangement = Arrangement.spacedBy(6.dp) verticalArrangement = Arrangement.spacedBy(6.dp)
) { ) {
@@ -390,13 +397,23 @@ private fun MutualContent(
// Compose version (verified in tests), while scrollToItem lands correctly. // Compose version (verified in tests), while scrollToItem lands correctly.
val matchSearchIndex = if (state.errorMessage != null) 2 else 1 val matchSearchIndex = if (state.errorMessage != null) 2 else 1
LaunchedEffect(state.scrollToTimeRange, matchSearchIndex, listReady) { LaunchedEffect(state.scrollToTimeRange, matchSearchIndex, listReady) {
Log.d(TAG, "scroll effect: scrollToTimeRange=${state.scrollToTimeRange} matchIndex=$matchSearchIndex listReady=$listReady")
if (state.scrollToTimeRange && listReady) { if (state.scrollToTimeRange && listReady) {
Log.d(TAG, "attempting scrollToItem($matchSearchIndex)")
try {
listState.scrollToItem(matchSearchIndex) listState.scrollToItem(matchSearchIndex)
Log.d(TAG, "scrollToItem($matchSearchIndex) done, firstVisible=${listState.firstVisibleItemIndex}")
} catch (t: Throwable) {
Log.e(TAG, "scrollToItem($matchSearchIndex) threw", t)
}
viewModel.consumeScrollToTimeRange() viewModel.consumeScrollToTimeRange()
Log.d(TAG, "scrollToTimeRange consumed")
} }
} }
} }
private const val TAG = "Look4SatMutual"
@Composable @Composable
private fun MutualStatusChip(state: MutualUiState) { private fun MutualStatusChip(state: MutualUiState) {
val colorScheme = MaterialTheme.colorScheme val colorScheme = MaterialTheme.colorScheme
@@ -40,6 +40,8 @@ import kotlinx.coroutines.withContext
import kotlin.math.PI import kotlin.math.PI
import kotlin.math.roundToInt import kotlin.math.roundToInt
private const val TAG = "Look4SatMutual"
data class MutualUiState( data class MutualUiState(
val stationALat: String = "", val stationALat: String = "",
val stationALon: String = "", val stationALon: String = "",
@@ -197,6 +199,7 @@ class MutualViewModel(
fun prefillMatchFromGrid(grid: String) { fun prefillMatchFromGrid(grid: String) {
val g = grid.trim().uppercase() val g = grid.trim().uppercase()
val pos = qthToPosition(g) val pos = qthToPosition(g)
android.util.Log.d(TAG, "prefillMatchFromGrid('$g')")
_uiState.update { _uiState.update {
it.copy( it.copy(
stationBGrid = g, stationBGrid = g,
@@ -210,6 +213,7 @@ class MutualViewModel(
} }
fun consumeScrollToTimeRange() { fun consumeScrollToTimeRange() {
android.util.Log.d(TAG, "consumeScrollToTimeRange")
_uiState.update { it.copy(scrollToTimeRange = false) } _uiState.update { it.copy(scrollToTimeRange = false) }
} }
+2 -2
View File
@@ -1,8 +1,8 @@
[versions] [versions]
#noinspection UnusedVersionCatalogEntry #noinspection UnusedVersionCatalogEntry
appVersionCode = "490" appVersionCode = "491"
#noinspection UnusedVersionCatalogEntry #noinspection UnusedVersionCatalogEntry
appVersionName = "4.4.7-ba7opf.12.4" appVersionName = "4.4.7-ba7opf.12.5"
#noinspection UnusedVersionCatalogEntry #noinspection UnusedVersionCatalogEntry
compileSdk = "37" compileSdk = "37"
#noinspection UnusedVersionCatalogEntry #noinspection UnusedVersionCatalogEntry