Sub Process_Globals
Dim timer1 As Timer
End Sub
Sub Globals
Dim pb As ProgressBar
Dim gd As GradientDrawable
End Sub
Sub Activity_Create(FirstTime As Boolean)
pb.Initialize("pb")
gd.Initialize("TOP_BOTTOM", Array As Int(Colors.Green, Colors.LightGray))
gd.CornerRadius = 30dip
SetProgressDrawable(pb, gd)
Activity.AddView(pb, 10dip, 10dip, 300dip, 10dip)
timer1.Initialize("timer1",1000)
timer1.Enabled = True
End Sub
Sub SetProgressDrawable(p As ProgressBar, drawable As Object)
Dim r As Reflector
Dim clipDrawable As Object
clipDrawable = r.CreateObject2("android.graphics.drawable.ClipDrawable", _
Array As Object(drawable, Gravity.LEFT, 1), _
Array As String("android.graphics.drawable.Drawable", "java.lang.int", "java.lang.int"))
r.Target = p
r.Target = r.RunMethod("getProgressDrawable") 'Gets the layerDrawable
r.RunMethod4("setDrawableByLayerId", _
Array As Object(r.GetStaticField("android.R$id", "progress"), clipDrawable), _
Array As String("java.lang.int", "android.graphics.drawable.Drawable"))
End Sub
Sub timer1_tick
pb.Progress = 1 + 5
If pb.Progress > 100 Then
ToastMessageShow("Hello",True)
timer1.Enabled = False
End If
End Sub