#Region Project Attributes
#ApplicationLabel:Santa App
#VersionCode: 1
#VersionName: B4a Community Project
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim timClock As Timer
Private target As Long
Private CountDowntimer As Timer
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 CallBtn As Button
Private DialLbl As Label
Private NumberPanel As Panel
Private PhonePanel As Panel
Private QuickDial1 As Button
Private QuickDial2 As Button
Private QuickDial3 As Button
Private AppsBtn As Button
Private ClockLbl As Label
Private CountdownLbl As Label
Private MainCallBtn As Button
Private MainPanel As Panel
Private AppMenuCallBtn As Button
Private AppMenuCloseBtn As Button
Private AppMenuCountdownBtn As Button
Private AppMenuPanel As Panel
Private AppMenuTrackerBtn As Button
Private AppMenuAdventBtn As Button
Private TrackerWebView As WebView
Private AdventBtn As Button
Private CountdownImg As ImageView
Private AdventPanel As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
ClockLbl.Text = "00:00"
DateTime.TimeFormat = "HH:mm:ss"
timClock.Initialize("timClock",1)
timClock.Enabled = True
If FirstTime Then
target = DateUtils.SetDate(DateTime.GetYear(DateTime.Now) + 0, 12, 25)
CountDowntimer.Initialize("CountDownTimer", 1000)
End If
CountDowntimer.Enabled = True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'Main Screen
Sub CountDownTimer_Tick
Dim p As Period = DateUtils.PeriodBetweenInDays(DateTime.Now, target)
CountdownLbl.Text = Format(p.Days) & " days until Christmas "
End Sub
Sub Format(n As Int) As String
Return NumberFormat(n, 2, 0)
End Sub
Sub timclock_Tick
'DateTime.TimeFormat = "hh:mm"
ClockLbl.Text = DateTime.time(DateTime.Now)
End Sub
Sub CallBtn_Click
Activity.LoadLayout("phone")
End Sub
Sub AppsBtn_Click
Activity.LoadLayout("appmenu")
End Sub
'App Menu
Sub AppMenuCallBtn_Click
Activity.LoadLayout("phone")
End Sub
Sub AppMenuCloseBtn_Click
Activity.LoadLayout("main")
End Sub
Sub AppMenuCountdownBtn_Click
End Sub
Sub AppMenuTrackerBtn_Click
TrackerWebView.Visible = True
TrackerWebView.LoadUrl("http://www.google.com/santatracker/")
End Sub
Sub AppMenuAdventBtn_Click
AdventPanel.Visible = True
End Sub
'Advent
Sub AdventBtn_Click
AdventPanel.Visible = True
End Sub