Skip to content

Commit ceadb07

Browse files
committed
Bug 1977670 - Part 1 - Remove window insets padding from TopAppBar Composables r=android-reviewers,matt-tighe
There seems to be some weirdness with the M3 TopAppBar and Edge to Edge, causing the TopAppBar to have increased margins. I was not able to reproduce this visual bug on older Android OS versions though, which would make sense, if this were due to Edge to Edge. Default window inset values: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/material/material/src/commonMain/kotlin/androidx/compose/material/AppBar.kt;l=441 Affected screens: - Logins (fixed in Bug 1975375) - Bookmarks - Downloads - Debug Drawer - Web Compat Reporter - Glean Debug Tools Part 2 will handle the recoloring of the app bar when the content has scrolled Differential Revision: https://phabricator.services.mozilla.com/D257596
1 parent 006285e commit ceadb07

File tree

5 files changed

+42
-0
lines changed

5 files changed

+42
-0
lines changed

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/gleandebugtools/GleanDebugToolsFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package org.mozilla.fenix.debugsettings.gleandebugtools
66

77
import android.content.Intent
88
import android.widget.Toast
9+
import androidx.compose.foundation.layout.WindowInsets
910
import androidx.compose.foundation.layout.padding
1011
import androidx.compose.material3.ExperimentalMaterial3Api
1112
import androidx.compose.material3.Icon
@@ -18,6 +19,7 @@ import androidx.compose.runtime.Composable
1819
import androidx.compose.ui.Modifier
1920
import androidx.compose.ui.res.painterResource
2021
import androidx.compose.ui.res.stringResource
22+
import androidx.compose.ui.unit.dp
2123
import androidx.core.net.toUri
2224
import androidx.navigation.fragment.findNavController
2325
import mozilla.telemetry.glean.Glean
@@ -90,6 +92,10 @@ class GleanDebugToolsFragment : ComposeFragment() {
9092
)
9193
}
9294
},
95+
windowInsets = WindowInsets(
96+
top = 0.dp,
97+
bottom = 0.dp,
98+
),
9399
colors = TopAppBarDefaults.topAppBarColors(containerColor = FirefoxTheme.colors.layer1),
94100
)
95101
},

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/ui/DebugDrawer.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package org.mozilla.fenix.debugsettings.ui
66

77
import androidx.compose.foundation.background
88
import androidx.compose.foundation.layout.Box
9+
import androidx.compose.foundation.layout.WindowInsets
910
import androidx.compose.foundation.layout.fillMaxSize
1011
import androidx.compose.foundation.layout.padding
1112
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -79,6 +80,10 @@ fun DebugDrawer(
7980
}
8081
}
8182
},
83+
windowInsets = WindowInsets(
84+
top = 0.dp,
85+
bottom = 0.dp,
86+
),
8287
colors = TopAppBarDefaults.topAppBarColors(containerColor = FirefoxTheme.colors.layer1),
8388
)
8489
},

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/downloads/listscreen/DownloadsTopAppBar.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package org.mozilla.fenix.downloads.listscreen
66

7+
import androidx.compose.foundation.layout.WindowInsets
78
import androidx.compose.material3.ExperimentalMaterial3Api
89
import androidx.compose.material3.Icon
910
import androidx.compose.material3.IconButton
@@ -15,6 +16,7 @@ import androidx.compose.ui.Modifier
1516
import androidx.compose.ui.graphics.Color
1617
import androidx.compose.ui.res.painterResource
1718
import androidx.compose.ui.res.stringResource
19+
import androidx.compose.ui.unit.dp
1820
import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview
1921
import org.mozilla.fenix.R
2022
import org.mozilla.fenix.theme.FirefoxTheme
@@ -47,6 +49,10 @@ internal fun DownloadsTopAppBar(
4749
actions = {
4850
actions()
4951
},
52+
windowInsets = WindowInsets(
53+
top = 0.dp,
54+
bottom = 0.dp,
55+
),
5056
colors = TopAppBarDefaults.topAppBarColors(containerColor = backgroundColor),
5157
)
5258
}

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/library/bookmarks/ui/BookmarksScreen.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ private fun BookmarksListTopBar(
705705
}
706706
}
707707
},
708+
windowInsets = WindowInsets(
709+
top = 0.dp,
710+
bottom = 0.dp,
711+
),
708712
)
709713
}
710714
}
@@ -901,6 +905,10 @@ private fun SelectFolderTopBar(
901905
}
902906
}
903907
},
908+
windowInsets = WindowInsets(
909+
top = 0.dp,
910+
bottom = 0.dp,
911+
),
904912
)
905913
}
906914

@@ -1243,6 +1251,10 @@ private fun EditFolderTopBar(
12431251
)
12441252
}
12451253
},
1254+
windowInsets = WindowInsets(
1255+
top = 0.dp,
1256+
bottom = 0.dp,
1257+
),
12461258
)
12471259
}
12481260

@@ -1322,6 +1334,10 @@ private fun AddFolderTopBar(onBackClick: () -> Unit) {
13221334
)
13231335
}
13241336
},
1337+
windowInsets = WindowInsets(
1338+
top = 0.dp,
1339+
bottom = 0.dp,
1340+
),
13251341
)
13261342
}
13271343

@@ -1510,6 +1526,10 @@ private fun EditBookmarkTopBar(
15101526
)
15111527
}
15121528
},
1529+
windowInsets = WindowInsets(
1530+
top = 0.dp,
1531+
bottom = 0.dp,
1532+
),
15131533
)
15141534
}
15151535

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/webcompat/ui/WebCompatReporter.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.Arrangement
1010
import androidx.compose.foundation.layout.Column
1111
import androidx.compose.foundation.layout.Row
1212
import androidx.compose.foundation.layout.Spacer
13+
import androidx.compose.foundation.layout.WindowInsets
1314
import androidx.compose.foundation.layout.fillMaxWidth
1415
import androidx.compose.foundation.layout.height
1516
import androidx.compose.foundation.layout.imePadding
@@ -279,6 +280,10 @@ private fun TempAppBar(
279280
)
280281
}
281282
},
283+
windowInsets = WindowInsets(
284+
top = 0.dp,
285+
bottom = 0.dp,
286+
),
282287
)
283288
}
284289

0 commit comments

Comments
 (0)