| 1 |
package com.example.oxygenhub.ui |
| 2 |
|
| 3 |
import androidx.compose.foundation.layout.* |
| 4 |
import androidx.compose.material.icons.Icons |
| 5 |
import androidx.compose.material.icons.filled.Home |
| 6 |
import androidx.compose.material.icons.filled.Notifications |
| 7 |
import androidx.compose.material.icons.filled.Person |
| 8 |
import androidx.compose.material.icons.filled.PlayArrow |
| 9 |
import androidx.compose.material3.* |
| 10 |
import androidx.compose.runtime.* |
| 11 |
import androidx.compose.ui.Modifier |
| 12 |
import androidx.compose.ui.text.font.FontWeight |
| 13 |
import androidx.compose.ui.unit.dp |
| 14 |
import uniffi.rust_core.oxygenGreeting |
| 15 |
|
| 16 |
@OptIn(ExperimentalMaterial3Api::class) |
| 17 |
@Composable |
| 18 |
fun MainScreen() { |
| 19 |
var selectedItem by remember { mutableIntStateOf(0) } |
| 20 |
val items = listOf("Home", "Notifications", "Flow", "Profile") |
| 21 |
val icons = listOf(Icons.Filled.Home, Icons.Filled.Notifications, Icons.Filled.PlayArrow, Icons.Filled.Person) |
| 22 |
|
| 23 |
Scaffold( |
| 24 |
topBar = { |
| 25 |
TopAppBar( |
| 26 |
title = { Text("OxygenHub", fontWeight = FontWeight.Bold) }, |
| 27 |
colors = TopAppBarDefaults.topAppBarColors( |
| 28 |
containerColor = MaterialTheme.colorScheme.primaryContainer, |
| 29 |
titleContentColor = MaterialTheme.colorScheme.onPrimaryContainer |
| 30 |
) |
| 31 |
) |
| 32 |
}, |
| 33 |
bottomBar = { |
| 34 |
NavigationBar { |
| 35 |
items.forEachIndexed { index, item -> |
| 36 |
NavigationBarItem( |
| 37 |
icon = { Icon(icons[index], contentDescription = item) }, |
| 38 |
label = { Text(item) }, |
| 39 |
selected = selectedItem == index, |
| 40 |
onClick = { selectedItem = index } |
| 41 |
) |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
) { innerPadding -> |
| 46 |
Surface( |
| 47 |
modifier = Modifier |
| 48 |
.fillMaxSize() |
| 49 |
.padding(innerPadding), |
| 50 |
color = MaterialTheme.colorScheme.background |
| 51 |
) { |
| 52 |
// Render the selected tab |
| 53 |
when (selectedItem) { |
| 54 |
0 -> HomeTab() |
| 55 |
1 -> NotificationsTab() |
| 56 |
2 -> FlowTab() |
| 57 |
3 -> ProfileTab() |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
@Composable |
| 64 |
fun HomeTab() { |
| 65 |
Column(modifier = Modifier.padding(16.dp)) { |
| 66 |
Text("Activity", style = MaterialTheme.typography.headlineMedium, fontWeight = FontWeight.Bold) |
| 67 |
Spacer(modifier = Modifier.height(16.dp)) |
| 68 |
Card(modifier = Modifier.fillMaxWidth()) { |
| 69 |
Column(modifier = Modifier.padding(16.dp)) { |
| 70 |
Text("Native Core Status:", style = MaterialTheme.typography.titleMedium) |
| 71 |
Spacer(modifier = Modifier.height(8.dp)) |
| 72 |
// This calls our Rust FFI function! |
| 73 |
Text(text = oxygenGreeting("Andy"), color = MaterialTheme.colorScheme.primary) |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
@Composable |
| 80 |
fun NotificationsTab() { |
| 81 |
Box(modifier = Modifier.fillMaxSize(), contentAlignment = androidx.compose.ui.Alignment.Center) { |
| 82 |
Text("No new notifications") |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
@Composable |
| 87 |
fun FlowTab() { |
| 88 |
Column(modifier = Modifier.padding(16.dp)) { |
| 89 |
Text("Active Pipelines", style = MaterialTheme.typography.headlineMedium, fontWeight = FontWeight.Bold) |
| 90 |
Spacer(modifier = Modifier.height(16.dp)) |
| 91 |
Card(modifier = Modifier.fillMaxWidth()) { |
| 92 |
Column(modifier = Modifier.padding(16.dp)) { |
| 93 |
Text("oxygenhub-android / main", fontWeight = FontWeight.Bold) |
| 94 |
Text("🧱 Build - Passing", color = androidx.compose.ui.graphics.Color(0xFF4CAF50)) |
| 95 |
Text("🧪 Functional Tests - Passing", color = androidx.compose.ui.graphics.Color(0xFF4CAF50)) |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
@Composable |
| 102 |
fun ProfileTab() { |
| 103 |
Box(modifier = Modifier.fillMaxSize(), contentAlignment = androidx.compose.ui.Alignment.Center) { |
| 104 |
Text("Profile Settings") |
| 105 |
} |
| 106 |
} |