Sub Process_Globals
End Sub
Sub Globals
Dim Button1 As Button
Dim r As Rect
Dim btnRect As Rect
Dim Gradient1 As GradientDrawable
Dim canvas1 As Canvas
Dim Clrs(2) As Int
Dim time As Timer
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
canvas1.Initialize(Button1)
btnRect.Initialize(0, 0, Button1.Width, Button1.Height)
r.Initialize(btnRect.CenterX - 30dip, btnRect.CenterY - 30dip, _
btnRect.CenterX + 30dip, btnRect.CenterY + 30dip)
DrawButton(Colors.Green,Colors.Blue)
time.Initialize("time",100)
End Sub
Sub Button1_Click
DrawButton(Colors.Blue,Colors.Green)
time.Enabled=True
End Sub
Sub time_Tick
DrawButton(Colors.Green, Colors.Blue)
time.Enabled=False
End Sub
Sub DrawButton(col1 As Int, col2 As Int)
Clrs(1) = col1
Clrs(0) = col2
Gradient1.Initialize("TOP_BOTTOM", Clrs)
Canvas1.DrawDrawable(Gradient1, btnRect)
canvas1.DrawBitmap(LoadBitmap(File.DirAssets, "smiley.gif"), Null, r)
Activity.Invalidate
End Sub