B4A Library FlatTimeCollection

A wrap for part of this Github project. Will add the rest as and when time allows.

Posting the following:
1. B4A project (when you open it at first and it does not want to run then do Tools ---> Clean project)
2. B4A library files

You need android-support-v4.jar in your additional library folder.

1.gif


Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aFlatTimeCollection
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\FlatTimeCollectionRes

#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 fcv1 As FlatClockView
    Private fcv2 As FlatClockView
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")
  
    'fcv1.BackgroundCircleColor = Colors.ARGB(100, 100, 100, 0)    'or comment it to have the default color applied
    fcv1.setDarkTheme
    'fcv1.setLightTheme
    'fcv1.setDefaultTheme
    fcv1.BigMarkColor = Colors.Blue
    fcv1.SmallMarkColor = Colors.Red
    fcv1.WithBackground = True
    fcv1.MinIndicatorColor = Colors.Cyan
    fcv1.HourIndicatorColor =Colors.Magenta
    fcv1.SecIndicatorColor = Colors.White
    'fcv1.Time_1 = 7                               'set the hour only
    'fcv1.Time_3 = "11:30:00"                      'set the time from a string
    'fcv1.setTime_2(5,43)                          'set the hour and the minutes
    'fcv1.setTime_4(7,36,45)                       'set the hour, minutes, seconds
    fcv1.setTimeToNow                              'set the time to the device time
  
  
    fcv2.BackgroundCircleColor = Colors.ARGB(200, 100, 100, 0)    'or comment it to have the default color applied
    'fcv2.setDarkTheme
    fcv2.setLightTheme
    'fcv2.setDefaultTheme
    fcv2.BigMarkColor = Colors.Magenta
    fcv2.SmallMarkColor = Colors.Green
    fcv2.WithBackground = False
    fcv2.MinIndicatorColor = Colors.Red
    fcv2.HourIndicatorColor =Colors.Yellow
    fcv2.SecIndicatorColor = Colors.LightGray
    'fcv2.Time_1 = 7                               'set the hour only
    fcv2.Time_3 = "11:37:43"                      'set the time from a string
    'fcv2.setTime_2(5,43)                          'set the hour and the minutes
    'fcv2.setTime_4(7,36,45)                       'set the hour, minutes, seconds
    'fcv2.setTimeToNow                              'set the time to the device time  
  

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub fcv1_tick
  
    Log("clock 1 goes tick-tick")
  
End Sub


Sub fcv2_tick()
  
    Log("clock 2 goes tick-tick")
  
End Sub

Library:
FlatTimeCollection
Author:
Github: Anas Altair, Wrapped by: Johan Schoeman
Version: 1
  • FlatClockView
    Events:
    • tick
    Fields:
    • ba As BA
    Methods:
    • 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)
    • setDarkTheme
    • setDefaultTheme
    • setLightTheme
    • setTimeToNow
    • setTime_2 (hour As Int, minute As Int)
      to set custom Time.
      hour: should be between {0,11}
      minute: should be between {0,59}
    • setTime_4 (hour As Int, minute As Int, second As Int)
      to set custom Time.
      hour: should be between {0,11}
      minute: should be between {0,59}
      second: should be between {0,59}
    Properties:
    • Background As Drawable
    • BackgroundCircleColor As Int [write only]
    • BigMarkColor As Int [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • HourIndicatorColor As Int [write only]
    • Left As Int
    • MinIndicatorColor As Int [write only]
    • Parent As Object [read only]
    • SecIndicatorColor As Int [write only]
    • SmallMarkColor As Int [write only]
    • Tag As Object
    • Time_1 As Int [write only]
      to set custom Time.
    • Time_3 As String [write only]
      to set custom Time.
    • Top As Int
    • Visible As Boolean
    • Width As Int
    • WithBackground As Boolean [write only]
 

Attachments

  • b4aFlatTimeCollection.zip
    17.4 KB · Views: 320
  • FlatTimeCollectionLibFiles.zip
    20.6 KB · Views: 338
Last edited:
Top