-
Notifications
You must be signed in to change notification settings - Fork 0
/
MapsAt.bas
122 lines (99 loc) · 3.09 KB
/
MapsAt.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=11.8
@EndOfDesignText@
#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.
Dim atractionMap As Map
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private MyWebViewExtras As WebViewExtras
Private MyWebViewSetting As WebViewSettings
Private Navbar As Panel
Private MainScroll As ScrollView
Private btnList As Button
Private btnObj As Button
Private btnUserLoc As Button
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
Private PanelCategory As Panel
Private PanelRating As Panel
Private PanelRG As Panel
Private PanelSearch As Panel
Private spinCategory As Spinner
Private spinRating As Spinner
Private WebViewRG As WebView
Private spinName As Spinner
Private ButtonBack As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("MainScrollView")
MainScroll.Panel.LoadLayout("MapsRG")
Navbar.Visible = False
If Navbar.Visible == False Then
MainScroll.Top = MainScroll.Top - Navbar.Height
MainScroll.Height = MainScroll.Height + Navbar.Height
End If
WebViewRG.Height = MainScroll.Height
PanelRG.Height = MainScroll.Height
MainScroll.Panel.Height = MainScroll.Height
WebViewRG.JavaScriptEnabled = True
MyWebViewExtras.addWebChromeClient(WebViewRG, "WebViewRG")
MyWebViewSetting.setDOMStorageEnabled(WebViewRG,True)
WebViewRG.LoadUrl(Main.server)
End Sub
Sub Activity_Resume
Log("MapsAt Loaded")
If Starter.GPS1.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(Starter.GPS1.LocationSettingsIntent)
Else
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
CallSubDelayed(Starter, "StartGPS")
Else
ToastMessageShow("Please allow GPS to run this appliation", True)
Activity.Finish
End If
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
CallSubDelayed(Starter, "StopGPS")
End Sub
Private Sub WebViewRG_PageFinished (Url As String)
End Sub
Private Sub btnUserLoc_Click
UpdateLocation
Log("Panning to user location")
Dim panTO As String
panTO = "panTo({lat:"&Starter.lat&",lng:"&Starter.lng&"})"
MyWebViewExtras.executeJavascript(WebViewRG, panTO)
End Sub
Public Sub UpdateLocation
Log("Update user position on Maps")
Log("Lat: "&Starter.lat&"; Long: "&Starter.lng)
Dim addUserMarkerToMap As String
addUserMarkerToMap = "addUserMarkerToMap({lat:"&Starter.lat&",lng:"&Starter.lng&"})"
MyWebViewExtras.executeJavascript(WebViewRG, addUserMarkerToMap)
End Sub
Private Sub btnObj_Click
MyWebViewExtras.executeJavascript(WebViewRG,"showObject('atraction')")
End Sub
Private Sub btnList_Click
Log("Redirect to ListAt activity")
StartActivity(ListAt)
End Sub
Private Sub ButtonBack_Click
Log("Going back to previous activity")
Activity.Finish
End Sub