B4A Library DayNightSwitch

A small wrap for this Github project. Posting
1. B4A library files - copy them to your additional library folder
2. LibRes.zip - extract it and copy the folder and its contents to be on the same folder level as that of the /Files and /Objects folders of the B4A project
3. B4A samples project.

Min SDK 9 (Android 2.3–2.3.2 Gingerbread)

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

#AdditionalRes: ..\LibRes

#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 dns1 As DayNightSwitch
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")
   

    dns1.IsNight = False
    Activity.Color = Colors.White


End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub dns1_on_switch(is_night As Boolean)
   
    If is_night = True Then
        Activity.SetColorAnimated(400, Colors.White, Colors.Black)
    Else
        Activity.SetColorAnimated(400, Colors.Black, Colors.White)
    End If
     
   
End Sub

Sub dns1_animation_started()
   
End Sub

Sub dns1_animation_end()
   
End Sub

Sub dns1_animation_value_changed(value As Float)
   
   
End Sub

demo.gif
 

Attachments

  • b4aDayNightSwitch.zip
    8 KB · Views: 333
  • LibRes.zip
    18.1 KB · Views: 333
  • b4aLibFiles.zip
    106.1 KB · Views: 358
Top