This is a Wrapper for this github Project.
You need to download the newest jar file from the Authors releasesection here.
Download the file valuebarlibrary-1-0-2.jar and put it into your Additional libs folder.
Additionally download the Libraryfiles from this Post and put them into the additional libs folder too.
ValueBar
Version: 1.01
Example code can look like this (assuming you have added the bars via Designer
This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate for my work to write the wrapper (You can donate any amount you want )
Please consider to donate to the Original Author of this Library, Philip Jahoda, too! See Donatebutton here.
I just wrote the Wrapper for this Library so it can be used in our beloved B4A
You need to download the newest jar file from the Authors releasesection here.
Download the file valuebarlibrary-1-0-2.jar and put it into your Additional libs folder.
Additionally download the Libraryfiles from this Post and put them into the additional libs folder too.
ValueBar
Version: 1.01
- ValueBar
Events:- onselectionupdate (val As Float, maxval As Float, minval As Float, Tag As Object)
- onvalueselected (val As Float, maxval As Float, minval As Float, Tag As Object)
- ba As BA
- AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- animate (from As Float, to As Float, animationDuration As Int)
Animates the bar from a specific value to a specific value. - animateDown (to As Float, durationMillis As Int)
Animates the bar down from it's current value to the specified value. - animateUp (to As Float, durationMillis As Int)
Animates the bar up from it's minimum value to the specified value. - getValueForPosition (xPos As Int) As Float
Returns the corresponding value for a pixel-position on the horizontal
axis. - isDrawMinMaxTextEnabled As Boolean
Returns true if drawing the minimum and maximum label is enabled. - isDrawValueTextEnabled As Boolean
Returns true if drawing the text that describes the actual value is
enabled. - setMinMax (min As Float, max As Float)
Sets the minimum and maximum value the bar can display.
- Background As Drawable
- BackgroundColor As Int [write only]
- BorderColor As Int [write only]
Sets the color of the border around the bar (if drawn). - BorderWidth As Float [write only]
Sets the width of the border around the bar (if drawn). - Color As Int [write only]
Sets the color the ValueBar should have. - ColorFormatter As Boolean [write only]
Sets a custom BarColorFormatter for the ValueBar. Implement the
BarColorFormatter interface in your own formatter class and return
whatever color you like from the getColor(...) method. You can for
example make the color depend on the current value of the bar. Provide
null to reset all changes. - DrawBorder As Boolean [write only]
Set this to true to enable drawing the border around the bar, or false to
disable it. - DrawMinMaxText As Boolean [write only]
Set this to true to enable drawing the minimum and maximum labels below
the bar. - DrawValueText As Boolean [write only]
Set this to true to enable drawing the actual value that is currently
displayed onto the bar. - Enabled As Boolean
- Height As Int
- Interval As Float [write only]
Sets the interval in which the values can be chosen and dispalyed from
on the ValueBar. If interval <= 0, there is no interval. - Left As Int
- Max As Float [read only]
Returns the maximum value the bar can display. - Min As Float [read only]
Returns the minimum value the bar can display. - MinMaxTextSize As Float [write only]
Sets the size of the min-max text in density pixels. - MinMaxTextTypeface As Typeface [write only]
Sets the Typeface of the min-max text. - OverlayColor As Int [write only]
Sets the color of the overlay that is placed below the value-text. - Tag As Object
- Textformat As String [write only]
- Top As Int
- Value As Float
Returns the currently displayed value. - ValueTextSize As Float [write only]
Sets the size of the value-text in density pixels. - ValueTextTypeface As Typeface [write only]
Sets the Typeface of the value-text. - Visible As Boolean
- Width As Int
Example code can look like this (assuming you have added the bars via Designer
B4X:
Sub Globals
Private vb1 As ValueBar
Private vb2 As ValueBar
Private vb3 As ValueBar
Private t1 As Timer
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
vb1.Textformat = "###,###,##0"
vb1.Color = Colors.Red
vb1.OverlayColor = Colors.Blue
vb1.BackgroundColor = Colors.LightGray
vb1.DrawBorder = True
vb1.Interval = 10
vb1.setMinMax(0,100)
vb1.animate(0,80,5000)
vb1.Tag = 1
vb2.Textformat = "###,###,##0.0"
vb2.Color = Colors.Red
vb2.OverlayColor = Colors.Green
vb2.BackgroundColor = Colors.LightGray
vb2.DrawBorder = True
vb2.Interval = 10
vb2.setMinMax(0,10)
vb2.animate(0,7.5,1000)
vb1.Tag = 2
vb3.Textformat = "###,###,##0.00"
vb3.OverlayColor = Colors.Yellow
vb3.BackgroundColor = Colors.DarkGray
vb3.DrawBorder = True
vb3.Interval = 10
vb3.setMinMax(0,100)
vb3.animate(0,69.95,1000)
vb3.Tag = 3
t1.Initialize("timer",2000)
t1.Enabled = True
End Sub
Sub timer_tick
If vb3.Value < (vb3.Max/2) Then
Dim rndNum As Int = Rnd(50, 101)
vb3.animateUp(rndNum,1000)
Else
Dim rndNum As Int = Rnd(0, 50)
vb3.animateDown(rndNum,1000)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub vb_onselectionupdate(val As Float, maxval As Float, minval As Float, tag As Object)
Log("vb_onselectionupdate(bar "&tag&","&val&","&maxval&","&minval&")")
End Sub
This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate for my work to write the wrapper (You can donate any amount you want )
Please consider to donate to the Original Author of this Library, Philip Jahoda, too! See Donatebutton here.
I just wrote the Wrapper for this Library so it can be used in our beloved B4A
Attachments
Last edited: