cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject git commit: ConfigHandler handles config.xml feature+plugin tags, removed rotation animation because it was causing canvas to slow down slightly - just a quick fade now
Date Wed, 15 May 2013 21:15:29 GMT
Updated Branches:
  refs/heads/master bd0fc7300 -> c47376b91


ConfigHandler handles config.xml feature+plugin tags, removed rotation animation because it
was causing canvas to slow down slightly - just a quick fade now


Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/c47376b9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/c47376b9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/c47376b9

Branch: refs/heads/master
Commit: c47376b910fa4452a239510dc193ce4f85d1ee04
Parents: bd0fc73
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Wed May 15 14:14:11 2013 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Wed May 15 14:14:11 2013 -0700

----------------------------------------------------------------------
 templates/standalone/cordovalib/ConfigHandler.cs   |   80 ++++++++++-----
 templates/standalone/cordovalib/CordovaView.xaml   |   18 ++--
 .../standalone/cordovalib/CordovaView.xaml.cs      |   12 +--
 3 files changed, 65 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/c47376b9/templates/standalone/cordovalib/ConfigHandler.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/ConfigHandler.cs b/templates/standalone/cordovalib/ConfigHandler.cs
index 95c6663..98d740b 100644
--- a/templates/standalone/cordovalib/ConfigHandler.cs
+++ b/templates/standalone/cordovalib/ConfigHandler.cs
@@ -29,7 +29,7 @@ namespace WPCordovaClassLib.CordovaLib
         protected List<string> AllowedDomains;
         protected Dictionary<string, string> Preferences;
 
-        public Dictionary<string, string> Content { get; private set; }
+        public string ContentSrc { get; private set; }
 
 
         protected bool AllowAllDomains = false;
@@ -40,7 +40,6 @@ namespace WPCordovaClassLib.CordovaLib
             AllowedPlugins = new Dictionary<string, PluginConfig>();
             AllowedDomains = new List<string>();
             Preferences = new Dictionary<string, string>();
-            Content = new Dictionary<string, string>();
         }
 
         public string GetPreference(string key)
@@ -178,6 +177,52 @@ namespace WPCordovaClassLib.CordovaLib
             }
         }
 
+        private void LoadPluginFeatures(XDocument document)
+        {
+            var plugins = from results in document.Descendants("plugin")
+                          select new
+                          {
+                              name = (string)results.Attribute("name"),
+                              autoLoad = results.Attribute("onload")
+                          };
+
+            foreach (var plugin in plugins)
+            {
+                Debug.WriteLine("plugin " + plugin.name);
+                PluginConfig pConfig = new PluginConfig(plugin.name, plugin.autoLoad != null
&& plugin.autoLoad.Value == "true");
+                if (pConfig.Name == "*")
+                {
+                    AllowAllPlugins = true;
+                    // break; wait, don't, some still could be autoload
+                }
+                else
+                {
+                    AllowedPlugins[pConfig.Name] = pConfig;
+                }
+            }
+
+            var features = document.Descendants("feature");
+    
+
+            foreach (var feature in features)
+            {
+                var name = feature.Attribute("name");
+                var values = from results in feature.Descendants("param")
+                             where ((string)results.Attribute("name") == "wp-package")
+                             select results;
+
+                var value = values.FirstOrDefault();
+                if(value != null)
+                {
+                    string key = (string)value.Attribute("value");
+                    Debug.WriteLine("Adding feature.value=" + key);
+                    var onload = value.Attribute("onload");
+                    PluginConfig pConfig = new PluginConfig(key,onload != null &&
onload.Value == "true");
+                    AllowedPlugins[key] = pConfig;
+                }
+            }
+        }
+
 
         public void LoadAppPackageConfig()
         {
@@ -189,27 +234,9 @@ namespace WPCordovaClassLib.CordovaLib
                 //This will Read Keys Collection for the xml file
                 XDocument document = XDocument.Parse(sr.ReadToEnd());
 
-                var plugins = from results in document.Descendants("plugin")
-                              select new
-                              {
-                                  name = (string)results.Attribute("name"),
-                                  autoLoad = results.Attribute("onload")
-                              };
+                LoadPluginFeatures(document);
+
 
-                foreach (var plugin in plugins)
-                {
-                    Debug.WriteLine("plugin " + plugin.name);
-                    PluginConfig pConfig = new PluginConfig(plugin.name, plugin.autoLoad
!= null && plugin.autoLoad.Value == "true");
-                    if (pConfig.Name == "*")
-                    {
-                        AllowAllPlugins = true;
-                        // break; wait, don't, some still could be autoload
-                    }
-                    else
-                    {
-                        AllowedPlugins.Add(pConfig.Name, pConfig);
-                    }
-                }
 
                 var preferences = from results in document.Descendants("preference")
                                   select new
@@ -235,12 +262,11 @@ namespace WPCordovaClassLib.CordovaLib
                     AddWhiteListEntry(accessElem.origin, accessElem.subdomains);
                 }
 
-                var contentsTag = document.Descendants("content");
-                if (contentsTag.Count() > 0)
+                var contentsTag = document.Descendants("content").FirstOrDefault();
+                if (contentsTag != null)
                 {
-                    var first = contentsTag.First();                    
-                    var src = first.Attribute("src");
-                    Content.Add("src", src.Value);
+                    var src = contentsTag.Attribute("src");
+                    ContentSrc = (string)src.Value;
                 }
             }
             else

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/c47376b9/templates/standalone/cordovalib/CordovaView.xaml
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/CordovaView.xaml b/templates/standalone/cordovalib/CordovaView.xaml
index 41d7631..fce54bb 100644
--- a/templates/standalone/cordovalib/CordovaView.xaml
+++ b/templates/standalone/cordovalib/CordovaView.xaml
@@ -31,7 +31,7 @@
     <Grid x:Name="LayoutRoot" Background="Transparent">
         
         <phone:WebBrowser x:Name="CordovaBrowser" 
-                          Opacity="0"
+                          Opacity="0.0"
                           HorizontalAlignment="Stretch"  
                           VerticalAlignment="Stretch" 
                           IsScriptEnabled="True" 
@@ -45,15 +45,13 @@
                           Navigating="CordovaBrowser_Navigating" 
                           NavigationFailed="CordovaBrowser_NavigationFailed" 
                           IsGeolocationEnabled="True">
-            <phone:WebBrowser.Projection>
-                <PlaneProjection x:Name="BrowserProjector" CenterOfRotationX="0" RotationY="-180"/>
-            </phone:WebBrowser.Projection>
-            <phone:WebBrowser.Resources>
-                <Storyboard x:Name="RotateIn" BeginTime="0:0:0.5">
-                    <DoubleAnimation
-                        Storyboard.TargetName="BrowserProjector"
-                        Storyboard.TargetProperty="RotationY"
-                        To="0" Duration="0:0:0.6"/>
+
+            <phone:WebBrowser.Resources>      
+                <Storyboard x:Name="FadeIn">
+                    <DoubleAnimation Duration="0:0:0.6" 
+                            To="1.0"
+                            Storyboard.TargetName="CordovaBrowser" 
+                            Storyboard.TargetProperty="Opacity"/>
                 </Storyboard>
             </phone:WebBrowser.Resources>
 

http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/c47376b9/templates/standalone/cordovalib/CordovaView.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/CordovaView.xaml.cs b/templates/standalone/cordovalib/CordovaView.xaml.cs
index 5bb92b1..bdd4d62 100644
--- a/templates/standalone/cordovalib/CordovaView.xaml.cs
+++ b/templates/standalone/cordovalib/CordovaView.xaml.cs
@@ -163,12 +163,9 @@ namespace WPCordovaClassLib
             configHandler = new ConfigHandler();
             configHandler.LoadAppPackageConfig();
 
-            if (configHandler.Content.ContainsKey("src"))
+            if (configHandler.ContentSrc != null)
             {
-                var src = configHandler.Content["src"];
-                {
-                    this.StartPageUri = new Uri(src);
-                }
+                //this.StartPageUri = new Uri(configHandler.ContentSrc);
             }         
 
             nativeExecution = new NativeExecution(ref this.CordovaBrowser);
@@ -391,7 +388,7 @@ namespace WPCordovaClassLib
             string[] autoloadPlugs = this.configHandler.AutoloadPlugins;
             foreach (string plugName in autoloadPlugs)
             {
-               // nativeExecution.ProcessCommand(commandCallParams); 
+               //nativeExecution.ProcessCommand(commandCallParams); 
             }
 
             string nativeReady = "(function(){ cordova.require('cordova/channel').onNativeReady.fire()})();";
@@ -407,8 +404,7 @@ namespace WPCordovaClassLib
 
             if (this.CordovaBrowser.Opacity < 1)
             {
-                this.CordovaBrowser.Opacity = 1;
-                RotateIn.Begin();
+                FadeIn.Begin();
             }
         }
 


Mime
View raw message