ub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private WebView1 As WebView
Private WebView2 As WebView
Dim pdfv As PDFViewer
Dim pc As Int=0
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")
Dim WebViewSettings1 As WebViewSettings
WebViewSettings1.setDefaultZoom(WebView1, "FAR")
WebViewSettings1.setLoadWithOverviewMode(WebView1, True)
WebViewSettings1.setUseWideViewPort(WebView1, True)
WebViewSettings1.setAllowFileAccess(WebView1, True)
WebViewSettings1.setDisplayZoomControls(WebView1, False)
WebView1.LoadUrl("http://www.taksi-m.com.tr/track")
End Sub
Sub WebView1_OverrideUrl (Url As String) As Boolean
If Url.EndsWith(".pdf") Then
Activity.LoadLayout("Layout2")
pdfv.init
Activity.AddView(pdfv,0,0,-1,-1)
pdfv.getpdf(Url)
If pdfv.isValid Then
'Log("pagecount:"&pdfv.PageCount)
pdfv.scrollToPage(0)
pc=pdfv.GetPageCount
pdfv.zoom(3.0)
Return True
Else
Return False
End If
Else If Url.StartsWith("https://www.google.com") Then
Activity.LoadLayout("Layout2")
Dim WebViewSettings2 As WebViewSettings
WebViewSettings2.setDefaultZoom(WebView2, "FAR")
WebViewSettings2.setLoadWithOverviewMode(WebView2, True)
WebViewSettings2.setUseWideViewPort(WebView2, True)
WebViewSettings2.setAllowFileAccess(WebView2, True)
WebViewSettings2.setDisplayZoomControls(WebView2, False)
WebView2.LoadUrl(Url)
Return True
Else If Url.IndexOf("mailto:") > -1 Then
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, Url)
StartActivity(Intent1)
Return True
Else
Return False
End If
End Sub
Sub JobDone (Job As HttpJob)
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
End Sub
Sub CanGoBack (wv As WebView) As Boolean
Dim r As Reflector
r.Target = wv
Return r.RunMethod("CanGoBack")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub