Hi everyone, I am working on a B4X custom view, this is the second time I ever try to do this, I have taken several pieces of code from various places, the over all goal is to get something like this library that can be used for both B4A and B4i, so far I have everything working fine but only for B4A, that's why I need you guy's expert help to convert the following code to B4X code.
The result from this code is the following image below:
The small bubble on top of the slider indicator gets created with the above code, I took some parts from this library created by @Star-Dust and some other parts from @klaus Xlimitbar demo here, thanks to both of these guys for their work, it definitely helped me to accomplish this, however I still need help to convert the above code to B4X so that I can get this working for B4i.
I am including the project for anyone to contribute if anyone else feels like adding their 2 cents, essentially what I would like is to convert this entire code so that it can be used on B4A and B4i and B4J if needed as well, as you guys can see most of it is pretty much done except for the part that is entirely just for Android which uses the JavaObject library, I know there's a B4XPath and B4XCanvas libraries but I can't figure out how to do the arcTo, or quadTo functions using the B4XPath.
Any ideas how to?
Thanks in advance everyone.
Walter
Bubble Generation:
private Sub MyCorner(Color As Int, Radius As Int) As Bitmap
Dim B As Bitmap
Dim R As Int = 80dip+20dip/2''mBase.Height/2
Dim Gr As Int = 80dip + 20dip'' mBase.Height
Dim Rect1 As Rect
Dim mpath As Path
Dim RectF As JavaObject
RectF = RectF.InitializeNewInstance("android.graphics.RectF", Null)
B.InitializeMutable(Gr,Gr)
Rect1.Initialize(R/4, R, Gr-(R/4), Gr)
C.Initialize(Ball)
Dim x0 As Float = C.TargetView.GetBitmap.Width/2.0
Dim y0 As Float = C.TargetView.GetBitmap.Height - Radius / 3.0
mpath.Initialize(x0, y0)
Dim jo As JavaObject
jo = mpath
jo.RunMethod("moveTo", Array As Object(x0, y0))
Dim x1 As Float = C.TargetView.GetBitmap.Width / 2.0 - Sqrt(3) / 2.0 * Radius
Dim y1 As Float = 3 / 2 * Radius
jo.RunMethod("quadTo", Array As Object((x1 - 2*Density), (y1 - 2*Density), x1, y1))
Dim f1, f2, f3, f4 As Float
f1 = C.TargetView.GetBitmap.Width / 2.0 - Radius
f2 = 0
f3 = C.TargetView.GetBitmap.Width / 2.0 + Radius
f4 = 2.0 * Radius
RectF.RunMethod("set", Array As Object(f1, f2, f3, f4))
rect.Initialize(f1 + 8dip, 10dip, C.TargetView.GetBitmap.Width - 20dip, 35dip)
Dim f5, f6 As Float
f5 = 150
f6 = 240
jo.RunMethod("arcTo", Array As Object(RectF, f5, f6))
jo.RunMethod("close", Null)
C.DrawPath(mpath, Color, True, 1)
C.DrawRect(rect, Colors.RGB(164, 212, 232), True, 20dip)
Return C.TargetView.GetBitmap
End Sub
The result from this code is the following image below:
The small bubble on top of the slider indicator gets created with the above code, I took some parts from this library created by @Star-Dust and some other parts from @klaus Xlimitbar demo here, thanks to both of these guys for their work, it definitely helped me to accomplish this, however I still need help to convert the above code to B4X so that I can get this working for B4i.
I am including the project for anyone to contribute if anyone else feels like adding their 2 cents, essentially what I would like is to convert this entire code so that it can be used on B4A and B4i and B4J if needed as well, as you guys can see most of it is pretty much done except for the part that is entirely just for Android which uses the JavaObject library, I know there's a B4XPath and B4XCanvas libraries but I can't figure out how to do the arcTo, or quadTo functions using the B4XPath.
Any ideas how to?
Thanks in advance everyone.
Walter
Attachments
Last edited: