TorryDo / Floating-Bubble-View

🍀an Android library that adds floating views on top of your screen🎨, supports both XML and Jetpack Compose
Apache License 2.0
204 stars 34 forks source link

Feature set animation before expand show #58

Open MohammadEhsanMohit opened 10 months ago

MohammadEhsanMohit commented 10 months ago

Hi,

In our case, we require the bubble view to move to a specific location before the expand view is shown. I have added some properties that users can set, and when the expand() function is called, the bubble view animates to the specified location before showing the expand view.

Set isAnimatedBeforeExpand to true: when the expand() method is called, the bubble view animates to the expandViewInitialPoint.

internal var isAnimatedBeforeExpand : Boolean = false internal var expandViewInitialPoint : Point = Point(0,0)

Also, I have added a new nullable lambda to the animateTo() function to be called when the animation is finished.

fun animateTo( x: Float, y: Float, stiffness: Float = SpringForce.STIFFNESS_MEDIUM, onEnd: (() -> Unit)? = null )

Best regards. /assign_reviewer @TorryDo