#Region Project Attributes
#ApplicationLabel: Scratch Card
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#AdditionalJar: com.android.support:support-v4
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ScratchImageView1 As ScratchImageView
Private ScratchTextView1 As ScratchTextView
Private ScratchTextView2 As ScratchTextView
Private ScratchTextView3 As ScratchTextView
Private tvList As List
Private Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
tvList.Initialize
tvList.Add(ScratchTextView1)
tvList.Add(ScratchTextView2)
tvList.Add(ScratchTextView3)
ScratchImageView1.SetLayout(50dip,50dip,150dip,150dip)
'ScratchTextView1.SetLayout(0,300dip,100%x,50dip)
ScratchTextView1.Tag = 1000
ScratchTextView2.Tag = 500
ScratchTextView3.Tag = 100
ScratchTextView1.Invalidate
ScratchTextView2.Invalidate
ScratchTextView3.Invalidate
Dim bmp As Bitmap
bmp.Initialize(File.DirAssets,"donmanfred.png")
Dim d As BitmapDrawable
d.Initialize(bmp)
ScratchImageView1.ImageDrawable = d
ScratchImageView1.SetBackgroundImage(bmp)
End Sub
Sub Activity_Resume
'ScratchImageView1.clear
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ScratchImageView1_onRevealed()
Log($"ScratchImageView1_onRevealed"$)
End Sub
Sub ScratchImageView1_PercentRevealed(percent As Double)
Log($"ScratchImageView1_PercentRevealed(${percent})"$)
End Sub
Sub ScratchText_PercentRevealed(percent As Double)
Log($"ScratchImageView1_PercentRevealed(${percent})"$)
End Sub
Sub ScratchText_onRevealed()
Log($"ScratchText_onRevealed"$)
Dim stv As ScratchTextView = Sender
Dim amount As Int = stv.Tag
Label1.Text = "$"&amount
End Sub
Sub ScratchText_onScratching(Scratched As Boolean)
Log($"ScratchText_onScratching"$)
Dim stv As ScratchTextView = Sender
For i = 0 To tvList.Size-1
Dim s As ScratchTextView = tvList.Get(i)
If s <> stv Then
s.Visible = False
End If
Next
End Sub