Sub Activity_Create(FirstTime As Boolean)
Activity.Title = "Copy your Smiley"
Activity.LoadLayout("mainlayout")
IconList.Initialize
IconList = File.ReadList(File.DirAssets,"smileys.txt")
Activity.AddMenuItem("Toggle Notification","mnuNoti")
Activity.AddMenuItem("About","mnuAbout")
Activity.AddMenuItem("Download","mnuDownload")
Website.initialize("")
Activity.AddView(Website,0,0,100%x,100%y)
Website.Visible = False
merker = 0
merker2 = 0
y = 10
x = 10
c = 0
lv = GetDeviceLayoutValues
hoehe = lv.Height
breite = lv.Width
scvImages.SetLayout(0,0,100%x,100%y)
n.Vibrate = False
rueckkehr = "close"
HttpUtils.CallbackActivity = "Main" 'Current activity name.
HttpUtils.CallbackJobDoneSub = "JobDone"
If firsttime = True Then
counter.Visible = True
counter.Height = hoehe
counter.width = breite
counter.top = 1
counter.Text = "Downloading..."
HttpUtils.DownloadList("Job1", IconList)
Else
Listfill
End If
End Sub
Sub Activity_Resume
'Check whether a job has finished while the activity was paused.
If HttpUtils.Complete = True Then JobDone(HttpUtils.Job)
End Sub
Sub UrlDone(Url As String)
Log(Url & " done")
End Sub
Sub JobDone (Job As String)
For i = 0 To HttpUtils.Tasks.Size - 1
counter.Text = i
s = HttpUtils.GetBitmap(IconList.get(i))
imgWidth = s.width * 2
imgheight = s.height * 2
merker = imgwidth / imgheight
imgheight = 75
If merker > 1 Then
imgwidth = 90 * merker
Else
imgwidth = 90
End If
If x > breite - imgwidth Then
x = 10
y = y + 90
End If
Dim imvImage As ImageView
imvImage.Initialize("imvImage")
imvImage.Gravity=Gravity.FILL
imvImage.Tag=IconList.Get(i)
imvImage.Bitmap=s
scvImages.Panel.AddView(imvImage,x,y,imgWidth,imgHeight)
x = x + imgwidth + 30
Next
scvImages.Panel.Height = y + 200
counter.Visible = False
HttpUtils.Complete = False 'Turn off the complete flag so we won't handle it again if the activity is resumed.
End Sub