A nice ColorPicker that wraps this Github project. Posting the following:
1. B4A Sample project
2. B4A Library files - copy them to your additional library folder.
You will also need android-support-v4.jar and android-support-v7-appcompat.jar in your additional library folder.
Take note of the following in the B4A project and set your own path accordingly:
Also take note of the files in the B4A project's /Objects/res/blabla folders. Make sure these files are set to READ ONLY.
You also need to download / enable AppCompat V2.00 (by @corwin42 - it is somewhere on the forum)
The lib raises two events in B4A
1. The color selected (as an Int and as a hex string)
2. When cancel is pressed on the dialog
Sample Code:
Library:
ColorPicker
Author: Github: QuadFlask, Wrapped by: Johan Schoeman
Version: 1
1. B4A Sample project
2. B4A Library files - copy them to your additional library folder.
You will also need android-support-v4.jar and android-support-v7-appcompat.jar in your additional library folder.
Take note of the following in the B4A project and set your own path accordingly:
B4X:
#AdditionalRes: C:\Android\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
Also take note of the files in the B4A project's /Objects/res/blabla folders. Make sure these files are set to READ ONLY.
You also need to download / enable AppCompat V2.00 (by @corwin42 - it is somewhere on the forum)
The lib raises two events in B4A
1. The color selected (as an Int and as a hex string)
2. When cancel is pressed on the dialog
Sample Code:
B4X:
#Region Project Attributes
#ApplicationLabel: b4aColorPicker
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
'#AdditionalRes: ..\resource
#AdditionalRes: C:\Android\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
'#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\google\google-play-services\libproject\google-play-services_lib\res, com.google.android.gms
'#AdditionalRes: C:\ANDRIOD_SDK_TOOLS\extras\android\support\design\res, android.support.design
'#ExcludeClasses: .games, .drive, .ads, .fitness, .wearable, .measurement, .cast, .auth, .nearby
'#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .gcm, .maps, .panorama
#Extends: android.support.v7.app.AppCompatActivity
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
Dim cp As ColorPicker
Private Panel1 As Panel
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("main")
cp.Initialize("cp")
Panel1.Color = Colors.Transparent
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
cp.StartPicker
End Sub
Sub cp_selected_color(mycolor As Int, hexcolor As String)
Panel1.Color = mycolor
Log("Hex Color = " & hexcolor)
End Sub
Sub cp_selection_cancelled
Log("SELECTION WAS CANCELLED")
End Sub
Library:
ColorPicker
Author: Github: QuadFlask, Wrapped by: Johan Schoeman
Version: 1
- ColorPicker
Events:- selected_color (selectedcolor As Int, hexcolor As String)
- selection_cancelled
- Initialize (paramString As String)
- StartPicker