B4A Library Holo ColorPicker V1.0.4

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Mar 6, 2015.

Similar threads

B4A Library IPCamView
B4A Library ChatMessageView
B4A Library PanoramaImageView
B4A Library msEmoji V1.0.0
B4A Library SnakeView
  1. DonManfred

    DonManfred Expert Licensed User

    HoloColorPicker
    Version:
    1.04

    This is a wrapper for this Github-project.

    [​IMG]

    • 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) :)
    [​IMG]
     

    Attached Files:

    Last edited: Mar 13, 2015
  2. Peter Simpson

    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...
     

    Attached Files:

    Last edited: Apr 4, 2015
    Phayao, MhdBoy, mshafiee110 and 3 others like this.
  3. tmf

    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?? :)
     
  4. DonManfred

    DonManfred Expert Licensed User

    Try this Example please
     

    Attached Files:

    Omand and mshafiee110 like this.
  5. tmf

    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....
     
  6. DonManfred

    DonManfred Expert Licensed User

    >Regards Manfred

    I dont know any Lady with name Manfred ;-)

    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 :)
     
    giga likes this.
  7. tmf

    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!
     
  8. DonManfred

    DonManfred Expert Licensed User

    In the next release you will be able to set the "starting color" with
    Code:
    cp.Color = Colors.Red
     
    tmf likes this.
  9. tmf

    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.
     
  10. DonManfred

    DonManfred Expert Licensed User

    I have updated Post #1 and added download for v1.0.4
    i´m not sure if i understand correctly. Can you plese describe more detailed?
     
  11. DonManfred

    DonManfred Expert Licensed User

    Code:
    cp.Color = Colors.Red
        cp.NewCenterColor = 
    Colors.Red
        cp.OldCenterColor = 
    Colors.Red
     
  12. tmf

    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 :)
     
  13. tmf

    tmf Member Licensed User

    1.0.4 works so far! would be nice to have control on the line thickness of the halo and maybe the diameter of the "knob" :)
     
    Peter Simpson likes this.
  14. tmf

    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.
     
  15. DonManfred

    DonManfred Expert Licensed User

    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
    Code:
    Sub GetARGB(Color As Int) As Int()
        
    Dim res(4As 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
     
    Peter Simpson likes this.
  16. giga

    giga Well-Known Member Licensed User

    I dont know any Lady with name Manfred ;-)

    @DonManfred
    Nice one Man! :)
     
    DonManfred likes this.
  17. Peter Simpson

    Peter Simpson Expert Licensed User

    I finally upgraded my 'Tix Clock' widget color picker and it's looking good.
    [​IMG]

    Thank you @DonManfred for this great library...
     
    DonManfred likes this.
  18. KnipsFips

    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
     
  19. Danbicky

    Danbicky Member Licensed User

    Hi @KnipsFips,

    Would be great to see the example you have created for dimming RGB LED's any chance of sharing.

    Big thanks

    Dans
     
  20. peacemaker

    peacemaker Well-Known Member Licensed User

    hi,
    thanks for the lib !
    Any help how to preset the sat, opacity... sliders?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice