Skip to content
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

Fix window insets to avoid overlapping display cutouts and system bars #1006

Conversation

norihirosunada
Copy link
Contributor

Issue

Overview (Required)

  • fixed the whole screen horizontal padding to edge-to-edge
  • applied window insets to avoid overlapping display cutouts and system bars for each screens

Screenshot (Optional if screenshot test is present or unrelated to UI)

Before (90° Clockwise) After (90° Clockwise)
Before (90° Counter Clockwise) After (90° Counter Clockwise)

@github-actions github-actions bot temporarily deployed to deploygate-distribution September 8, 2024 08:29 Inactive
Copy link

github-actions bot commented Sep 8, 2024

@github-actions github-actions bot temporarily deployed to deploygate-distribution September 8, 2024 09:04 Inactive
.asPaddingValues()
.calculateEndPadding(layoutDirection),
),
modifier = Modifier.fillMaxSize(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -131,6 +133,11 @@ fun EventMapScreen(
AnimatedTextTopAppBar(
title = stringResource(EventMapRes.string.eventmap),
scrollBehavior = scrollBehavior,
windowInsets = WindowInsets(
left = contentPadding.calculateLeftPadding(layoutDirection),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the amazing PR! I'll merge it regardless. However, could you explain why the window insets of each screen's AnimatedTextTopAppBar are different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahirom
I gave this window insets to avoid display cutouts and system bars, since default value TopAppBarDefaults.windowInsets only avoids system bars.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explain. How about making a function like this? And can you resolve the conflict with the main branch?

windowInsets = AnimatedTextTopAppBarDefaults.windowInsets(contentPadding),
object AnimatedTextTopAppBarDefaults {
    @Composable
    fun windowInsets(contentPadding: PaddingValues): WindowInsets {
        val layoutDirection = LocalLayoutDirection.current
        return WindowInsets(
            left = contentPadding.calculateLeftPadding(layoutDirection),
            top = contentPadding.calculateTopPadding(),
            right = contentPadding.calculateRightPadding(layoutDirection),
        )
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes of course!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahirom
I realized I didn't need to use content padding for window insets of top app bars.
I'll make default windowInsets like below for each top app bars instead.

object HogeTopAppBarDefaults {
    val windowInsets = WindowInsets.displayCutout.union(WindowInsets.systemBars).only(
        WindowInsetsSides.Horizontal + WindowInsetsSides.Top,
    )
}

…_screen_padding

# Conflicts:
#	feature/contributors/src/commonMain/kotlin/io/github/droidkaigi/confsched/contributors/ContributorsScreen.kt
#	feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt
#	feature/sponsors/src/commonMain/kotlin/io/github/droidkaigi/confsched/sponsors/SponsorsScreen.kt
#	feature/staff/src/commonMain/kotlin/io/github/droidkaigi/confsched/staff/StaffScreen.kt
Copy link

Detekt check failed. Please run ./gradlew detekt --auto-correct to fix the issues.

@github-actions github-actions bot temporarily deployed to deploygate-distribution September 10, 2024 16:05 Inactive
@github-actions github-actions bot temporarily deployed to deploygate-distribution September 10, 2024 23:59 Inactive
@takahirom
Copy link
Member

@norihirosunada Sorry for keeping you disturbed, but could you resolve the conflict? 🙇

…_screen_padding

# Conflicts:
#	feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt
@github-actions github-actions bot temporarily deployed to deploygate-distribution September 11, 2024 05:23 Inactive
@norihirosunada
Copy link
Contributor Author

@takahirom
Conflict resolved 👍

@takahirom
Copy link
Member

takahirom commented Sep 11, 2024

Let's merge! (Sorry, I've just released. I'm not sure if I can release this by time)

@takahirom takahirom merged commit c3466dc into DroidKaigi:main Sep 11, 2024
6 checks passed
@takahirom
Copy link
Member

Anyway Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants