'first picture load (huge picture 26000 x 250 pixels, 8bit color)
wv.LoadHtml("<html><body> <img src=" & QUOTE & "file://" & Notes & QUOTE & " id='img1' ></body></html>")
....
Sub wv_PageFinished (Url As String)
If Flag = 0 Then 'first picture load
Flag = 1
Do_JS("document.getElementById(" & QUOTE & "img1" & QUOTE & ").naturalHeight")
wait for Show_result(res As String)
ImgHeight = res
Rate = hsv.Height/ImgHeight 'hsv is Horizontalscrollview containing the Webview
Do_JS("document.getElementById(" & QUOTE & "img1" & QUOTE & ").naturalWidth")
wait for Show_result(res As String)
ImgWidth = res
hsv.Panel.Width = ImgWidth * Rate
wv.Width = ImgWidth * Rate
pnl.Width = ImgWidth * Rate ' pnl is a panel over Webview to prevent vertical swipes over Webview - that would lead to the app crash.
'second reloading picture when the webview size it pre-set
wv.LoadHtml("<html><body> <img src=" & QUOTE & "file://" & Notes & QUOTE & " id='img1' ></body></html>")
Else 'second picture loading
ProgressDialogHide 'finish second picture loading
Log("stop")
End If
End Sub
Sub Do_JS (JS As String)
Dim Javascript As String
Javascript="B4A.CallSub('Process_HTML', true, " & JS & ")"
WebViewExtras1.executeJavascript(Javascript)
End Sub
Sub Process_HTML(Html As String)
' This is the Sub that we'll get the web page to send it's HTML content to
' Log may truncate a large page so you'll not see all of the HTML in the log but the 'html' String should still contain all of the web page HTML
CallSubDelayed2(Me, "Show_result", Html)
End Sub
'and the main - set zoom to see the picture maximally filling the screen
Sub lblAction_Click
WebViewExtras1.SetInitialScale(100 * Rate)
hsv.Visible = True
End Sub