From c0aed4a9977bcd71ef5b215b5a8dfa362d220663 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Wed, 12 Aug 2026 05:10:55 -0400 Subject: [PATCH] fix: dashcam auto-loads + compact card style for both sections - LaunchedEffect auto-refreshes on tab open (no more manual refresh needed) - Imported Videos card matches USB Dashcam compact style - Removed bulky Refresh button from imported videos --- .../java/com/yarisobd/app/DashcamScreen.kt | 53 ++++--------------- 1 file changed, 11 insertions(+), 42 deletions(-) diff --git a/android/app/src/main/java/com/yarisobd/app/DashcamScreen.kt b/android/app/src/main/java/com/yarisobd/app/DashcamScreen.kt index c317e9c..8d3d6eb 100644 --- a/android/app/src/main/java/com/yarisobd/app/DashcamScreen.kt +++ b/android/app/src/main/java/com/yarisobd/app/DashcamScreen.kt @@ -31,6 +31,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Download import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -63,6 +64,9 @@ fun DashcamScreen( onImport: (List?) -> Unit, ) { Column(modifier = Modifier.fillMaxSize()) { + + // Auto-refresh on first load + LaunchedEffect(Unit) { onRefresh() } com.yarisobd.app.ui.components.YarisHeader() // USB Dashcam section @@ -92,51 +96,16 @@ fun DashcamScreen( } } - // Header card + // Imported videos card — match USB dashcam style Card( - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - colors = CardDefaults.cardColors( - containerColor = MaterialTheme.colorScheme.surfaceContainerHigh - ) + modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 4.dp), + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerHigh) ) { - Column(modifier = Modifier.padding(16.dp)) { - Text( - text = "Dashcam Videos", - style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.primary - ) - Spacer(modifier = Modifier.height(4.dp)) - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text( - text = "${videos.size} files", - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface - ) - Text( - text = formatBytes(totalSize), - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant - ) - } + Column(modifier = Modifier.padding(12.dp)) { + Text("Imported Videos", style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary) + Text("${videos.size} files · ${formatBytes(totalSize)}", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) if (retentionDays > 0) { - Text( - text = "Auto-delete after ${retentionDays}d (if uploaded)", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant - ) - } - Spacer(modifier = Modifier.height(8.dp)) - Button( - onClick = onRefresh, - enabled = !isLoading, - modifier = Modifier.fillMaxWidth() - ) { - Text(if (isLoading) "Loading..." else "Refresh") + Text("Auto-delete after ${retentionDays}d", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant) } } }