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

Home New Post Icon Wrong Position on OnePlus Ace3 #115

Closed
galiren opened this issue Jul 31, 2024 · 1 comment · Fixed by #116
Closed

Home New Post Icon Wrong Position on OnePlus Ace3 #115

galiren opened this issue Jul 31, 2024 · 1 comment · Fixed by #116

Comments

@galiren
Copy link

galiren commented Jul 31, 2024

I am debugging Mastify on my physical device OnePlus Ace 3 and found the New Post Icon was partially hiden by BottomBar like below:

This is not observed on Android Studio virtual device (Pixel 8 Pro).

Although increasing image vertical padding may lift the image a litte bit and "fix" this situation, but I am seeking more hleps to find if we can get a better solution comforming all devices.

Thank you in advance for any possible suggestions and investigations.

@whitescent
Copy link
Owner

#116 This PR should fix the issue. You can try running it again with the latest main branch to see if the problem persists.

In fact, there are many places in Mastify's current code that are poorly written :((. I'm trying to rewrite it using a multi-module structure.

As for the solution to this issue, the innerPadding provided by Scaffold can actually resolve it, as it measures the height of the BottomBar @composable. Therefore, you just need to add padding(bottom = innerPadding.calculateBottomPadding()) to the Home Screen. But I don't know why i forgot to use it before.

Scaffold.kt

val bodyContentPlaceables = subcompose(ScaffoldLayoutContent.MainContent) {
    val insets = contentWindowInsets.asPaddingValues(this@SubcomposeLayout)
    val innerPadding = PaddingValues(
        top =
        if (topBarPlaceables.isEmpty()) {
            insets.calculateTopPadding()
        } else {
            topBarHeight.toDp()
        },
        bottom =
        if (bottomBarPlaceables.isEmpty() || bottomBarHeight == null) {
            insets.calculateBottomPadding()
        } else {
            bottomBarHeight.toDp()
        },
        start = insets.calculateStartPadding((this@SubcomposeLayout).layoutDirection),
        end = insets.calculateEndPadding((this@SubcomposeLayout).layoutDirection)
    )
    content(innerPadding)
}.fastMap { it.measure(looseConstraints) }

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

Successfully merging a pull request may close this issue.

2 participants