Skip to content

Fixed paddings on horizontal mode #1353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
4 changes: 0 additions & 4 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.json.JSONObject
import java.text.Collator
import java.time.LocalDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.util.LinkedList
import java.util.Locale
import java.util.Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
Expand Down Expand Up @@ -82,7 +81,6 @@ abstract class AccountsDrawerHandler {
Column(modifier = Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState())
.navigationBarsPadding()
) {
BrandingHeader()

Expand Down
5 changes: 1 addition & 4 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/AccountsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -170,9 +169,7 @@ fun AccountsScreen(
ModalNavigationDrawer(
drawerState = drawerState,
drawerContent = {
ModalDrawerSheet(
windowInsets = WindowInsets(0.dp)
) {
ModalDrawerSheet {
accountsDrawerHandler.AccountsDrawer(
snackbarHostState = snackbarHostState,
onCloseDrawer = {
Expand Down
19 changes: 15 additions & 4 deletions app/src/main/kotlin/at/bitfire/davdroid/ui/AppTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
package at.bitfire.davdroid.ui

import androidx.activity.SystemBarStyle
import androidx.activity.compose.LocalActivity
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
Expand All @@ -22,13 +28,14 @@ import at.bitfire.davdroid.ui.composable.SafeAndroidUriHandler
@Composable
fun AppTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
windowInsets: WindowInsets = WindowInsets.safeDrawing,
content: @Composable () -> Unit
) {
val view = LocalView.current
val activity = LocalActivity.current
SideEffect {
// If applicable, call Activity.enableEdgeToEdge to enable edge-to-edge layout on Android <15, too.
// When we have moved everything into one Activity with Compose navigation, we can call it there instead.
(view.context as? AppCompatActivity)?.enableEdgeToEdge(
(activity as? AppCompatActivity)?.enableEdgeToEdge(
navigationBarStyle = SystemBarStyle.auto(
lightScrim = M3ColorScheme.lightScheme.scrim.toArgb(),
darkScrim = M3ColorScheme.darkScheme.scrim.toArgb()
Expand All @@ -44,11 +51,15 @@ fun AppTheme(
M3ColorScheme.lightScheme
else
M3ColorScheme.darkScheme,
content = content
)
) {
Box(Modifier.windowInsetsPadding(windowInsets)) {
content()
}
}
}

// Track if the app is in the foreground
val view = LocalView.current
LifecycleResumeEffect(view) {
ForegroundTracker.onResume()
onPauseOrDispose {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ fun IntroScreen(
}
}
},
contentWindowInsets = WindowInsets(0.dp)
contentWindowInsets = WindowInsets(0)
) { paddingValues ->
Column(modifier = Modifier
.fillMaxSize()
Expand Down