Repository: cordova-windows Updated Branches: refs/heads/master c3fdf80e9 -> 83c427265
CB-6309 Windows8. Add Splash Screen img support via config.xml preference, CB-6544 SplashScreenBackgroundColor, CB-6545 support multiple preferences Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/83c42726 Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/83c42726 Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/83c42726 Branch: refs/heads/master Commit: 83c42726510fdc7ea46a418a0d2cb366e5ee807a Parents: c3fdf80 Author: Jesse MacFadyen <[email protected]> Authored: Mon Apr 28 19:12:28 2014 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Mon Apr 28 19:12:28 2014 -0700 ---------------------------------------------------------------------- .../cordova/lib/ApplyPlatformConfig.ps1 | 48 ++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/83c42726/windows8/template/cordova/lib/ApplyPlatformConfig.ps1 ---------------------------------------------------------------------- diff --git a/windows8/template/cordova/lib/ApplyPlatformConfig.ps1 b/windows8/template/cordova/lib/ApplyPlatformConfig.ps1 index df9cbed..5fc432e 100644 --- a/windows8/template/cordova/lib/ApplyPlatformConfig.ps1 +++ b/windows8/template/cordova/lib/ApplyPlatformConfig.ps1 @@ -22,7 +22,7 @@ param( [string] $platformRoot ) -Write-Host "Applying Platform Config" +Write-Host "Applying Platform Config ..." $configFile = "$platformRoot\config.xml" $manifestFile = "$platformRoot\package.appxmanifest" @@ -59,10 +59,52 @@ if ($acls -and ($acls -notcontains "*")) { } } +# Format splash screen to windows8 format +$configSplashScreen = $config.SelectNodes('//*[local-name()="preference"][@name="SplashScreen"]').value +if($configSplashScreen) +{ + "Setting SplashScreen = $configSplashScreen" + $manifest.Package.Applications.Application.VisualElements.SplashScreen.Image = [string]$configSplashScreen + +} + +# Format splash screen background color to windows8 format +$configSplashScreenBGColor = $config.SelectNodes('//*[local-name()="preference"][@name="SplashScreenBackgroundColor"]').value +if($configSplashScreenBGColor) +{ + "Setting SplashScreenBackgroundColor = $configSplashScreenBGColor" + + $bgColor = ($configSplashScreenBGColor -replace "0x", "") -replace "#", "" + + # Double all bytes if color specified as "fff" + if ($bgColor.Length -eq 3) { + $bgColor = $bgColor[0] + $bgColor[0] + $bgColor[1] + $bgColor[1] + $bgColor[2] + $bgColor[2] + } + + # Parse hex representation to array of color bytes [b, g, r, a] + $colorBytes = [System.BitConverter]::GetBytes( + [int]::Parse($bgColor, + [System.Globalization.NumberStyles]::HexNumber)) + + Add-Type -AssemblyName PresentationCore + + # Create new Color object ignoring alpha, because windows 8 doesn't support it + # see http://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx + $color = ([System.Windows.Media.Color]::FromRgb( + $colorBytes[2], $colorBytes[1], $colorBytes[0] + # FromRGB method add 100% alpha, so we remove it from resulting string + ).ToString()) -replace "#FF", "#" + + $manifest.Package.Applications.Application.VisualElements.SplashScreen.BackgroundColor = [string]$color +} + + # Format background color to windows8 format -$configBgColor = [string]$config.widget.preference.value -if($configBgColor.Length > 0) +$configBgColor = $config.SelectNodes('//*[local-name()="preference"][@name="BackgroundColor"]').value + +if($configBgColor) { + "Setting BackgroundColor = $configBgColor" $bgColor = ($configBgColor -replace "0x", "") -replace "#", "" # Double all bytes if color specified as "fff"
