Sub Globals
Dim ListView1 As ListView
Dim ImageView1 As ImageView
Dim Phone1 As Phone
Dim IconList As List
Dim i As Long
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Title = "Andoid System Icons - Requio, Okinawa"
ImageView1.Initialize("ImageView1")
ImageView1.Gravity = Gravity.FILL
IconList.Initialize
IconList = File.ReadList(File.DirAssets,"codenames.txt")
ListView1.Initialize("ListView1")
Activity.AddView(ImageView1, 0, 0, 48dip, 48dip)
Activity.AddView(ListView1, 0, 60dip, 100%x, 80%y)
ListView1.FastScrollEnabled = True
ListView1.TwoLinesAndBitmap.ItemHeight = 55dip
ListView1.TwoLinesAndBitmap.Label.TextSize = 16
ListView1.TwoLinesAndBitmap.SecondLabel.TextSize = 16
ListView1.TwoLinesAndBitmap.SecondLabel.TextColor = Colors.RGB(255,60,0)
ListView1.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER_VERTICAL
ListView1.TwoLinesAndBitmap.SecondLabel.Gravity = Gravity.TOP
ListView1.TwoLinesAndBitmap.ImageView.Width = 48dip
ListView1.TwoLinesAndBitmap.ImageView.Height = 48dip
ListView1.TwoLinesAndBitmap.ImageView.Gravity = Gravity.FILL
For i = 17301504 To 17301683
If i <> 17301679 Then 'constant value 17301679 throws an error on Sharp IS03
'ImageView1.Background = Phone1.GetResourceDrawable(i)
'ListView1.AddTwoLinesAndBitmap2(IconList.Get(i - 17301504),i,ImageView1.Bitmap,i)
ListView1.AddTwoLinesAndBitmap2(IconList.Get(i - 17301504),i,getSystemIcon(i),i)
End If
Next
End Sub
Sub ListView1_ItemClick (Position As Int, Value As Object)
ImageView1.Background = Phone1.GetResourceDrawable(Value)
End Sub
Sub getSystemIcon(intResurce As Int) As Bitmap
Dim Icon2 As Bitmap
Dim ph As Phone
Dim can As Canvas
Dim rc As Rect
icon2.InitializeMutable(48,48)
can.Initialize2(icon2)
rc.Initialize (0,0,47,47)
icon2.InitializeMutable(48,48)'just guessed the size for now
can.DrawDrawable(ph.GetResourceDrawable(intResurce), rc)
Return can.Bitmap
End Sub