feat: hide tabs when 1 bundle is used

This commit is contained in:
CnC-Robert 2023-06-03 20:12:03 +02:00
parent cd0144b563
commit b8c58c0695
No known key found for this signature in database
GPG Key ID: C58ED617AEA8CB68
2 changed files with 21 additions and 18 deletions

View File

@ -82,7 +82,7 @@ class MainActivity : ComponentActivity() {
is Destination.PatchesSelector -> PatchesSelectorScreen(
onBackClick = { navController.pop() },
startPatching = {
onPatchClick = {
navController.navigate(
Destination.Installer(
destination.input,

View File

@ -34,7 +34,9 @@ const val allowUnsupported = false
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@Composable
fun PatchesSelectorScreen(
startPatching: (PatchesSelection) -> Unit, onBackClick: () -> Unit, vm: PatchesSelectorViewModel
onPatchClick: (PatchesSelection) -> Unit,
onBackClick: () -> Unit,
vm: PatchesSelectorViewModel
) {
val pagerState = rememberPagerState()
val coroutineScope = rememberCoroutineScope()
@ -57,9 +59,10 @@ fun PatchesSelectorScreen(
}, floatingActionButton = {
ExtendedFloatingActionButton(text = { Text(stringResource(R.string.patch)) },
icon = { Icon(Icons.Default.Build, null) },
onClick = { startPatching(vm.generateSelection()) })
onClick = { onPatchClick(vm.generateSelection()) })
}) { paddingValues ->
Column(Modifier.fillMaxSize().padding(paddingValues)) {
if (bundles.size > 1) {
TabRow(
selectedTabIndex = pagerState.currentPage,
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp)
@ -74,6 +77,7 @@ fun PatchesSelectorScreen(
)
}
}
}
HorizontalPager(
pageCount = bundles.size,
@ -131,9 +135,8 @@ fun PatchesSelectorScreen(
)
}
}
})
}
)
}
}
}