From 8b464d1722c7838dd7021d07c1ddd458c2dc0875 Mon Sep 17 00:00:00 2001 From: soupslurpr <92235850+soupslurpr@users.noreply.github.com> Date: Sun, 27 Oct 2024 01:23:29 -0700 Subject: [PATCH] support edge-to-edge --- .../kotlin/app/grapheneos/info/InfoApp.kt | 68 +++++++++++++++---- .../info/ui/community/CommunityScreen.kt | 12 +++- .../info/ui/donate/DonateStartScreen.kt | 16 +++-- .../info/ui/donate/GithubSponsorsScreen.kt | 13 +++- .../grapheneos/info/ui/donate/PaypalScreen.kt | 12 +++- .../banktransfers/BankTransfersScreen.kt | 9 ++- .../ui/donate/cryptocurrency/BitcoinScreen.kt | 11 ++- .../ui/donate/cryptocurrency/CardanoScreen.kt | 11 ++- .../DonateCryptoCurrencyStartScreen.kt | 26 +++---- .../donate/cryptocurrency/EthereumScreen.kt | 11 ++- .../donate/cryptocurrency/LitecoinScreen.kt | 11 ++- .../ui/donate/cryptocurrency/MoneroScreen.kt | 11 ++- .../ui/donate/cryptocurrency/ZcashScreen.kt | 11 ++- .../ui/releasenotes/ReleaseNotesScreen.kt | 6 +- .../reusablecomposables/ScreenLazyColumn.kt | 17 ++++- 15 files changed, 182 insertions(+), 63 deletions(-) diff --git a/app/src/main/kotlin/app/grapheneos/info/InfoApp.kt b/app/src/main/kotlin/app/grapheneos/info/InfoApp.kt index 57b023f..ad1fe19 100644 --- a/app/src/main/kotlin/app/grapheneos/info/InfoApp.kt +++ b/app/src/main/kotlin/app/grapheneos/info/InfoApp.kt @@ -11,6 +11,10 @@ import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.slideIn import androidx.compose.animation.slideOut +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.calculateEndPadding +import androidx.compose.foundation.layout.calculateStartPadding +import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.icons.Icons @@ -42,11 +46,13 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.IntOffset +import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.NamedNavArgument import androidx.navigation.NavBackStackEntry @@ -149,6 +155,8 @@ fun InfoApp() { currentWindowAdaptiveInfo() ) + val layoutDirection = LocalLayoutDirection.current + NavigationSuiteScaffold( navigationSuiteItems = { navSuiteItemScreens.forEach { navSuiteItemScreen -> @@ -267,15 +275,18 @@ fun InfoApp() { NavHost( navController = navController, startDestination = startDestination, - modifier = Modifier.padding(innerPadding), ) { composableWithDefaultSlideTransitions( route = InfoAppScreens.ReleaseNotes, navigationSuiteType = navigationSuiteType, ) { ReleaseNotesScreen( - releaseNotesUiState.value.entries.toSortedMap().toList().asReversed(), - { useCaches, onFinishedUpdating -> + modifier = Modifier + .padding(top = innerPadding.calculateTopPadding()) + .consumeWindowInsets(innerPadding), + entries = + releaseNotesUiState.value.entries.toSortedMap().toList().asReversed(), + updateReleaseNotes = { useCaches, onFinishedUpdating -> releaseNotesViewModel.updateReleaseNotes( useCaches = useCaches, showSnackbarError = { @@ -291,7 +302,13 @@ fun InfoApp() { onFinishedUpdating = onFinishedUpdating, ) }, - releaseNotesLazyListState, + lazyListState = releaseNotesLazyListState, + additionalContentPadding = PaddingValues( + start = innerPadding.calculateStartPadding(layoutDirection), + top = 0.dp, + end = innerPadding.calculateEndPadding(layoutDirection), + bottom = innerPadding.calculateBottomPadding() + ) ) } composableWithDefaultSlideTransitions( @@ -299,11 +316,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { CommunityScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } }, + additionalContentPadding = innerPadding ) } navigationWithDefaultSlideTransitions( @@ -316,6 +335,7 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { DonateStartScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), onNavigateToGithubSponsorsScreen = { navController.navigate(InfoAppScreens.DonateGithubSponsors.name) }, @@ -327,7 +347,8 @@ fun InfoApp() { }, onNavigateToBankTransfersScreen = { navController.navigate(InfoAppScreens.DonateBankTransfers.name) - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -335,11 +356,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { GithubSponsorsScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } }, + additionalContentPadding = innerPadding ) } navigationWithDefaultSlideTransitions( @@ -352,6 +375,7 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { DonateCryptoCurrencyStartScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), onNavigateToBitcoinScreen = { navController.navigate(InfoAppScreens.DonateCryptocurrenciesBitcoin.name) }, @@ -369,7 +393,8 @@ fun InfoApp() { }, onNavigateToLitecoinScreen = { navController.navigate(InfoAppScreens.DonateCryptocurrenciesLitecoin.name) - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -377,11 +402,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { BitcoinScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -389,11 +416,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { MoneroScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -401,11 +430,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { ZcashScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -413,11 +444,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { EthereumScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -425,11 +458,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { CardanoScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( @@ -437,11 +472,13 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { LitecoinScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } - } + }, + additionalContentPadding = innerPadding ) } } @@ -450,18 +487,23 @@ fun InfoApp() { navigationSuiteType = navigationSuiteType, ) { PaypalScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), showSnackbarError = { snackbarCoroutine.launch { snackbarHostState.showSnackbar(it) } - } + }, + additionalContentPadding = innerPadding ) } composableWithDefaultSlideTransitions( route = InfoAppScreens.DonateBankTransfers, navigationSuiteType = navigationSuiteType, ) { - BankTransfersScreen() + BankTransfersScreen( + modifier = Modifier.consumeWindowInsets(innerPadding), + additionalContentPadding = innerPadding + ) } } } diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/community/CommunityScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/community/CommunityScreen.kt index ac957c2..f1b79a9 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/community/CommunityScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/community/CommunityScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.community import android.content.res.Configuration.UI_MODE_NIGHT_UNDEFINED +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme @@ -20,10 +21,15 @@ import app.grapheneos.info.ui.reusablecomposables.LinkCardItem import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable -fun CommunityScreen(showSnackbarError: (String) -> Unit) { +fun CommunityScreen( + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) +) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text( @@ -128,6 +134,6 @@ fun CommunityScreen(showSnackbarError: (String) -> Unit) { @Composable private fun CommunityScreenPreview() { MaterialTheme { - CommunityScreen({}) + CommunityScreen() } } diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/DonateStartScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/DonateStartScreen.kt index f660a4a..89fdcea 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/DonateStartScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/DonateStartScreen.kt @@ -2,6 +2,7 @@ package app.grapheneos.info.ui.donate import android.content.res.Configuration import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -29,14 +30,17 @@ import app.grapheneos.info.ui.reusablecomposables.ScreenNavCardItem @Composable fun DonateStartScreen( - onNavigateToGithubSponsorsScreen: () -> Unit, - onNavigateToCryptocurrenciesScreen: () -> Unit, - onNavigateToPayPalScreen: () -> Unit, - onNavigateToBankTransfersScreen: () -> Unit, + modifier: Modifier = Modifier, + onNavigateToGithubSponsorsScreen: () -> Unit = {}, + onNavigateToCryptocurrenciesScreen: () -> Unit = {}, + onNavigateToPayPalScreen: () -> Unit = {}, + onNavigateToBankTransfersScreen: () -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.donate_start_info_part_1)) @@ -135,6 +139,6 @@ fun DonateStartScreen( @Composable private fun DonateScreenPreview() { MaterialTheme { - DonateStartScreen({}, {}, {}, {}) + DonateStartScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/GithubSponsorsScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/GithubSponsorsScreen.kt index e9d59be..6588d39 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/GithubSponsorsScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/GithubSponsorsScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable @@ -14,18 +15,24 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ClickableText import app.grapheneos.info.ui.reusablecomposables.LinkCardItem import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable -fun GithubSponsorsScreen(showSnackbarError: (String) -> Unit) { +fun GithubSponsorsScreen( + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) +) { val githubSponsorsUrl = "https://github.com/sponsors/thestinger" ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { val localUriHandler = LocalUriHandler.current @@ -78,6 +85,6 @@ fun GithubSponsorsScreen(showSnackbarError: (String) -> Unit) { @Composable private fun GithubSponsorsScreenPreview() { MaterialTheme { - GithubSponsorsScreen({}) + GithubSponsorsScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/PaypalScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/PaypalScreen.kt index 8b2291b..f2be32b 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/PaypalScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/PaypalScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons @@ -20,10 +21,15 @@ import app.grapheneos.info.ui.reusablecomposables.LinkCardItem import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable -fun PaypalScreen(showSnackbarError: (String) -> Unit) { +fun PaypalScreen( + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) +) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.paypal_info_description_part_1)) @@ -84,6 +90,6 @@ fun PaypalScreen(showSnackbarError: (String) -> Unit) { @Composable private fun PaypalScreenPreview() { MaterialTheme { - PaypalScreen({}) + PaypalScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/banktransfers/BankTransfersScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/banktransfers/BankTransfersScreen.kt index 625149c..8b88fc2 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/banktransfers/BankTransfersScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/banktransfers/BankTransfersScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate.banktransfers import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.selection.SelectionContainer @@ -18,10 +19,14 @@ import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable -fun BankTransfersScreen() { +fun BankTransfersScreen( + modifier: Modifier = Modifier, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) +) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text( diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/BitcoinScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/BitcoinScreen.kt index b6f1e32..9b483f9 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/BitcoinScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/BitcoinScreen.kt @@ -2,6 +2,7 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -17,16 +18,20 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable fun BitcoinScreen( - showSnackbarError: (String) -> Unit, + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.bitcoin_info)) @@ -95,6 +100,6 @@ fun BitcoinScreen( @Composable private fun BitcoinScreenPreview() { MaterialTheme { - BitcoinScreen({}) + BitcoinScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/CardanoScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/CardanoScreen.kt index 57295d4..2679a2c 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/CardanoScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/CardanoScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material3.MaterialTheme @@ -13,16 +14,20 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.fromHtml import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable fun CardanoScreen( - showSnackbarError: (String) -> Unit, + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.cardano_info)) @@ -61,6 +66,6 @@ fun CardanoScreen( @Composable private fun CardanoScreenPreview() { MaterialTheme { - CardanoScreen({}) + CardanoScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/DonateCryptoCurrencyStartScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/DonateCryptoCurrencyStartScreen.kt index e53f011..43a386b 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/DonateCryptoCurrencyStartScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/DonateCryptoCurrencyStartScreen.kt @@ -1,10 +1,8 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -14,22 +12,24 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers import androidx.compose.ui.unit.dp import app.grapheneos.info.R +import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn import app.grapheneos.info.ui.reusablecomposables.ScreenNavCardItem @Composable fun DonateCryptoCurrencyStartScreen( - onNavigateToBitcoinScreen: () -> Unit, - onNavigateToMoneroScreen: () -> Unit, - onNavigateToZcashScreen: () -> Unit, - onNavigateToEthereumScreen: () -> Unit, - onNavigateToCardanoScreen: () -> Unit, - onNavigateToLitecoinScreen: () -> Unit, + modifier: Modifier = Modifier, + onNavigateToBitcoinScreen: () -> Unit = {}, + onNavigateToMoneroScreen: () -> Unit = {}, + onNavigateToZcashScreen: () -> Unit = {}, + onNavigateToEthereumScreen: () -> Unit = {}, + onNavigateToCardanoScreen: () -> Unit = {}, + onNavigateToLitecoinScreen: () -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { - LazyColumn( - modifier = Modifier + ScreenLazyColumn( + modifier = modifier .fillMaxSize(), - contentPadding = PaddingValues(bottom = 16.dp, start = 16.dp, end = 16.dp), - verticalArrangement = Arrangement.spacedBy(16.dp) + additionalContentPadding = additionalContentPadding ) { item { ScreenNavCardItem( @@ -90,6 +90,6 @@ fun DonateCryptoCurrencyStartScreen( @Composable private fun DonateCryptoCurrencyStartScreenPreview() { MaterialTheme { - DonateCryptoCurrencyStartScreen({}, {}, {}, {}, {}, {}) + DonateCryptoCurrencyStartScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/EthereumScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/EthereumScreen.kt index b089f16..f45901a 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/EthereumScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/EthereumScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -10,16 +11,20 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable fun EthereumScreen( - showSnackbarError: (String) -> Unit, + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.etherium_info)) @@ -51,6 +56,6 @@ fun EthereumScreen( @Composable private fun EthereumScreenPreview() { MaterialTheme { - EthereumScreen({}) + EthereumScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/LitecoinScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/LitecoinScreen.kt index c947faf..2b2d646 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/LitecoinScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/LitecoinScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -9,16 +10,20 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable fun LitecoinScreen( - showSnackbarError: (String) -> Unit, + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.litecoin_info)) @@ -47,6 +52,6 @@ fun LitecoinScreen( @Composable private fun LitecoinScreenPreview() { MaterialTheme { - LitecoinScreen({}) + LitecoinScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/MoneroScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/MoneroScreen.kt index 1642807..1456c6f 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/MoneroScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/MoneroScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -9,16 +10,20 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable fun MoneroScreen( - showSnackbarError: (String) -> Unit, + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.monero_info)) @@ -47,6 +52,6 @@ fun MoneroScreen( @Composable private fun MoneroScreenPreview() { MaterialTheme { - MoneroScreen({}) + MoneroScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/ZcashScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/ZcashScreen.kt index ad4a632..6e2f47d 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/ZcashScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/donate/cryptocurrency/ZcashScreen.kt @@ -1,6 +1,7 @@ package app.grapheneos.info.ui.donate.cryptocurrency import android.content.res.Configuration +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -9,16 +10,20 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Wallpapers +import androidx.compose.ui.unit.dp import app.grapheneos.info.R import app.grapheneos.info.ui.reusablecomposables.ScreenLazyColumn @Composable fun ZcashScreen( - showSnackbarError: (String) -> Unit, + modifier: Modifier = Modifier, + showSnackbarError: (String) -> Unit = {}, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { ScreenLazyColumn( - modifier = Modifier + modifier = modifier .fillMaxSize(), + additionalContentPadding = additionalContentPadding ) { item { Text(stringResource(R.string.zcash_info)) @@ -44,6 +49,6 @@ fun ZcashScreen( @Composable private fun ZcashScreenPreview() { MaterialTheme { - ZcashScreen({}) + ZcashScreen() } } \ No newline at end of file diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/releasenotes/ReleaseNotesScreen.kt b/app/src/main/kotlin/app/grapheneos/info/ui/releasenotes/ReleaseNotesScreen.kt index d896f92..30720fb 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/releasenotes/ReleaseNotesScreen.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/releasenotes/ReleaseNotesScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.VectorConverter import androidx.compose.animation.core.spring import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -34,9 +35,11 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @Composable fun ReleaseNotesScreen( + modifier: Modifier = Modifier, entries: List>, updateReleaseNotes: (useCaches: Boolean, finishedUpdating: () -> Unit) -> Unit, lazyListState: LazyListState, + additionalContentPadding: PaddingValues = PaddingValues(0.dp) ) { val lifecycleOwner = LocalLifecycleOwner.current @@ -96,13 +99,14 @@ fun ReleaseNotesScreen( } }, state = state, - modifier = Modifier + modifier = modifier .fillMaxSize() ) { ScreenLazyColumn( modifier = Modifier .fillMaxSize(), state = lazyListState, + additionalContentPadding = additionalContentPadding, verticalArrangement = Arrangement.Top ) { items( diff --git a/app/src/main/kotlin/app/grapheneos/info/ui/reusablecomposables/ScreenLazyColumn.kt b/app/src/main/kotlin/app/grapheneos/info/ui/reusablecomposables/ScreenLazyColumn.kt index b30b692..c919562 100644 --- a/app/src/main/kotlin/app/grapheneos/info/ui/reusablecomposables/ScreenLazyColumn.kt +++ b/app/src/main/kotlin/app/grapheneos/info/ui/reusablecomposables/ScreenLazyColumn.kt @@ -4,6 +4,8 @@ import androidx.compose.foundation.gestures.FlingBehavior import androidx.compose.foundation.gestures.ScrollableDefaults import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.calculateEndPadding +import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.LazyListState @@ -11,6 +13,8 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalLayoutDirection +import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp @Composable @@ -18,17 +22,28 @@ fun ScreenLazyColumn( modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(bottom = 16.dp, start = 16.dp, end = 16.dp), + additionalContentPadding: PaddingValues = PaddingValues(all = 0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = Arrangement.spacedBy(16.dp), horizontalAlignment: Alignment.Horizontal = Alignment.Start, flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), userScrollEnabled: Boolean = true, + layoutDirection: LayoutDirection = LocalLayoutDirection.current, content: LazyListScope.() -> Unit ) { LazyColumn( modifier = modifier, state = state, - contentPadding = contentPadding, + contentPadding = PaddingValues( + start = contentPadding.calculateStartPadding(layoutDirection) + + additionalContentPadding.calculateStartPadding(layoutDirection), + top = contentPadding.calculateTopPadding() + + additionalContentPadding.calculateTopPadding(), + end = contentPadding.calculateEndPadding(layoutDirection) + + additionalContentPadding.calculateEndPadding(layoutDirection), + bottom = contentPadding.calculateBottomPadding() + + additionalContentPadding.calculateBottomPadding() + ), reverseLayout = reverseLayout, verticalArrangement = verticalArrangement, horizontalAlignment = horizontalAlignment,