Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim cnvCanvas As Canvas
Dim rctRect As Rect
Dim bmpBitmap As Bitmap
End Sub
' Fill the movie scroll with Icons
Sub FillMovies_Icons(ScreenWidth As Int)
Dim Cursor1 As Cursor
Dim Query As String
Dim M, N, Gap, SemiGap As Int
Dim ImageLeft, ImageTop, ImageWidth, ImageHeight, RankValueWidth As Int
' Building SQL
bla bla bla
' Query database
bla bla bla
' Initialize Drawables
bmpBitmap.InitializeMutable(ImageWidth, ImageHeight)
cnvCanvas.Initialize2(bmpBitmap)
' Loop in records
For N=0 To Cursor1.RowCount - 1
Cursor1.Position=N
Dim lblMovieIcon As Panel
Dim lblTitle As Label
' Label Poster
lblMovieIcon.Initialize("MovieItem")
svMovies.Panel.AddView(lblMovieIcon, ImageLeft, ImageTop, ImageWidth, ImageHeight)
' Title
lblTitle.Initialize("")
lblMovieIcon.AddView(lblTitle, SemiGap, SemiGap, ImageWidth - Gap, 10)
lblTitle.TextColor=Colors.White
lblTitle.Gravity=Gravity.TOP + Gravity.CENTER_HORIZONTAL
lblMenu.TextSize=MM.Settings_FontSize
MM.WrapLabelHeight(lblTitle, False)
MM.ShowEllipsis_Label(lblTitle, Field_name)
' Shadow
For M=0 To SemiGap
cnvCanvas.DrawLine(SemiGap - M, SemiGap - M, ImageWidth - SemiGap + M, SemiGap - M, Colors.ARGB(150 - (150 * M / SemiGap), 0, 0, 0), 1)
cnvCanvas.DrawLine(SemiGap - M, SemiGap - M, SemiGap - M, ImageHeight - SemiGap + M, Colors.ARGB(150 - (150 * M / SemiGap), 0, 0, 0), 1)
cnvCanvas.DrawLine(SemiGap - M, ImageHeight - SemiGap + M, ImageWidth - SemiGap + M + 1, ImageHeight - SemiGap + M, Colors.ARGB(150 - (150 * M / SemiGap), 0, 0, 0), 1)
cnvCanvas.DrawLine(ImageWidth - SemiGap + M, ImageHeight - SemiGap + M, ImageWidth - SemiGap + M, SemiGap - M, Colors.ARGB(150 - (150 * M / SemiGap), 0, 0, 0), 1)
Next
' Poster bitmap
rctRect.Initialize(SemiGap, SemiGap, ImageWidth - SemiGap, ImageHeight - SemiGap)
If File.Exists(MM.OutputFolder & "/posters", Field_id & ".jpg") Then
cnvCanvas.DrawBitmap(LoadBitmapSample(MM.OutputFolder & "/posters", Field_id & ".jpg", ImageWidth - SemiGap, ImageHeight - SemiGap), Null, rctRect)
Else
cnvCanvas.DrawBitmap(MM.bmpNoImage, Null, rctRect)
End If
' Title gradient
For M=0 To 10
cnvCanvas.DrawLine(SemiGap - 1, SemiGap + lblTitle.Height * M/7, ImageWidth - SemiGap, SemiGap + lblTitle.Height * M/7, Colors.ARGB(250 - M * 24, 0, 0, 0), lblTitle.Height/7)
Next
' Draw bmpBitmap
lblMovieIcon.SetBackgroundImage(cnvCanvas.Bitmap)
lblMovieIcon.Invalidate
Next
' Close DB
MM.sqlDB.Close
End Sub