It wraps this Github project. Posting the following:
1. B4A project
2. B4A library files - copy them to your additional library folder
Click on the icon to start / stop the pulsing (it can be used as a "Button"). The library raises events in the B4A project when the pulsing is started and stopped.
Add the icons (*.png or *.jpg) to the /Objects/res/drawable folder of the B4A project and set them to READ ONLY. Prior to that it is recommended that you edit your icons (with something like GIMP) and set the background to transparent.
+100
+200
...and another one for my friend @MarcoRome
Sample code:
Library
PulseView
Author: Github: GIGAMOLE, Wrapped by: Johan Schoeman
Version: 1
1. B4A project
2. B4A library files - copy them to your additional library folder
Click on the icon to start / stop the pulsing (it can be used as a "Button"). The library raises events in the B4A project when the pulsing is started and stopped.
Add the icons (*.png or *.jpg) to the /Objects/res/drawable folder of the B4A project and set them to READ ONLY. Prior to that it is recommended that you edit your icons (with something like GIMP) and set the background to transparent.
+100
+200
...and another one for my friend @MarcoRome
Sample code:
B4X:
#Region Project Attributes
#ApplicationLabel: PulseView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#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 pv1 As PulseView
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")
pv1.IconDrawable = "icon" 'this icon must be in the B4A project's /Objects/res/drawable folder
pv1.IconHeight = 200
pv1.IconWidth = 200
pv1.PulseCount = 6 'set the number of pulses to display simultaneously
pv1.PulseAlpha = 150 'Set the Alpha of the pulse color
pv1.PulseSpawnPeriod = 600 'set the time in milliseconds to emit another pulse from the core
pv1.PulseColor = Colors.Yellow 'set the color of the pulse being emitted
pv1.ShowToastMessages = True 'show a toast message when pulsing starts?
pv1.StartToastMessage = "Pulsing Started" 'toast message text to show when pulsing starts
pv1.FinishToastMessage = "Pulsing Finished" 'toast message text to show when pulsing finishes
End Sub
Sub Activity_Resume
'pv1.start
End Sub
Sub Activity_Pause (UserClosed As Boolean)
pv1.stopPulse
End Sub
Sub pv1_pulse_started()
Log("B4A : pulse started")
End Sub
Sub pv1_pulse_finished()
Log("B4A : pulse finished")
End Sub
Library
PulseView
Author: Github: GIGAMOLE, Wrapped by: Johan Schoeman
Version: 1
- PulseView
Events:- pulse_started () , pulse_finished()
- ba As BA
- 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)
- startPulse
Start the pulsing - stopPulse
Stop the pulse
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- FinishToastMessage As String [write only]
Set the toast message when pulsing finishes
Click on the pulsing icon to finish the pulsing - Height As Int
- IconDrawable As String [write only]
Set icon drawable that should be in the /drawable folder of the B4A project
for eg if the icon file is called icon.png or icon.jpg then in B4A just use:
IconDrawable = "icon" - IconHeight As Int [write only]
Set the icon height - IconWidth As Int [write only]
Set the icon width - Left As Int
- Parent As Object [read only]
- PulseAlpha As Float [write only]
Set the Alpha of the pulse color - PulseColor As Int [write only]
Set the pulse color - PulseCount As Int [write only]
Set the number of pulses to display - PulseSpawnPeriod As Long [write only]
Set the time in milliseconds for the next pulse to be emitted - ShowToastMessages As Boolean [write only]
Set if a toast message should be displayed or not - StartToastMessage As String [write only]
Set the toast message when pulsing starts
Click on the icon to start the pulsing - Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
Attachments
Last edited: