B4A Library Holo ColorPicker V1.0.4

Similar threads

B4A Library IPCamView
B4A Library msEmoji V1.0.0
B4A Library CreditsRollView V1.0.0
B4A Library PDFium - Pdfview2
B4A Library VRCalendarView

DonManfred

Expert
Licensed User
HoloColorPicker
Version:
1.04

This is a wrapper for this Github-project.



  • ColorPicker
    Events:
    • oncolorchanged (color As Int)
    • oncolorselected (color As Int)
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • IsInitialized As Boolean
    • addOpacityBar (ob As OpacityBar)
      Add a OpacityBar to the ColorPicker
    • addSVBar (sv As SVBar)
      Add a SVBar to the ColorPicker
    • addSaturationBar (sb As SaturationBar)
      Add a SaturationBar to the ColorPicker
    • addValueBar (vb As ValueBar)
      Add a ValueBar to the ColorPicker
    Properties:
    • Color As Int [read only]
      Get the selected Color
    • Left As Int
    • NewCenterColor As Int [write only]
      Set a new CenterColor
    • ShowOldCenterColor As Boolean [write only]
      Show the old center color when set to true
    • Top As Int
  • OpacityBar
    Fields:
    • ba As BA
    Methods:
    • 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)
      Initialize the OpacityBar
    • 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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
  • SVBar
    Fields:
    • ba As BA
    Methods:
    • 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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
  • SaturationBar
    Fields:
    • ba As BA
    Methods:
    • 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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
  • ValueBar
    Fields:
    • ba As BA
    Methods:
    • 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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int

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 (You can donate any amount you want to donate for the library (or my work) :)
 

Attachments

Last edited:

Peter Simpson

Expert
Licensed User
Very nice indeed @DonManfred,
I've played about with your library and I've managed to create this little working example. I've just added a few labels and a couple of panels and hey presto, I hope that users like it. Anyway I've attached the source to this post, hopefully B4A developers will find this library useful :)

Resources folder has now been added to Color Picker.zip file
Screenshot_2015-03-13-23-03-12.jpg


Please note:
Some of the code in my example (like the labels) are not actually necessary, they are just there for because, because, because hmm :p

Enjoy...
 

Attachments

Last edited:

tmf

Member
Licensed User
I have been playing with this lib for hours and can not get past the compiling when i do

dim cp as colorpicker
cp.initialize("")

I get android.content.res.Resources$NotFoundException: Resource ID #0x0 when it executes

Anyone?? :)
 

tmf

Member
Licensed User
Thanks man! (or lady)

I was missing #AdditionalRes: ..\Resources and the actual \Resources directory, its not in the first ZIP I downloaded....
 

DonManfred

Expert
Licensed User
Thanks man! (or lady)
>Regards Manfred

I dont know any Lady with name Manfred ;-)

I was missing #AdditionalRes: ..\Resources and the actual \Resources directory, its not in the first ZIP I downloaded....
I saw that Peter has forgotten to add the Resources for this Project to his Example.
That´s the reason i uploaded my original Example. But it is not as nice to view like Peters Example :)
 

tmf

Member
Licensed User
I can see this picker going in many directions, would be nice to be nice halo, just a full circle.... at least for me, and it would be nice to pass the old color to the picker and have it position to that.... :) so far so good!
 

tmf

Member
Licensed User
I will wait :) need.... also everytime the colorpicker is shown the old last color position on halo is shown, can not get it to start fresh.....

R.
 

DonManfred

Expert
Licensed User
I will wait :) need
I have updated Post #1 and added download for v1.0.4
also everytime the colorpicker is shown the old last color position on halo is shown, can not get it to start fresh
i´m not sure if i understand correctly. Can you plese describe more detailed?
 

tmf

Member
Licensed User
cool!

I was going cp.initialize("cp") multiple times and it was basically leaving the last position of the "knob" so each time the colorpicker become visible it had more and more knobs, which only one moved :)
 

tmf

Member
Licensed User
Question:

You have a function the gets the ARGB, it seems to be working with colors.argb() where do you need to break them out into the array?

Richard.
 

DonManfred

Expert
Licensed User
where do you need to break them out into the array?
If you need the ARGB values instead of just a color int then you can use this sub to get the ARGB values from the int value
B4X:
Sub GetARGB(Color As Int) As Int()
    Dim res(4) As Int
    res(0) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff000000), 24)
    res(1) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff0000), 16)
    res(2) = Bit.UnsignedShiftRight(Bit.And(Color, 0xff00), 8)
    res(3) = Bit.And(Color, 0xff)
    Return res
End Sub
 

KnipsFips

New Member
Licensed User
Hello Manfred,

this really looks neat, thanks for this wrapper!
I found your view while I was looking for a view for controlling RGB-LEDs on a remote Arduino.
However I noticed a little bug in it that is fatal for my intent of usage.
The setting of the value bar is not taken into aspect when changing the color in the color picker.
All the other bars are considered, but not the value bar.

I'd like to use the value bar for dimming the RGB-LEDs which works fine, but as soon as I change the color they are set to full brightness.
Dont know if this is a mistake in your wrapper or in the Github project, but a fix would be very appreciated. :)

regards Markus
 

peacemaker

Well-Known Member
Licensed User
hi,
thanks for the lib !
Any help how to preset the sat, opacity... sliders?
 
Top