Fix insets for nav bar in send location view (#915)

Improvement of https://github.com/vector-im/element-x-android/pull/770

- https://github.com/vector-im/element-meta/issues/1682
This commit is contained in:
Marco Romano 2023-07-19 13:57:34 +02:00 committed by GitHub
parent 3c45a5ece4
commit 4c1a691b78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 28 additions and 22 deletions

View file

@ -20,9 +20,12 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.LocationOn
@ -113,6 +116,9 @@ fun SendLocationView(
}
}
// BottomSheetScaffold doesn't manage the system insets for sheetContent and the FAB, so we need to do it manually.
val navBarPadding = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
BottomSheetScaffold(
sheetContent = {
Spacer(modifier = Modifier.height(16.dp))
@ -150,7 +156,7 @@ fun SendLocationView(
Icon(Icons.Default.LocationOn, null)
},
)
Spacer(modifier = Modifier.height(28.dp))
Spacer(modifier = Modifier.height(16.dp + navBarPadding))
},
modifier = modifier,
scaffoldState = rememberBottomSheetScaffoldState(
@ -204,7 +210,7 @@ fun SendLocationView(
onClick = { state.eventSink(SendLocationEvents.SwitchToMyLocationMode) },
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(end = 16.dp, bottom = 72.dp),
.padding(end = 16.dp, bottom = 72.dp + navBarPadding),
) {
when (state.mode) {
SendLocationState.Mode.PinLocation -> Icon(imageVector = Icons.Default.LocationSearching, contentDescription = null)

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e45014ab4619ebeb90de5c69320b3ec4be51b6f1dbf8d6c8da9fec44ec0e8a2f
size 20840
oid sha256:69535debd585127a4ce8b490ef6682c2e6c3c4d16478e6b9e9687ee1c1133637
size 20879

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4c0a503af0cbcf66a71fd93fdba8cc710a5f6a3ad847bc5af36b68b2c2e7eef3
size 34482
oid sha256:356756de9f08042c3c2f3033d3f8a39cd9b49c5cfbcfbc274933c3efedd80d3d
size 34534

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b90f17d03c0200600356dc2f694c92703ad34dcf3721fcfb3e4f37fcfbb6e55
size 33552
oid sha256:51ac3c4bb27d78419f73b99cb24327514ce56a64a03bf74ce41f158c2c3bd516
size 33605

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e45014ab4619ebeb90de5c69320b3ec4be51b6f1dbf8d6c8da9fec44ec0e8a2f
size 20840
oid sha256:69535debd585127a4ce8b490ef6682c2e6c3c4d16478e6b9e9687ee1c1133637
size 20879

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:db911f98b01b92cff861787a2cdc2a01fa6d9fc0281a19075b2bf2ebc9f8f109
size 20971
oid sha256:1fa3b5aae9cee5e2fec8929697b0606b655c45b10a65bcd641da315e98c48e1e
size 20951

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90000e70e71b582c32f1699c1a968725e7b6a281af4b5b2e3e64eed33d5f7916
size 19358
oid sha256:ce74fa2b0364763152e69dcfa4f8d598504b630fa1227f2fa685bc886ccd5afa
size 19434

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:890f5dfb312fdbc3f942b7e719e2e1f12759d1348917b80d57b500332eb0bf4c
size 32109
oid sha256:12a78fbc2d2e84e93d40d1e075d8b46c5366f3d323dd85f27be286a64231f884
size 32120

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:718b3c631a73d60950f1c945e8c0c31891eb9734223a8aecbcd7407baaa3bd5f
size 31290
oid sha256:a1bd4187a3713153d6e9ed94594385c3806f59c4d36cc6f2867a38d630551505
size 31302

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90000e70e71b582c32f1699c1a968725e7b6a281af4b5b2e3e64eed33d5f7916
size 19358
oid sha256:ce74fa2b0364763152e69dcfa4f8d598504b630fa1227f2fa685bc886ccd5afa
size 19434

View file

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7cc4fb19532e0c88107f0adabfef4859d4ab190ace800523490a81687ca674e
size 19435
oid sha256:9390a3b8111ab0d31b3bbf3b6bf8794432d135130b37404ce4a646a74369d85b
size 19502