BubbleShowCase-Android icon indicating copy to clipboard operation
BubbleShowCase-Android copied to clipboard

Wrong position in notch screens

Open ilyasdirin opened this issue 5 years ago • 2 comments

The library bubbles are wrong positioned in notch screens. It adds the notch height to bubble position y value so the bubble is shown on the item.

ilyasdirin avatar Apr 24 '19 08:04 ilyasdirin

Facing the same issue the bubble pop up is not showing correctly on some devices Does anyone knows a workaround i can implement

n3ini3a avatar Sep 22 '20 11:09 n3ini3a

maybe this could help. I added this in BubbleMessageView class, so it added the height of the notch to the bottom margin of the BubbleShowCase canvas

override fun onAttachedToWindow() {
    super.onAttachedToWindow()

    val notchHeight = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
        rootWindowInsets?.displayCutout?.safeInsetTop ?: 0
    else 0

    if (arrowPosition == BubbleShowCase.ArrowPosition.BOTTOM) {
        val currentLayoutParam = (layoutParams as? RelativeLayout.LayoutParams)?.apply {
            setMargins(
                leftMargin,
                topMargin,
                rightMargin,
                bottomMargin + notchHeight
            )
        }
        layoutParams = currentLayoutParam
    }
}

widiarifki avatar Oct 02 '21 09:10 widiarifki