Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

feat: improve SetupScreen with 3-page horizontal pager and downloads section

ExTv7ae1b1a7ef1f
diff --git a/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt b/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt
index 7e26df6..8a20439 100644
--- a/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt
+++ b/app/src/main/java/com/excp/podroid/ui/screens/setup/SetupScreen.kt
@@ -48,6 +48,8 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Slider
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
+import androidx.compose.material3.ElevatedCard
+import androidx.compose.material3.windowsizeclass.WindowSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@@ -64,12 +66,14 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.excp.podroid.ui.components.AdaptiveContainer
import kotlinx.coroutines.launch
private val storageSizes = listOf(2, 4, 8, 16, 32, 64)
@Composable
fun SetupScreen(
+ windowSizeClass: WindowSizeClass,
onSetupComplete: () -> Unit,
viewModel: SetupViewModel = hiltViewModel(),
) {
@@ -121,18 +125,21 @@ fun SetupScreen(
) { page ->
when (page) {
0 -> StoragePage(
+ windowSizeClass = windowSizeClass,
sliderPosition = sliderPosition,
selectedGb = selectedGb,
onSliderChange = { sliderPosition = it },
onNext = { scope.launch { pagerState.animateScrollToPage(1) } },
)
1 -> VmConfigPage(
+ windowSizeClass = windowSizeClass,
sshEnabled = sshEnabled,
onSshToggle = { sshEnabled = it },
onBack = { scope.launch { pagerState.animateScrollToPage(0) } },
onNext = { scope.launch { pagerState.animateScrollToPage(2) } },
)
2 -> StorageAccessPage(
+ windowSizeClass = windowSizeClass,
storageAccessEnabled = storageAccessEnabled,
onStorageAccessToggle = { enabled ->
storageAccessEnabled = enabled
@@ -205,133 +212,152 @@ fun SetupScreen(
@Composable
private fun StoragePage(
+ windowSizeClass: WindowSizeClass,
sliderPosition: Float,
selectedGb: Int,
onSliderChange: (Float) -> Unit,
onNext: () -> Unit,
) {
// Outer column keeps button fixed at bottom while inner column scrolls
- Column(
+ AdaptiveContainer(
+ windowSizeClass = windowSizeClass,
modifier = Modifier.fillMaxSize(),
- horizontalAlignment = Alignment.CenterHorizontally,
+ maxWidth = 600
) {
Column(
modifier = Modifier
- .weight(1f)
- .verticalScroll(rememberScrollState())
- .padding(horizontal = 24.dp),
+ .fillMaxSize()
+ .padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
- Spacer(Modifier.height(40.dp))
+ ElevatedCard(
+ modifier = Modifier
+ .weight(1f)
+ .padding(horizontal = 16.dp),
+ shape = RoundedCornerShape(24.dp),
+ colors = CardDefaults.elevatedCardColors(
+ containerColor = MaterialTheme.colorScheme.surface
+ )
+ ) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState())
+ .padding(horizontal = 24.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ Spacer(Modifier.height(40.dp))
- Icon(
- imageVector = Icons.Default.Storage,
- contentDescription = null,
- modifier = Modifier.size(64.dp),
- tint = MaterialTheme.colorScheme.primary,
- )
+ Icon(
+ imageVector = Icons.Default.Storage,
+ contentDescription = null,
+ modifier = Modifier.size(64.dp),
+ tint = MaterialTheme.colorScheme.primary,
+ )
- Spacer(Modifier.height(20.dp))
+ Spacer(Modifier.height(20.dp))
- Text(
- text = "Persistent Storage",
- style = MaterialTheme.typography.headlineMedium,
- fontWeight = FontWeight.Bold,
- textAlign = TextAlign.Center,
- )
+ Text(
+ text = "Persistent Storage",
+ style = MaterialTheme.typography.headlineMedium,
+ fontWeight = FontWeight.Bold,
+ textAlign = TextAlign.Center,
+ )
- Spacer(Modifier.height(8.dp))
+ Spacer(Modifier.height(8.dp))
- Text(
- text = "Stores installed packages, container images, and your files.",
- style = MaterialTheme.typography.bodyLarge,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- textAlign = TextAlign.Center,
- )
+ Text(
+ text = "Stores installed packages, container images, and your files.",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ textAlign = TextAlign.Center,
+ )
- Spacer(Modifier.height(48.dp))
+ Spacer(Modifier.height(48.dp))
- Text(
- text = "$selectedGb GB",
- style = MaterialTheme.typography.displayMedium,
- fontWeight = FontWeight.Bold,
- color = MaterialTheme.colorScheme.primary,
- )
+ Text(
+ text = "$selectedGb GB",
+ style = MaterialTheme.typography.displayMedium,
+ fontWeight = FontWeight.Bold,
+ color = MaterialTheme.colorScheme.primary,
+ )
- Spacer(Modifier.height(8.dp))
+ Spacer(Modifier.height(8.dp))
- Slider(
- value = sliderPosition,
- onValueChange = onSliderChange,
- valueRange = 0f..(storageSizes.lastIndex.toFloat()),
- steps = 4,
- modifier = Modifier.fillMaxWidth(),
- )
+ Slider(
+ value = sliderPosition,
+ onValueChange = onSliderChange,
+ valueRange = 0f..(storageSizes.lastIndex.toFloat()),
+ steps = 4,
+ modifier = Modifier.fillMaxWidth(),
+ )
- Row(
- modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceBetween,
- ) {
- Text(
- "2 GB",
- style = MaterialTheme.typography.labelSmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
- Text(
- "64 GB",
- style = MaterialTheme.typography.labelSmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
- }
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ ) {
+ Text(
+ "2 GB",
+ style = MaterialTheme.typography.labelSmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ Text(
+ "64 GB",
+ style = MaterialTheme.typography.labelSmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
- Spacer(Modifier.height(24.dp))
+ Spacer(Modifier.height(24.dp))
- Card(
- modifier = Modifier.fillMaxWidth(),
- shape = RoundedCornerShape(12.dp),
- colors = CardDefaults.cardColors(
- containerColor = MaterialTheme.colorScheme.secondaryContainer,
- ),
- ) {
- Row(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
- verticalAlignment = Alignment.CenterVertically,
+ Card(
+ modifier = Modifier.fillMaxWidth(),
+ shape = RoundedCornerShape(12.dp),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.secondaryContainer,
+ ),
+ ) {
+ Row(
+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(
+ Icons.Default.Info,
+ contentDescription = null,
+ tint = MaterialTheme.colorScheme.secondary,
+ modifier = Modifier.size(18.dp),
+ )
+ Spacer(Modifier.width(12.dp))
+ Text(
+ text = "Cannot be resized later without a full VM reset.",
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSecondaryContainer,
+ )
+ }
+ }
+
+ Spacer(Modifier.height(16.dp))
+ }
+ }
+
+ // Fixed next button
+ Column(modifier = Modifier.padding(horizontal = 24.dp, vertical = 16.dp)) {
+ Button(
+ onClick = onNext,
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(56.dp),
+ shape = RoundedCornerShape(16.dp),
) {
- Icon(
- Icons.Default.Info,
- contentDescription = null,
- tint = MaterialTheme.colorScheme.secondary,
- modifier = Modifier.size(18.dp),
- )
- Spacer(Modifier.width(12.dp))
Text(
- text = "Cannot be resized later without a full VM reset.",
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSecondaryContainer,
+ "Next",
+ style = MaterialTheme.typography.titleMedium,
+ fontWeight = FontWeight.SemiBold,
)
+ Spacer(Modifier.width(8.dp))
+ Icon(Icons.AutoMirrored.Filled.ArrowForward, contentDescription = null)
}
}
-
- Spacer(Modifier.height(16.dp))
- }
-
- // Fixed next button
- Column(modifier = Modifier.padding(horizontal = 24.dp, vertical = 16.dp)) {
- Button(
- onClick = onNext,
- modifier = Modifier
- .fillMaxWidth()
- .height(56.dp),
- shape = RoundedCornerShape(16.dp),
- ) {
- Text(
- "Next",
- style = MaterialTheme.typography.titleMedium,
- fontWeight = FontWeight.SemiBold,
- )
- Spacer(Modifier.width(8.dp))
- Icon(Icons.AutoMirrored.Filled.ArrowForward, contentDescription = null)
- }
}
}
}
@@ -340,164 +366,183 @@ private fun StoragePage(
@Composable
private fun VmConfigPage(
+ windowSizeClass: WindowSizeClass,
sshEnabled: Boolean,
onSshToggle: (Boolean) -> Unit,
onBack: () -> Unit,
onNext: () -> Unit,
) {
- Column(
+ AdaptiveContainer(
+ windowSizeClass = windowSizeClass,
modifier = Modifier.fillMaxSize(),
- horizontalAlignment = Alignment.CenterHorizontally,
+ maxWidth = 600
) {
Column(
modifier = Modifier
- .weight(1f)
- .verticalScroll(rememberScrollState())
- .padding(horizontal = 24.dp),
+ .fillMaxSize()
+ .padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
- Spacer(Modifier.height(40.dp))
-
- Icon(
- imageVector = Icons.Default.Memory,
- contentDescription = null,
- modifier = Modifier.size(64.dp),
- tint = MaterialTheme.colorScheme.primary,
- )
-
- Spacer(Modifier.height(20.dp))
+ ElevatedCard(
+ modifier = Modifier
+ .weight(1f)
+ .padding(horizontal = 16.dp),
+ shape = RoundedCornerShape(24.dp),
+ colors = CardDefaults.elevatedCardColors(
+ containerColor = MaterialTheme.colorScheme.surface
+ )
+ ) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState())
+ .padding(horizontal = 24.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ Spacer(Modifier.height(40.dp))
- Text(
- text = "Configure Your VM",
- style = MaterialTheme.typography.headlineMedium,
- fontWeight = FontWeight.Bold,
- textAlign = TextAlign.Center,
- )
+ Icon(
+ imageVector = Icons.Default.Memory,
+ contentDescription = null,
+ modifier = Modifier.size(64.dp),
+ tint = MaterialTheme.colorScheme.primary,
+ )
- Spacer(Modifier.height(8.dp))
+ Spacer(Modifier.height(20.dp))
- Text(
- text = "Defaults are tuned for the best balance of performance and battery. Adjust anytime in Settings.",
- style = MaterialTheme.typography.bodyLarge,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- textAlign = TextAlign.Center,
- )
+ Text(
+ text = "Configure Your VM",
+ style = MaterialTheme.typography.headlineMedium,
+ fontWeight = FontWeight.Bold,
+ textAlign = TextAlign.Center,
+ )
- Spacer(Modifier.height(32.dp))
+ Spacer(Modifier.height(8.dp))
- // Performance defaults
- Card(
- modifier = Modifier.fillMaxWidth(),
- shape = RoundedCornerShape(16.dp),
- colors = CardDefaults.cardColors(
- containerColor = MaterialTheme.colorScheme.surfaceVariant,
- ),
- ) {
- Column(modifier = Modifier.padding(20.dp)) {
Text(
- "Default Performance",
- style = MaterialTheme.typography.labelLarge,
- color = MaterialTheme.colorScheme.primary,
+ text = "Defaults are tuned for the best balance of performance and battery. Adjust anytime in Settings.",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ textAlign = TextAlign.Center,
)
- Spacer(Modifier.height(16.dp))
- SetupInfoRow(label = "CPU", value = "1 core")
- Spacer(Modifier.height(8.dp))
- SetupInfoRow(label = "RAM", value = "512 MB")
- }
- }
- Spacer(Modifier.height(12.dp))
+ Spacer(Modifier.height(32.dp))
- // SSH toggle
- Card(
- modifier = Modifier.fillMaxWidth(),
- shape = RoundedCornerShape(16.dp),
- colors = CardDefaults.cardColors(
- containerColor = if (sshEnabled)
- MaterialTheme.colorScheme.primaryContainer
- else
- MaterialTheme.colorScheme.surfaceVariant,
- ),
- ) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(20.dp),
- verticalAlignment = Alignment.CenterVertically,
- ) {
- Icon(
- Icons.Default.Security,
- contentDescription = null,
- tint = if (sshEnabled)
- MaterialTheme.colorScheme.primary
- else
- MaterialTheme.colorScheme.onSurfaceVariant,
- modifier = Modifier.size(24.dp),
- )
- Spacer(Modifier.width(16.dp))
- Column(modifier = Modifier.weight(1f)) {
- Text(
- "SSH Access",
- style = MaterialTheme.typography.titleMedium,
- fontWeight = FontWeight.SemiBold,
- )
- Spacer(Modifier.height(4.dp))
- Text(
- if (sshEnabled)
- "ssh root@<phone-ip> -p 9922\nPassword: podroid"
- else
- "Connect to the VM over your local network.",
- style = MaterialTheme.typography.bodySmall,
- color = if (sshEnabled)
- MaterialTheme.colorScheme.onPrimaryContainer
+ // Performance defaults
+ Card(
+ modifier = Modifier.fillMaxWidth(),
+ shape = RoundedCornerShape(16.dp),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceVariant,
+ ),
+ ) {
+ Column(modifier = Modifier.padding(20.dp)) {
+ Text(
+ "Default Performance",
+ style = MaterialTheme.typography.labelLarge,
+ color = MaterialTheme.colorScheme.primary,
+ )
+ Spacer(Modifier.height(16.dp))
+ SetupInfoRow(label = "CPU", value = "1 core")
+ Spacer(Modifier.height(8.dp))
+ SetupInfoRow(label = "RAM", value = "512 MB")
+ }
+ }
+
+ Spacer(Modifier.height(12.dp))
+
+ // SSH toggle
+ Card(
+ modifier = Modifier.fillMaxWidth(),
+ shape = RoundedCornerShape(16.dp),
+ colors = CardDefaults.cardColors(
+ containerColor = if (sshEnabled)
+ MaterialTheme.colorScheme.primaryContainer
else
- MaterialTheme.colorScheme.onSurfaceVariant,
- )
+ MaterialTheme.colorScheme.surfaceVariant,
+ ),
+ ) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(20.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Icon(
+ Icons.Default.Security,
+ contentDescription = null,
+ tint = if (sshEnabled)
+ MaterialTheme.colorScheme.primary
+ else
+ MaterialTheme.colorScheme.onSurfaceVariant,
+ modifier = Modifier.size(24.dp),
+ )
+ Spacer(Modifier.width(16.dp))
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ "SSH Access",
+ style = MaterialTheme.typography.titleMedium,
+ fontWeight = FontWeight.SemiBold,
+ )
+ Spacer(Modifier.height(4.dp))
+ Text(
+ if (sshEnabled)
+ "ssh root@<phone-ip> -p 9922\nPassword: podroid"
+ else
+ "Connect to the VM over your local network.",
+ style = MaterialTheme.typography.bodySmall,
+ color = if (sshEnabled)
+ MaterialTheme.colorScheme.onPrimaryContainer
+ else
+ MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ Spacer(Modifier.width(12.dp))
+ Switch(
+ checked = sshEnabled,
+ onCheckedChange = onSshToggle,
+ )
+ }
}
- Spacer(Modifier.width(12.dp))
- Switch(
- checked = sshEnabled,
- onCheckedChange = onSshToggle,
- )
+
+ Spacer(Modifier.height(16.dp))
}
}
- Spacer(Modifier.height(16.dp))
- }
-
- // Fixed back + next buttons
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 24.dp, vertical = 16.dp),
- horizontalArrangement = Arrangement.spacedBy(12.dp),
- verticalAlignment = Alignment.CenterVertically,
- ) {
- FilledTonalButton(
- onClick = onBack,
- modifier = Modifier
- .weight(1f)
- .height(56.dp),
- shape = RoundedCornerShape(16.dp),
- ) {
- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null)
- Spacer(Modifier.width(8.dp))
- Text("Back", style = MaterialTheme.typography.titleMedium)
- }
- Button(
- onClick = onNext,
+ // Fixed back + next buttons
+ Row(
modifier = Modifier
- .weight(2f)
- .height(56.dp),
- shape = RoundedCornerShape(16.dp),
+ .fillMaxWidth()
+ .padding(horizontal = 24.dp, vertical = 16.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ verticalAlignment = Alignment.CenterVertically,
) {
- Text(
- "Next",
- style = MaterialTheme.typography.titleMedium,
- fontWeight = FontWeight.SemiBold,
- )
- Spacer(Modifier.width(8.dp))
- Icon(Icons.AutoMirrored.Filled.ArrowForward, contentDescription = null)
+ FilledTonalButton(
+ onClick = onBack,
+ modifier = Modifier
+ .weight(1f)
+ .height(56.dp),
+ shape = RoundedCornerShape(16.dp),
+ ) {
+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null)
+ Spacer(Modifier.width(8.dp))
+ Text("Back", style = MaterialTheme.typography.titleMedium)
+ }
+ Button(
+ onClick = onNext,
+ modifier = Modifier
+ .weight(2f)
+ .height(56.dp),
+ shape = RoundedCornerShape(16.dp),
+ ) {
+ Text(
+ "Next",
+ style = MaterialTheme.typography.titleMedium,
+ fontWeight = FontWeight.SemiBold,
+ )
+ Spacer(Modifier.width(8.dp))
+ Icon(Icons.AutoMirrored.Filled.ArrowForward, contentDescription = null)
+ }
}
}
}
@@ -505,6 +550,7 @@ private fun VmConfigPage(
@Composable
private fun StorageAccessPage(
+ windowSizeClass: WindowSizeClass,
storageAccessEnabled: Boolean,
onStorageAccessToggle: (Boolean) -> Unit,
onOpenStorageAccessSettings: () -> Unit,
@@ -514,138 +560,157 @@ private fun StorageAccessPage(
val canManageAllFiles = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
val hasStoragePermission = !canManageAllFiles || Environment.isExternalStorageManager()
- Column(
+ AdaptiveContainer(
+ windowSizeClass = windowSizeClass,
modifier = Modifier.fillMaxSize(),
- horizontalAlignment = Alignment.CenterHorizontally,
+ maxWidth = 600
) {
Column(
modifier = Modifier
- .weight(1f)
- .verticalScroll(rememberScrollState())
- .padding(horizontal = 24.dp),
+ .fillMaxSize()
+ .padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
- Spacer(Modifier.height(40.dp))
+ ElevatedCard(
+ modifier = Modifier
+ .weight(1f)
+ .padding(horizontal = 16.dp),
+ shape = RoundedCornerShape(24.dp),
+ colors = CardDefaults.elevatedCardColors(
+ containerColor = MaterialTheme.colorScheme.surface
+ )
+ ) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState())
+ .padding(horizontal = 24.dp),
+ horizontalAlignment = Alignment.CenterHorizontally,
+ ) {
+ Spacer(Modifier.height(40.dp))
- Icon(
- imageVector = Icons.Default.Security,
- contentDescription = null,
- modifier = Modifier.size(64.dp),
- tint = MaterialTheme.colorScheme.primary,
- )
+ Icon(
+ imageVector = Icons.Default.Security,
+ contentDescription = null,
+ modifier = Modifier.size(64.dp),
+ tint = MaterialTheme.colorScheme.primary,
+ )
- Spacer(Modifier.height(20.dp))
+ Spacer(Modifier.height(20.dp))
- Text(
- text = "Downloads Sharing",
- style = MaterialTheme.typography.headlineMedium,
- fontWeight = FontWeight.Bold,
- textAlign = TextAlign.Center,
- )
+ Text(
+ text = "Downloads Sharing",
+ style = MaterialTheme.typography.headlineMedium,
+ fontWeight = FontWeight.Bold,
+ textAlign = TextAlign.Center,
+ )
- Spacer(Modifier.height(8.dp))
+ Spacer(Modifier.height(8.dp))
- Text(
- text = "Optional access to your Downloads folder inside the VM.",
- style = MaterialTheme.typography.bodyLarge,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- textAlign = TextAlign.Center,
- )
+ Text(
+ text = "Optional access to your Downloads folder inside the VM.",
+ style = MaterialTheme.typography.bodyLarge,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ textAlign = TextAlign.Center,
+ )
- Spacer(Modifier.height(32.dp))
+ Spacer(Modifier.height(32.dp))
- Card(
- modifier = Modifier.fillMaxWidth(),
- shape = RoundedCornerShape(16.dp),
- colors = CardDefaults.cardColors(
- containerColor = MaterialTheme.colorScheme.surfaceVariant,
- ),
- ) {
- Column(modifier = Modifier.padding(20.dp)) {
- Row(
+ Card(
modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically,
+ shape = RoundedCornerShape(16.dp),
+ colors = CardDefaults.cardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceVariant,
+ ),
) {
- Column(modifier = Modifier.weight(1f)) {
+ Column(modifier = Modifier.padding(20.dp)) {
+ Row(
+ modifier = Modifier.fillMaxWidth(),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(modifier = Modifier.weight(1f)) {
+ Text(
+ text = "Enable Downloads sharing",
+ style = MaterialTheme.typography.titleMedium,
+ fontWeight = FontWeight.SemiBold,
+ )
+ Spacer(Modifier.height(4.dp))
+ Text(
+ text = "Shares the Android Downloads folder with the VM over virtio-9p.",
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ Spacer(Modifier.width(12.dp))
+ Switch(
+ checked = storageAccessEnabled,
+ onCheckedChange = onStorageAccessToggle,
+ )
+ }
+
+ Spacer(Modifier.height(16.dp))
+
Text(
- text = "Enable Downloads sharing",
- style = MaterialTheme.typography.titleMedium,
+ text = "On some devices this may crash the VM.",
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.error,
fontWeight = FontWeight.SemiBold,
)
- Spacer(Modifier.height(4.dp))
- Text(
- text = "Shares the Android Downloads folder with the VM over virtio-9p.",
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
- }
- Spacer(Modifier.width(12.dp))
- Switch(
- checked = storageAccessEnabled,
- onCheckedChange = onStorageAccessToggle,
- )
- }
-
- Spacer(Modifier.height(16.dp))
-
- Text(
- text = "On some devices this may crash the VM.",
- style = MaterialTheme.typography.bodyMedium,
- color = MaterialTheme.colorScheme.error,
- fontWeight = FontWeight.SemiBold,
- )
- if (storageAccessEnabled && canManageAllFiles && !hasStoragePermission) {
- Spacer(Modifier.height(16.dp))
- Button(
- onClick = onOpenStorageAccessSettings,
- shape = RoundedCornerShape(12.dp),
- ) {
- Text("Grant storage access")
+ if (storageAccessEnabled && canManageAllFiles && !hasStoragePermission) {
+ Spacer(Modifier.height(16.dp))
+ Button(
+ onClick = onOpenStorageAccessSettings,
+ shape = RoundedCornerShape(12.dp),
+ ) {
+ Text("Grant storage access")
+ }
+ } else if (storageAccessEnabled && canManageAllFiles) {
+ Spacer(Modifier.height(12.dp))
+ Text(
+ text = if (hasStoragePermission) "All files access granted." else "All files access not granted.",
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
}
- } else if (storageAccessEnabled && canManageAllFiles) {
- Spacer(Modifier.height(12.dp))
- Text(
- text = if (hasStoragePermission) "All files access granted." else "All files access not granted.",
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
}
+ Spacer(Modifier.height(16.dp))
}
}
- }
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 24.dp, vertical = 16.dp),
- horizontalArrangement = Arrangement.spacedBy(12.dp),
- verticalAlignment = Alignment.CenterVertically,
- ) {
- FilledTonalButton(
- onClick = onBack,
- modifier = Modifier
- .weight(1f)
- .height(56.dp),
- shape = RoundedCornerShape(16.dp),
- ) {
- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null)
- Spacer(Modifier.width(8.dp))
- Text("Back", style = MaterialTheme.typography.titleMedium)
- }
- Button(
- onClick = onGetStarted,
+ Row(
modifier = Modifier
- .weight(2f)
- .height(56.dp),
- shape = RoundedCornerShape(16.dp),
+ .fillMaxWidth()
+ .padding(horizontal = 24.dp, vertical = 16.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ verticalAlignment = Alignment.CenterVertically,
) {
- Text(
- "Get Started",
- style = MaterialTheme.typography.titleMedium,
- fontWeight = FontWeight.SemiBold,
- )
+ FilledTonalButton(
+ onClick = onBack,
+ modifier = Modifier
+ .weight(1f)
+ .height(56.dp),
+ shape = RoundedCornerShape(16.dp),
+ ) {
+ Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null)
+ Spacer(Modifier.width(8.dp))
+ Text("Back", style = MaterialTheme.typography.titleMedium)
+ }
+ Button(
+ onClick = onGetStarted,
+ modifier = Modifier
+ .weight(2f)
+ .height(56.dp),
+ shape = RoundedCornerShape(16.dp),
+ ) {
+ Text(
+ "Get Started",
+ style = MaterialTheme.typography.titleMedium,
+ fontWeight = FontWeight.SemiBold,
+ )
+ }
}
}
}