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