Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'Dim hc As HttpClient
Dim FILL_PARENT As Int : FILL_PARENT = -1
Dim WRAP_CONTENT As Int : WRAP_CONTENT = -2
'We put this information to the panel tag of the panel for the pages
Type PanelInfo (PanelType As Int, LayoutLoaded As Boolean)
'Dim CurrentTheme As Int : CurrentTheme = 0
Dim CurrentPage As Int : CurrentPage = 0
End Sub
Sub Globals
Dim AsMenu, AsMenu1 As AnimatedSlidingMenu
'The container and the ViewPager objects
Dim container As AHPageContainer
Dim pager As AHViewPager
'Optionally you can use an AHViewPagerTabs object as a page indicator
Dim tabs As AHViewPagerTabs
'This panel is just for a colored line between the tabs and the pages.
Dim line As Panel
Dim pncam1,pncam2,pncam3 As Panel
Dim sv4 As ScrollView
Dim panelbkcolor As Int = Colors.Green
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Color=Colors.white
Activity.TitleColor=Colors.white
Activity.Title="TEST"
'Initialize the panels we use for the pages and put them in the container
container.Initialize
For i = 3 To 4
Dim pan As Panel
Select i
Case 3
pan = CreatePanel(i, "my photos")
container.AddPage(pan,"my photos")
Case 4
pan = CreatePanel(i, "my images")
container.AddPage(pan,"my images")
End Select
Next
'Now we have a container with our panels just add it to the pager object
pager.Initialize(container, "Pager")
'As we want to show the tabs page indicator, we initialize it
tabs.Initialize(pager)
tabs.LineHeight = 5dip
tabs.UpperCaseTitle = False
'We add a line below the tab page indicator because it looks good
Dim col As ColorDrawable
col.Initialize(tabs.LineColorCenter, 0)
line.Initialize("")
line.Background=col
Activity.AddView(tabs, 0, 0, FILL_PARENT, WRAP_CONTENT)
Activity.AddView(line, 0, 35dip, Activity.Width, 2dip)
Activity.AddView(pager, 0, 35dip + 2dip, Activity.Width, Activity.Height)
End Sub
'This creates a page of the given Type
Sub CreatePanel(PanelType As Int, Title As String) As Panel
Dim pan As Panel
Dim pi As PanelInfo
pi.Initialize
pi.LayoutLoaded = False
pi.PanelType = PanelType
pan.Initialize("")
Select PanelType
Case 3,4 'my photos
sv4.Initialize(200%y)
pan.AddView(sv4,0,0,100%x,100%y-20dip)
pan.Color = panelbkcolor
sv4.Panel.Color = panelbkcolor
Dim h As Int
h= sv4.Panel.width/2048*1536
pncam1.Initialize("")
pncam1.Color=Colors.red
sv4.Panel.AddView(pncam1,0,0,sv4.Panel.width,h)
pncam2.Initialize("")
sv4.Panel.AddView(pncam2,0,h+2dip,sv4.Panel.width,h)
pncam3.Initialize("")
sv4.Panel.AddView(pncam3,0,2*h+4dip,sv4.Panel.width,h)
pncam1.Color=Colors.red
pncam2.Color=Colors.red
pncam3.Color=Colors.red
End Select
pan.Tag = pi
Return pan
End Sub