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

Unwanted Bottom Margin on Oneplus Devices #30

Open
ShivamArora opened this issue Dec 18, 2018 · 5 comments
Open

Unwanted Bottom Margin on Oneplus Devices #30

ShivamArora opened this issue Dec 18, 2018 · 5 comments

Comments

@ShivamArora
Copy link

ShivamArora commented Dec 18, 2018

There's an unwanted bottom margin added to the flashbar on Oneplus Devices.

I tested it out on emulator running on Pie and it works fine.

But on Oneplus 6 running on Pie it adds an unwanted bottom margin as you can see in this picture.

Screenshot of Unwanted Bottom Margin to Flashbar

@sjwelling
Copy link

I'm seeing the same problem on a Samsung Galaxy S10 using Flashbar 1.0.3.

image

@charlest05
Copy link

charlest05 commented Oct 10, 2019

encountered same issue using Huawei Nova 3i, fixed by removing lines 126-133 on this class FlashbarContainerView, hi @aritraroy please update the Repository :)

@javadVatan
Copy link

I have the same issue.
@charlest05 Hi dear, I have to clone and use that as module in the project ?

@lastpeony
Copy link

Same error

@ykm17
Copy link

ykm17 commented Jun 11, 2020

I got the Fix.
I had faced this issue on many MI devices. In internal fun adjustOrientation(activity: Activity) inside FlashbarContainerView.kt , I logged the navigationBarSize. Snackbar adds the bottom margin equal to the height of the navigation bar so that it doesn't overlap on the navigation bar. But activity.getNavigationBarSizeInPx() returns wrong size in many devices. Resulting in gap at the bottom or extra margin between the snack bar and navigation bar.
In function, I have changed the way how it retrieves navigation bar size and now it works fine. :)

internal fun adjustOrientation(activity: Activity) {
        val flashbarContainerViewLp = RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)

        var resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")

        val navigationBarPosition = activity.getNavigationBarPosition()
        var navigationBarSize = 0

        if (resourceId > 0) {
            navigationBarSize = resources.getDimensionPixelSize(resourceId);
        }

        when (navigationBarPosition) {
            LEFT -> flashbarContainerViewLp.leftMargin = navigationBarSize
            RIGHT -> flashbarContainerViewLp.rightMargin = navigationBarSize
            BOTTOM -> flashbarContainerViewLp.bottomMargin = navigationBarSize
        }
        layoutParams = flashbarContainerViewLp
    }

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

No branches or pull requests

6 participants