Public Sub RippleEffect (Parent As B4XView, Color As Int, Duration As Int)
Dim cvs As B4XCanvas
Dim p As B4XView = xui.CreatePanel("")
Dim InnerRadius As Int = Max(Parent.Width, Parent.Height) * 1.20
p.SetLayoutAnimated(0, 0, 0, InnerRadius, InnerRadius)
cvs.Initialize(p)
cvs.DrawCircle(cvs.TargetRect.CenterX, cvs.TargetRect.CenterY, cvs.TargetRect.Width / 2, Color, True, 0)
cvs.Invalidate
cvs.Release
Dim bmp As B4XBitmap = cvs.CreateBitmap
p.RemoveViewFromParent
Dim iv As ImageView
iv.Initialize("")
Dim p As B4XView = iv
Dim Radius As Int = InnerRadius/2
Dim x As Int = Parent.Width/2
Dim y As Int = Parent.Height/2
p.SetBitmap(bmp)
Parent.AddView(p, x, y, 0, 0)
p.SetLayoutAnimated(Duration , x - Radius, y - Radius, Radius * 2, Radius * 2)
p.SetVisibleAnimated(Duration , False)
Sleep(Duration )
p.RemoveViewFromParent
End Sub