Move lockscreen tabs into the toolbar

This commit is contained in:
Jonas Lochmann 2024-10-28 01:00:00 +01:00
parent 11a47c5f30
commit 8e02eb3fb3
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
2 changed files with 104 additions and 100 deletions

View file

@ -51,6 +51,7 @@ fun ScreenScaffold(
backStack: List<BackStackItem>, backStack: List<BackStackItem>,
snackbarHostState: SnackbarHostState?, snackbarHostState: SnackbarHostState?,
content: @Composable (PaddingValues) -> Unit, content: @Composable (PaddingValues) -> Unit,
extraBars: (@Composable () -> Unit)? = null,
executeCommand: (UpdateStateCommand) -> Unit, executeCommand: (UpdateStateCommand) -> Unit,
showAuthenticationDialog: (() -> Unit)? showAuthenticationDialog: (() -> Unit)?
) { ) {
@ -58,6 +59,7 @@ fun ScreenScaffold(
Scaffold( Scaffold(
topBar = { topBar = {
Column {
TopAppBar( TopAppBar(
title = { title = {
Column { Column {
@ -121,6 +123,9 @@ fun ScreenScaffold(
modifier = Modifier, modifier = Modifier,
windowInsets = WindowInsets.statusBarsIgnoringVisibility windowInsets = WindowInsets.statusBarsIgnoringVisibility
) )
extraBars?.invoke()
}
}, },
bottomBar = { bottomBar = {
val backStackColors = ButtonDefaults.textButtonColors( val backStackColors = ButtonDefaults.textButtonColors(

View file

@ -147,8 +147,7 @@ class LockActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.De
subtitle = subtitle, subtitle = subtitle,
backStack = emptyList(), backStack = emptyList(),
snackbarHostState = null, snackbarHostState = null,
content = { padding -> extraBars = {
Column (Modifier.fillMaxSize().padding(padding)) {
TabRow( TabRow(
pager.currentPage, pager.currentPage,
indicator = { tabPositions -> indicator = { tabPositions ->
@ -190,10 +189,11 @@ class LockActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.De
) )
} }
} }
},
content = { padding ->
HorizontalPager( HorizontalPager(
pager, pager,
Modifier.weight(1.0F, fill = true), Modifier.fillMaxSize().padding(padding),
pageContent = { index -> pageContent = { index ->
when (index) { when (index) {
0 -> AndroidFragment<LockReasonFragment>(Modifier.fillMaxSize()) 0 -> AndroidFragment<LockReasonFragment>(Modifier.fillMaxSize())
@ -202,7 +202,6 @@ class LockActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.De
} }
} }
) )
}
}, },
executeCommand = {}, executeCommand = {},
showAuthenticationDialog = showAuthenticationDialog =