BubbleShowCase-Android
BubbleShowCase-Android copied to clipboard
Wrong position in notch screens
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.
Facing the same issue the bubble pop up is not showing correctly on some devices Does anyone knows a workaround i can implement
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
}
}