Permalink
Browse files

Merge pull request #41 from blackberry-webworks/next

Synced main repo from working repo.
  • Loading branch information...
2 parents d8afc42 + 2b89fa4 commit 5046033b6a20be5294562ebfdc83f5b6374e2b0e Chris DelCol (RIM) committed Sep 29, 2011
Showing with 27 additions and 0 deletions.
  1. +22 −0 framework/src/WebWorksAppTemplate.as
  2. +5 −0 framework/src/webworks/webkit/WebkitControl.as
@@ -42,6 +42,8 @@ package
import webworks.service.ServiceManager;
import webworks.webkit.WebkitControl;
import webworks.webkit.WebkitEvent;
+
+ import flash.events.TimerEvent;
[SWF(width="1024", height="600", frameRate="30", backgroundColor="#000000")]
public class WebWorksAppTemplate extends Sprite
@@ -58,6 +60,8 @@ package
private var _broker:FunctionBroker;
private var _serviceManager:ServiceManager;
+ private var _loadingScreenTimer:Timer;
+
public function WebWorksAppTemplate()
{
if (stage) {
@@ -112,6 +116,7 @@ package
_transitions = new Transitions(_loadingScreen, _webWindow.viewPort);
_serviceManager = new ServiceManager(_webWindow);
_broker = new FunctionBroker(_webWindow.qnxWebView, _serviceManager);
+ _loadingScreenTimer = null;
var configProperties:Dictionary = ConfigData.getInstance().properties;
configProperties["serviceManager"] = _serviceManager;
@@ -234,6 +239,23 @@ package
private function tabLoadComplete(event:WebkitEvent):void
{
trace("HTML LOAD DONE");
+
+ var onFirstLaunch:Boolean = ConfigData.getInstance().getProperty(ConfigConstants.ONFIRSTLAUNCH)
+ if (_webWindow.qnxWebView.visible) {
+ _loadingScreen.hideIfNecessary();
+ } else {
+ // if the WebView is invisible, it means it's set to hidden in order to hide the white flicker;
+ // we can set the visibility to true but we shouldn't show it (by hiding the loading screen) right now;
+ // insteadly, we need a timer to hide the loading screen after the visibility change;
+ // because if not, we will still see the white flicker.
+ _webWindow.qnxWebView.visible = true;
+ _loadingScreenTimer = new Timer(400, 1);
+ _loadingScreenTimer.addEventListener(TimerEvent.TIMER, runOnce);
+ _loadingScreenTimer.start();
+ }
+ }
+
+ private function runOnce(event:TimerEvent):void {
_loadingScreen.hideIfNecessary();
}
@@ -100,6 +100,11 @@ package webworks.webkit
{
var wv:QNXStageWebView = new QNXStageWebView();
+ // if onFirstLaunch is true, we need hide the QNXStageWebView to hide the white flicker from it
+ if (ConfigData.getInstance().getProperty(ConfigConstants.ONFIRSTLAUNCH)) {
+ wv.visible = false;
+ }
+
//Apply default properties
for(var webViewProp:String in defaultSettings) {
trace("Applying QNXStageWebView property: " + webViewProp + " = " + defaultSettings[webViewProp]);

0 comments on commit 5046033

Please sign in to comment.