diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTopAppBar.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTopAppBar.kt index 6d8997c28..7e8a0e79e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTopAppBar.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferTopAppBar.kt @@ -31,6 +31,15 @@ import com.infomaniak.swisstransfer.ui.images.icons.Cross import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows +@Composable +fun SwissTransferTopAppBar( + @StringRes titleRes: Int, + navigationMenu: TopAppBarButton? = null, + vararg actionMenus: TopAppBarButton, +) { + SwissTransferTopAppBar(title = stringResource(titleRes), navigationMenu, *actionMenus) +} + @Composable @OptIn(ExperimentalMaterial3Api::class) fun SwissTransferTopAppBar( @@ -79,7 +88,7 @@ data class TopAppBarButton( private fun SwissTransferTopAppBarPreview() { SwissTransferTheme { SwissTransferTopAppBar( - title = stringResource(R.string.appName), + titleRes = R.string.appName, navigationMenu = TopAppBarButton.backButton {}, TopAppBarButton(AppIcons.Add, R.string.appName) {}, TopAppBarButton.closeButton {}, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt index 46cc2f7fa..e52028d13 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/OptionScaffold.kt @@ -27,7 +27,6 @@ import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.components.SwissTransferTopAppBar import com.infomaniak.swisstransfer.ui.components.TopAppBarButton @@ -48,7 +47,7 @@ fun OptionScaffold( SmallWindowTopAppBarScaffold( smallWindowTopAppBar = { SwissTransferTopAppBar( - title = stringResource(topAppBarTitleRes), + titleRes = topAppBarTitleRes, navigationMenu = TopAppBarButton.backButton(navigateBack ?: {}), ) }, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt index b025c18f4..668294c36 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt @@ -115,7 +115,7 @@ private fun ImportFilesScreen( BottomStickyButtonScaffold( topBar = { SwissTransferTopAppBar( - title = stringResource(R.string.importFilesScreenTitle), + titleRes = R.string.importFilesScreenTitle, navigationMenu = null, TopAppBarButton.closeButton { closeActivity() }, )