Skip to content

Commit 400318b

Browse files
ArnyminerZrfc2822
andauthored
Fixed paddings on horizontal mode (#1353)
* Fixed paddings Signed-off-by: Arnau Mora <[email protected]> * Added padding to all screens Signed-off-by: Arnau Mora <[email protected]> * Fixed edge to edge on accounts screen Signed-off-by: Arnau Mora <[email protected]> * Fixed e2e issues Signed-off-by: Arnau Mora <[email protected]> * Undo edge-to-edge Signed-off-by: Arnau Mora <[email protected]> * Rollback Signed-off-by: Arnau Mora <[email protected]> * Fixed paddings Signed-off-by: Arnau Mora <[email protected]> * Fixed padding consumption Signed-off-by: Arnau Mora <[email protected]> * Got rid of ime padding Signed-off-by: Arnau Mora <[email protected]> * Fixed issues with paddings Signed-off-by: Arnau Mora <[email protected]> * Fix UI elements partially obscured in landscape mode --------- Signed-off-by: Arnau Mora <[email protected]> Co-authored-by: Ricki Hirner <[email protected]>
1 parent 0d2e5a1 commit 400318b

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

app/src/main/kotlin/at/bitfire/davdroid/ui/AboutActivity.kt

-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ import kotlinx.coroutines.Dispatchers
6868
import kotlinx.coroutines.launch
6969
import org.json.JSONObject
7070
import java.text.Collator
71-
import java.time.LocalDateTime
72-
import java.time.ZoneOffset
73-
import java.time.format.DateTimeFormatter
74-
import java.time.format.FormatStyle
7571
import java.util.LinkedList
7672
import java.util.Locale
7773
import java.util.Optional

app/src/main/kotlin/at/bitfire/davdroid/ui/AccountsDrawerHandler.kt

-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Column
1414
import androidx.compose.foundation.layout.Spacer
1515
import androidx.compose.foundation.layout.fillMaxWidth
1616
import androidx.compose.foundation.layout.height
17-
import androidx.compose.foundation.layout.navigationBarsPadding
1817
import androidx.compose.foundation.layout.padding
1918
import androidx.compose.foundation.layout.size
2019
import androidx.compose.foundation.layout.statusBarsPadding
@@ -82,7 +81,6 @@ abstract class AccountsDrawerHandler {
8281
Column(modifier = Modifier
8382
.fillMaxWidth()
8483
.verticalScroll(rememberScrollState())
85-
.navigationBarsPadding()
8684
) {
8785
BrandingHeader()
8886

app/src/main/kotlin/at/bitfire/davdroid/ui/AccountsScreen.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import androidx.compose.foundation.Image
1515
import androidx.compose.foundation.clickable
1616
import androidx.compose.foundation.layout.Box
1717
import androidx.compose.foundation.layout.Column
18-
import androidx.compose.foundation.layout.WindowInsets
1918
import androidx.compose.foundation.layout.fillMaxSize
2019
import androidx.compose.foundation.layout.fillMaxWidth
2120
import androidx.compose.foundation.layout.padding
@@ -170,9 +169,7 @@ fun AccountsScreen(
170169
ModalNavigationDrawer(
171170
drawerState = drawerState,
172171
drawerContent = {
173-
ModalDrawerSheet(
174-
windowInsets = WindowInsets(0.dp)
175-
) {
172+
ModalDrawerSheet {
176173
accountsDrawerHandler.AccountsDrawer(
177174
snackbarHostState = snackbarHostState,
178175
onCloseDrawer = {

app/src/main/kotlin/at/bitfire/davdroid/ui/AppTheme.kt

+15-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55
package at.bitfire.davdroid.ui
66

77
import androidx.activity.SystemBarStyle
8+
import androidx.activity.compose.LocalActivity
89
import androidx.activity.enableEdgeToEdge
910
import androidx.appcompat.app.AppCompatActivity
1011
import androidx.compose.foundation.isSystemInDarkTheme
12+
import androidx.compose.foundation.layout.Box
13+
import androidx.compose.foundation.layout.WindowInsets
14+
import androidx.compose.foundation.layout.safeDrawing
15+
import androidx.compose.foundation.layout.windowInsetsPadding
1116
import androidx.compose.material3.MaterialTheme
1217
import androidx.compose.runtime.Composable
1318
import androidx.compose.runtime.CompositionLocalProvider
1419
import androidx.compose.runtime.SideEffect
20+
import androidx.compose.ui.Modifier
1521
import androidx.compose.ui.graphics.toArgb
1622
import androidx.compose.ui.platform.LocalContext
1723
import androidx.compose.ui.platform.LocalUriHandler
@@ -22,13 +28,14 @@ import at.bitfire.davdroid.ui.composable.SafeAndroidUriHandler
2228
@Composable
2329
fun AppTheme(
2430
darkTheme: Boolean = isSystemInDarkTheme(),
31+
windowInsets: WindowInsets = WindowInsets.safeDrawing,
2532
content: @Composable () -> Unit
2633
) {
27-
val view = LocalView.current
34+
val activity = LocalActivity.current
2835
SideEffect {
2936
// If applicable, call Activity.enableEdgeToEdge to enable edge-to-edge layout on Android <15, too.
3037
// When we have moved everything into one Activity with Compose navigation, we can call it there instead.
31-
(view.context as? AppCompatActivity)?.enableEdgeToEdge(
38+
(activity as? AppCompatActivity)?.enableEdgeToEdge(
3239
navigationBarStyle = SystemBarStyle.auto(
3340
lightScrim = M3ColorScheme.lightScheme.scrim.toArgb(),
3441
darkScrim = M3ColorScheme.darkScheme.scrim.toArgb()
@@ -44,11 +51,15 @@ fun AppTheme(
4451
M3ColorScheme.lightScheme
4552
else
4653
M3ColorScheme.darkScheme,
47-
content = content
48-
)
54+
) {
55+
Box(Modifier.windowInsetsPadding(windowInsets)) {
56+
content()
57+
}
58+
}
4959
}
5060

5161
// Track if the app is in the foreground
62+
val view = LocalView.current
5263
LifecycleResumeEffect(view) {
5364
ForegroundTracker.onResume()
5465
onPauseOrDispose {

app/src/main/kotlin/at/bitfire/davdroid/ui/intro/IntroScreen.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fun IntroScreen(
109109
}
110110
}
111111
},
112-
contentWindowInsets = WindowInsets(0.dp)
112+
contentWindowInsets = WindowInsets(0)
113113
) { paddingValues ->
114114
Column(modifier = Modifier
115115
.fillMaxSize()

0 commit comments

Comments
 (0)