Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Fix for performance issue with WebViews #442

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

scottrules44
Copy link
Contributor

Fix for Issue #287,
There is a slight performance issue with Android WebViews when "alpha" property is used before the page has loaded
See example below

`function showWebView(URL)
local loadingMessage, webView = nil, nil
local x, y = display.safeScreenOriginX + display.safeActualContentWidth/2, display.safeScreenOriginY + display.safeActualContentHeight/2

local function webListener( event )
if event.type == "loaded" then

  transition.to( webView, { time = 600, alpha = 1 } )
  transition.to( loadingMessage, { time = 400, alpha = 0 } )
end

end

loadingMessage = display.newText({parent = webPopup, text = "LOADING PLEASE WAIT....", x = x, y = y, width = 400, font = native.systemFontBold, fontSize = 15, align = "left"})

webView = native.newWebView( x, y, display.safeActualContentWidth, display.safeActualContentHeight )
webView:request( URL )
webView.alpha = 0
webView:addEventListener( "urlRequest", webListener )
end

showWebView("https://catinfo.org")`

@scottrules44 scottrules44 requested a review from Shchvova as a code owner August 29, 2022 21:09
@scottrules44 scottrules44 changed the title Android: Fix for performance issue on WebViews Android: Fix for performance issue with WebViews Aug 29, 2022
@Shchvova Shchvova merged commit 08d0414 into coronalabs:master Aug 30, 2022
@scottrules44 scottrules44 deleted the AndroidWebviewAlphaFix branch October 30, 2022 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants