|
| 1 | +package com.traverse.demo.android |
| 2 | + |
| 3 | +import android.os.Bundle |
| 4 | +import androidx.activity.ComponentActivity |
| 5 | +import androidx.activity.compose.setContent |
| 6 | +import androidx.compose.foundation.layout.Arrangement |
| 7 | +import androidx.compose.foundation.layout.Column |
| 8 | +import androidx.compose.foundation.layout.PaddingValues |
| 9 | +import androidx.compose.foundation.layout.fillMaxSize |
| 10 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 11 | +import androidx.compose.foundation.layout.padding |
| 12 | +import androidx.compose.foundation.lazy.LazyColumn |
| 13 | +import androidx.compose.foundation.lazy.items |
| 14 | +import androidx.compose.material3.Card |
| 15 | +import androidx.compose.material3.MaterialTheme |
| 16 | +import androidx.compose.material3.Scaffold |
| 17 | +import androidx.compose.material3.Text |
| 18 | +import androidx.compose.runtime.Composable |
| 19 | +import androidx.compose.ui.Modifier |
| 20 | +import androidx.compose.ui.unit.dp |
| 21 | + |
| 22 | +class MainActivity : ComponentActivity() { |
| 23 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 24 | + super.onCreate(savedInstanceState) |
| 25 | + setContent { |
| 26 | + MaterialTheme { |
| 27 | + TraverseAndroidDemoScreen(sampleStateUpdates) |
| 28 | + } |
| 29 | + } |
| 30 | + } |
| 31 | +} |
| 32 | + |
| 33 | +private val sampleStateUpdates = listOf( |
| 34 | + DemoStateUpdate( |
| 35 | + "Discovering capability", |
| 36 | + "Looking up expedition.planning.plan-expedition@1.0.0 in the registry." |
| 37 | + ), |
| 38 | + DemoStateUpdate( |
| 39 | + "Evaluating constraints", |
| 40 | + "Confirming the approved expedition capability can run locally." |
| 41 | + ), |
| 42 | + DemoStateUpdate( |
| 43 | + "Executing workflow", |
| 44 | + "Traversing the approved expedition planning workflow." |
| 45 | + ), |
| 46 | + DemoStateUpdate( |
| 47 | + "Completed", |
| 48 | + "The expedition plan is ready for final review." |
| 49 | + ) |
| 50 | +) |
| 51 | + |
| 52 | +data class DemoStateUpdate( |
| 53 | + val title: String, |
| 54 | + val detail: String, |
| 55 | +) |
| 56 | + |
| 57 | +@Composable |
| 58 | +private fun TraverseAndroidDemoScreen(stateUpdates: List<DemoStateUpdate>) { |
| 59 | + Scaffold { padding -> |
| 60 | + LazyColumn( |
| 61 | + modifier = Modifier |
| 62 | + .fillMaxSize() |
| 63 | + .padding(padding), |
| 64 | + contentPadding = PaddingValues(16.dp), |
| 65 | + verticalArrangement = Arrangement.spacedBy(12.dp), |
| 66 | + ) { |
| 67 | + item { |
| 68 | + Card(modifier = Modifier.fillMaxWidth()) { |
| 69 | + Column(modifier = Modifier.padding(16.dp)) { |
| 70 | + Text("Traverse Android Demo", style = MaterialTheme.typography.headlineSmall) |
| 71 | + Text( |
| 72 | + "Plan Expedition", |
| 73 | + style = MaterialTheme.typography.titleMedium, |
| 74 | + modifier = Modifier.padding(top = 8.dp) |
| 75 | + ) |
| 76 | + Text( |
| 77 | + "Runtime states and final trace summary render from the approved expedition demo fixture.", |
| 78 | + style = MaterialTheme.typography.bodyMedium, |
| 79 | + modifier = Modifier.padding(top = 8.dp) |
| 80 | + ) |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | + |
| 85 | + items(stateUpdates) { update -> |
| 86 | + Card(modifier = Modifier.fillMaxWidth()) { |
| 87 | + Column(modifier = Modifier.padding(16.dp)) { |
| 88 | + Text(update.title, style = MaterialTheme.typography.titleMedium) |
| 89 | + Text( |
| 90 | + update.detail, |
| 91 | + style = MaterialTheme.typography.bodyMedium, |
| 92 | + modifier = Modifier.padding(top = 6.dp) |
| 93 | + ) |
| 94 | + } |
| 95 | + } |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | +} |
0 commit comments