#Region Project Attributes
#ApplicationLabel: Il Tè
#VersionCode: 1
#VersionName: 1.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: true
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: false
#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.
Dim butstoria, butverde, butnero, butgiallo, butbianco, butoolong, butpuerh, butmiei As Button
Dim panstoria As Panel
Dim scrollstoria As ScrollView
Dim labelstoria, labelstoria1 As Label
Dim immstoria As ImageView
Dim StrUtil As StringUtils
Dim Font As Typeface
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")
Activity.LoadLayout("ilte")
Font = Typeface.LoadFromAssets("TEMPSITC.ttf")
butstoria.SetLayout(9%x, 22%y, 30%x, 10%y)
butverde.SetLayout(3%x, 43%y, 30%x, 10%y)
butnero.SetLayout(35%x, 43%y, 30%x, 10%y)
butgiallo.SetLayout(67%x, 43%y, 30%x, 10%y)
butbianco.SetLayout(3%x, 63%y, 30%x, 10%y)
butoolong.SetLayout(35%x, 63%y, 30%x, 10%y)
butpuerh.SetLayout(67%x, 63%y, 30%x, 10%y)
butmiei.SetLayout(18%x, 84%y, 30%x, 10%y)
panstoria.SetLayout(0%x, 0%y, 100%x, 100%y)
scrollstoria.Initialize(100)
labelstoria.Initialize("")
labelstoria1.Initialize("")
labelstoria.Text = File.ReadString(File.DirAssets, "labelstoria1.txt")
labelstoria1.Text = File.ReadString(File.DirAssets, "labelstoria1.txt")
panstoria.AddView(scrollstoria, 0%x, 16%y, 100%x, 100%y)
labelstoria.Typeface=Font
labelstoria.TextColor= Colors.black
labelstoria.TextSize= 19
labelstoria1.Typeface=Font
labelstoria1.TextColor= Colors.black
labelstoria1.TextSize= 19
immstoria.Initialize("")
immstoria.Bitmap = LoadBitmap(File.DirAssets, "icona.png")
immstoria.Gravity = Gravity.FILL
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
Select Case KeyCode
Case KeyCodes.KEYCODE_MENU, _
KeyCodes.KEYCODE_VOLUME_DOWN, _
KeyCodes.KEYCODE_VOLUME_UP, _
KeyCodes.KEYCODE_DEL
Return True
Case KeyCodes.KEYCODE_BACK
If panstoria.Visible = True Then
panstoria.Visible=False
Return True
End If
Case Else
Activity.finish
End Select
End Sub
Sub butstoria_Click
Dim ht As Int
Dim ht1 As Int
'scrollstoria.ScrollPosition = 0 'sposta alla prima riga lo scroll
ht = StrUtil.MeasureMultilineTextHeight(labelstoria, labelstoria.Text) ' misura l'altezza della label
ht1 = StrUtil.MeasureMultilineTextHeight(labelstoria1, labelstoria1.Text) ' misura l'altezza della label
labelstoria.Height = ht ' setta l'altezza della label
labelstoria1.Height = ht1 ' setta l'altezza della label
scrollstoria.Panel.Height = ht + immstoria.Height + ht1 ' setta l'altezza dello scroll
scrollstoria.Panel.AddView(labelstoria, 2%x, 0%y ,96%x, 100%y)
scrollstoria.Panel.AddView(immstoria, 20%x, ht+1%y ,60%x, 60%y)
scrollstoria.Panel.AddView(labelstoria1, 2%x, ht+immstoria.Height+1%y ,96%x, 100%y)
scrollstoria.ScrollPosition = 0 'sposta alla prima riga lo scroll
panstoria.Visible=True
End Sub