#Region Project Attributes
#ApplicationLabel: NiceSpinner
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#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 ns1, ns2 As NiceSpinner
Private b1, b2 As Button
Dim r1 As List
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("main")
ns1.Initialize("ns1")
ns2.Initialize("ns2")
b1.Initialize("b1")
b1.Color = Colors.Blue
b1.Text = "Clear ns1"
b1.TextColor = Colors.white
b2.Initialize("b2")
b2.Color = Colors.Blue
b2.Text = "Change ns1"
b2.TextColor = Colors.white
Activity.AddView(ns1, 20%x, 5%y, 20%x, 15%y)
Activity.AddView(ns2, 60%x, 5%y, 20%x, 15%y)
Activity.AddView(b1, 5%x, 80%y, 30%x, 20%y)
Activity.AddView(b2, 40%x, 80%y, 30%x, 20%y)
r1.Initialize
r1.AddAll(Array As String("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve"))
Dim divcolor() As Int = Array As Int(Colors.Blue, Colors.Green, Colors.Red)
ns1.DividerColor = divcolor
ns1.DividerHeight = 1
ns1.DropdownListBackgroundColor = Colors.Green
ns1.attachDataSource(r1)
ns1.DropdownListTextColor = Colors.DarkGray
'the next two lines of code must be before ns1.SelectedIndex is set
ns1.SelectedTextColor = Colors.Cyan
ns1.SelectedTextBackgroundColor = Colors.White
'always set this even if just to 0
ns1.SelectedIndex = 0
ns1.SpinnerEnabled = True
Dim r2 As List
r2.Initialize
r2.AddAll(Array As String("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
ns2.DividerColor = divcolor
ns2.DividerHeight = 3
ns2.DropdownListBackgroundColor = Colors.Black
ns2.attachDataSource(r2)
ns2.DropdownListTextColor = Colors.White
'the next two lines of code must be before ns2.SelectedIndex is set
ns2.SelectedTextColor = Colors.White
ns2.SelectedTextBackgroundColor = Colors.DarkGray
'always set this even if just to 0
ns2.SelectedIndex = 2
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub ns1_item_clicked
Log("ns1 item " & ns1.SelectedIndex &" selected")
End Sub
Sub ns1_spinner_touched
Log("ns1 Spinner Touched")
End Sub
Sub ns2_item_clicked
Log("ns2 item " & ns2.SelectedIndex &" selected")
End Sub
Sub ns2_spinner_touched
Log("ns2 Spinner Touched")
End Sub
Sub b1_click
ns1.RemoveView
ns1.Initialize("ns1")
Activity.AddView(ns1, 20%x, 5%y, 20%x, 15%y)
r1.Initialize
r1.AddAll(Array As String(""))
Dim divcolor() As Int = Array As Int(Colors.Blue, Colors.Green, Colors.Red)
ns1.DividerColor = divcolor
ns1.DividerHeight = 1
ns1.DropdownListBackgroundColor = Colors.Green
ns1.attachDataSource(r1)
ns1.DropdownListTextColor = Colors.DarkGray
'the next two lines of code must be before ns1.SelectedIndex is set
ns1.SelectedTextColor = Colors.Cyan
ns1.SelectedTextBackgroundColor = Colors.White
'always set this even if just to 0
ns1.SelectedIndex = 0
ns1.SpinnerEnabled = True
End Sub
Sub b2_click
ns1.RemoveView
ns1.Initialize("ns1")
Activity.AddView(ns1, 20%x, 5%y, 20%x, 15%y)
r1.Initialize
r1.AddAll(Array As String("A", "1", "B", "2", "C", "3", "D", "4", "E", "5"))
Dim divcolor() As Int = Array As Int(Colors.Blue, Colors.Green, Colors.Red)
ns1.DividerColor = divcolor
ns1.DividerHeight = 1
ns1.DropdownListBackgroundColor = Colors.Green
ns1.attachDataSource(r1)
ns1.DropdownListTextColor = Colors.DarkGray
'the next two lines of code must be before ns1.SelectedIndex is set
ns1.SelectedTextColor = Colors.Cyan
ns1.SelectedTextBackgroundColor = Colors.White
'always set this even if just to 0
ns1.SelectedIndex = 0
ns1.SpinnerEnabled = True
End Sub