mirror of
https://github.com/revanced/revanced-manager-compose
synced 2025-02-22 11:01:09 +01:00
feat: hide tabs when 1 bundle is used
This commit is contained in:
parent
cd0144b563
commit
b8c58c0695
@ -82,7 +82,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
is Destination.PatchesSelector -> PatchesSelectorScreen(
|
is Destination.PatchesSelector -> PatchesSelectorScreen(
|
||||||
onBackClick = { navController.pop() },
|
onBackClick = { navController.pop() },
|
||||||
startPatching = {
|
onPatchClick = {
|
||||||
navController.navigate(
|
navController.navigate(
|
||||||
Destination.Installer(
|
Destination.Installer(
|
||||||
destination.input,
|
destination.input,
|
||||||
|
@ -34,7 +34,9 @@ const val allowUnsupported = false
|
|||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun PatchesSelectorScreen(
|
fun PatchesSelectorScreen(
|
||||||
startPatching: (PatchesSelection) -> Unit, onBackClick: () -> Unit, vm: PatchesSelectorViewModel
|
onPatchClick: (PatchesSelection) -> Unit,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
vm: PatchesSelectorViewModel
|
||||||
) {
|
) {
|
||||||
val pagerState = rememberPagerState()
|
val pagerState = rememberPagerState()
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
@ -57,21 +59,23 @@ fun PatchesSelectorScreen(
|
|||||||
}, floatingActionButton = {
|
}, floatingActionButton = {
|
||||||
ExtendedFloatingActionButton(text = { Text(stringResource(R.string.patch)) },
|
ExtendedFloatingActionButton(text = { Text(stringResource(R.string.patch)) },
|
||||||
icon = { Icon(Icons.Default.Build, null) },
|
icon = { Icon(Icons.Default.Build, null) },
|
||||||
onClick = { startPatching(vm.generateSelection()) })
|
onClick = { onPatchClick(vm.generateSelection()) })
|
||||||
}) { paddingValues ->
|
}) { paddingValues ->
|
||||||
Column(Modifier.fillMaxSize().padding(paddingValues)) {
|
Column(Modifier.fillMaxSize().padding(paddingValues)) {
|
||||||
TabRow(
|
if (bundles.size > 1) {
|
||||||
selectedTabIndex = pagerState.currentPage,
|
TabRow(
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp)
|
selectedTabIndex = pagerState.currentPage,
|
||||||
) {
|
containerColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.0.dp)
|
||||||
bundles.forEachIndexed { index, bundle ->
|
) {
|
||||||
Tab(
|
bundles.forEachIndexed { index, bundle ->
|
||||||
selected = pagerState.currentPage == index,
|
Tab(
|
||||||
onClick = { coroutineScope.launch { pagerState.animateScrollToPage(index) } },
|
selected = pagerState.currentPage == index,
|
||||||
text = { Text(bundle.name) },
|
onClick = { coroutineScope.launch { pagerState.animateScrollToPage(index) } },
|
||||||
selectedContentColor = MaterialTheme.colorScheme.primary,
|
text = { Text(bundle.name) },
|
||||||
unselectedContentColor = MaterialTheme.colorScheme.onSurfaceVariant
|
selectedContentColor = MaterialTheme.colorScheme.primary,
|
||||||
)
|
unselectedContentColor = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,9 +135,8 @@ fun PatchesSelectorScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user