Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim talen As String
Dim taal As String
Dim lsSL As List
Dim Selection As String
Dim SelectionIndex As Int : SelectionIndex = 5
Dim j As Int
Dim BtnNr, RowNr, ColNr As Int
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 scrv As ScrollView
Dim spSL As Spinner
Dim Selector As Map
Dim dip As String
Dim btCA, btCS, btDA, btDE, btET, btEN, btES, btEU, btFR, btFY, btIT, btNL, btPL, btPT, btRU, btSC, btSL, btSV, btUK As Button
Dim btnTxt() As String
Dim lbEN, lbDE, lbFR, lbES, lbIT, lbPT, lbNL, lbDA, lbSC, lbSV, lbCA, lbEU, lbFY, lbRU, lbSL, lbUK, lbET, lbPL, lbCS As Label
Dim lbVolgorde() As String
Dim CA, CS, DA, DE, ET, EN, ES, EU, FR, FY, IT, NL, PL, PT, RU, SC, SL, SV, UK As String
Dim grad As GradientDrawable
Dim cls(2) As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("LOL")
If FirstTime Then
lsSL.Initialize
lsSL.AddAll(Array As String("Català", "Česky", "Dansk", "Deutsch", "Eesti", "English", _
"Español", "Euskara", "Français", "Frysk", "Italiano", "Nederlands", "Polski", "Português", _
"Русский", "Scientific", "Slovenščina", "Svenska", "Українська"))
j = 1
End If
Selector.Initialize
Selector.Put("Language", spSL)
Talen
End Sub
Sub Talen
Dim row, col, n As Int
Dim btnHeight, btnWidth As Float
Dim lbHeight, lbWidth As Float
Dim Space As Float
btnTxt = Array As String("Català", "Česky", "Dansk", "Deutsch", "Eesti", "English", _
"Español", "Euskara", "Français", "Frysk", "Italiano", "Nederlands", "Polski", "Português", _
"Русский", "Scientific", "Slovenščina", "Svenska", "Українська")
lbVolgorde = Array As String ("CA", "CS", "DA", "DE", "ET", "EN", "ES", "EU", "FR", "FY", "IT", "NL", "PL", "PT", "RU", "SC", "SL", "SV", "UK")
scrv.Initialize(0)
Activity.AddView(scrv, 0, 120dip, 100%x, 100%y)
btnHeight = 45dip
btnWidth = 110dip
lbHeight = 40dip
lbWidth = 30
BtnNr = btnTxt.Length
ColNr = 2
RowNr = Ceil (BtnNr / ColNr)
Space = 5dip
For row = 0 To RowNr -1
For col = 0 To ColNr -1
Dim btn As Button
Dim lb As Label
btn.Initialize("Button")
lb.Initialize("Label")
btn.TextSize = 17
lb.TextColor = Colors.Black
lb.TextSize = 18
n = row * ColNr + col
If n <= BtnNr -1 Then
btn.Tag = lbVolgorde(row * 2 + col)
lb.Tag = lbVolgorde(row * 2 + col)
btn.Text = btnTxt(row * 2 + col)
scrv.Panel.AddView(btn, Space + col * 50%x, 5dip + row * (btnHeight + 5dip), btnWidth, btnHeight)
scrv.Panel.AddView(lb, 120dip + col * 50%x, 5dip + row * (lbHeight + 10dip), lbWidth, lbHeight)
cls(0) = Colors.RGB(152, 251, 152)
cls(1) = Colors.RGB(152, 251, 152)
grad.Initialize("LEFT_RIGHT", cls)
grad.CornerRadius = 3
lb.Background = grad
lb.Gravity = Gravity.CENTER
End If
Next
Next
scrv.Panel.Height = 20dip + row * (btnHeight + 20dip)
End Sub
Sub Activity_Resume
Dim lb As Label
lb.Initialize("Label")
lb = Sender
Selection = Selector
spSL.AddAll(lsSL)
spSL.SelectedIndex = SelectionIndex
Selection = spSL.SelectedIndex
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub spSL_ItemClick (Position As Int, Value As Object)
Selection = Value
SelectionIndex = Position
End Sub
Sub Button_Click
Dim btn As Button
Dim row, col, i As Int
btn = Sender
'For i = 0 To scrv.Panel.NumberOfViews -1
'i = 9 Puts 1 at Eesti
Dim lb As Label
lb = scrv.Panel.GetView(i+1)
If lb.Text = "" Then
lb.Text = j
j = j + 1
Else
End If
End Sub