You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by vi...@apache.org on 2015/04/28 02:18:30 UTC
[1/4] cordova-plugin-splashscreen git commit: CB-8758 [wp8]:
UnauthorizedAccessException on hide()
Repository: cordova-plugin-splashscreen
Updated Branches:
refs/heads/CB-8860cordova-plugin-splashscreen fa60f01ad -> b7750760f
CB-8758 [wp8]: UnauthorizedAccessException on hide()
When calling hide() from JS, the attempt to access Popup could happen on
a background thread, which ends up throwing an
UnauthorizedAccessException about cross-thread access.
To address this, it's best to check the popup's state from within the UI
thread.
Fixes https://issues.apache.org/jira/browse/CB-8758
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/62e92afa
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/62e92afa
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/62e92afa
Branch: refs/heads/CB-8860cordova-plugin-splashscreen
Commit: 62e92afae80c648a8018bde4e2b71a1ebe8de1d9
Parents: fa60f01
Author: Dan Polivy <da...@cellartracker.com>
Authored: Thu Mar 26 11:52:10 2015 -0700
Committer: sgrebnov <v-...@microsoft.com>
Committed: Sat Apr 25 14:32:17 2015 -0700
----------------------------------------------------------------------
src/wp/SplashScreen.cs | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/62e92afa/src/wp/SplashScreen.cs
----------------------------------------------------------------------
diff --git a/src/wp/SplashScreen.cs b/src/wp/SplashScreen.cs
index feb4038..1c33c94 100644
--- a/src/wp/SplashScreen.cs
+++ b/src/wp/SplashScreen.cs
@@ -135,10 +135,9 @@ namespace WPCordovaClassLib.Cordova.Commands
public void show(string options = null)
{
-
- if (!popup.IsOpen)
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
{
- Deployment.Current.Dispatcher.BeginInvoke(() =>
+ if (!popup.IsOpen)
{
popup.Child.Opacity = 0;
@@ -162,17 +161,16 @@ namespace WPCordovaClassLib.Cordova.Commands
{
StartAutoHideTimer();
}
- });
- }
+ }
+ });
}
public void hide(string options = null)
{
- if (popup.IsOpen)
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
{
- Deployment.Current.Dispatcher.BeginInvoke(() =>
+ if (popup.IsOpen)
{
-
popup.Child.Opacity = 1.0;
Storyboard story = new Storyboard();
@@ -191,8 +189,8 @@ namespace WPCordovaClassLib.Cordova.Commands
popup.IsOpen = false;
};
story.Begin();
- });
- }
+ }
+ });
}
private void StartAutoHideTimer()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/4] cordova-plugin-splashscreen git commit: CB-8750 [wp8]: Allow
resolution-specific splashscreen images
Posted by vi...@apache.org.
CB-8750 [wp8]: Allow resolution-specific splashscreen images
There are two aspect ratios for Windows Phone devices: 15:9 and 16:9. At
the moment, though, there is only one splash screen by default for WP8
Cordova apps. When stretched to fit all possible resolutions, this can
sometimes look bad.
WP supports resolution-specific splashscreens, so this commit adds the
same support to the splashscreen plugin. It uses the same base name for
the splashscreen, but adds modifiers such as ".screen-<res>" based on
the device. If a screen-specific image is found, it is used. If not, we
fall back to the single default image.
Fixes https://issues.apache.org/jira/browse/CB-8750
github close #41
github close #42
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/9549ce3a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/9549ce3a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/9549ce3a
Branch: refs/heads/CB-8860cordova-plugin-splashscreen
Commit: 9549ce3a9df13d6ad19789debc27a41445bb43aa
Parents: 62e92af
Author: sgrebnov <v-...@microsoft.com>
Authored: Sat Apr 25 14:55:21 2015 -0700
Committer: sgrebnov <v-...@microsoft.com>
Committed: Sat Apr 25 14:55:21 2015 -0700
----------------------------------------------------------------------
plugin.xml | 4 ++-
src/wp/ResolutionHelper.cs | 60 +++++++++++++++++++++++++++++++++++++++++
src/wp/SplashScreen.cs | 59 +++++++++++++++++++++++++++++++++++-----
3 files changed, 115 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/9549ce3a/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index d684ae8..19f0e8e 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -58,7 +58,7 @@
<source-file src="src/android/SplashScreen.java" target-dir="src/org/apache/cordova/splashscreen" />
</platform>
-
+
<!-- ubuntu -->
<platform name="ubuntu">
<header-file src="src/ubuntu/splashscreen.h" />
@@ -98,6 +98,7 @@
</config-file>
<source-file src="src/wp/SplashScreen.cs" />
+ <source-file src="src/wp/ResolutionHelper.cs" />
</platform>
@@ -111,6 +112,7 @@
</config-file>
<source-file src="src/wp/SplashScreen.cs" />
+ <source-file src="src/wp/ResolutionHelper.cs" />
</platform>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/9549ce3a/src/wp/ResolutionHelper.cs
----------------------------------------------------------------------
diff --git a/src/wp/ResolutionHelper.cs b/src/wp/ResolutionHelper.cs
new file mode 100644
index 0000000..4d7996c
--- /dev/null
+++ b/src/wp/ResolutionHelper.cs
@@ -0,0 +1,60 @@
+/*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+using Microsoft.Phone.Info;
+using System;
+using System.Windows;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ public enum Resolutions { WVGA, WXGA, HD };
+
+ public static class ResolutionHelper
+ {
+ private static bool IsWvga
+ {
+ get
+ {
+ return Application.Current.Host.Content.ScaleFactor == 100;
+ }
+ }
+
+ private static bool IsWxga
+ {
+ get
+ {
+ return Application.Current.Host.Content.ScaleFactor == 160;
+ }
+ }
+
+ private static bool IsHD
+ {
+ get
+ {
+ return Application.Current.Host.Content.ScaleFactor == 150;
+ }
+ }
+
+ public static Resolutions CurrentResolution
+ {
+ get
+ {
+ if (IsWvga) return Resolutions.WVGA;
+ else if (IsWxga) return Resolutions.WXGA;
+ else if (IsHD) return Resolutions.HD;
+ else throw new InvalidOperationException("Unknown resolution");
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/9549ce3a/src/wp/SplashScreen.cs
----------------------------------------------------------------------
diff --git a/src/wp/SplashScreen.cs b/src/wp/SplashScreen.cs
index 1c33c94..680a805 100644
--- a/src/wp/SplashScreen.cs
+++ b/src/wp/SplashScreen.cs
@@ -1,10 +1,10 @@
-/*
+/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@ namespace WPCordovaClassLib.Cordova.Commands
private Popup popup;
// Time until we dismiss the splashscreen
- private int prefDelay = 3000;
+ private int prefDelay = 3000;
// Whether we hide it by default
private bool prefAutoHide = true;
@@ -66,8 +66,7 @@ namespace WPCordovaClassLib.Cordova.Commands
Stretch = Stretch.Fill
};
- Uri imagePath = new Uri(prefImagePath, UriKind.RelativeOrAbsolute);
- var imageResource = Application.GetResourceStream(imagePath);
+ var imageResource = GetSplashScreenImageResource();
if (imageResource != null)
{
BitmapImage splash_image = new BitmapImage();
@@ -76,7 +75,7 @@ namespace WPCordovaClassLib.Cordova.Commands
}
// Instansiate the popup and set the Child property of Popup to SplashScreen
- popup = new Popup() { IsOpen = false,
+ popup = new Popup() { IsOpen = false,
Child = SplashScreen,
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Center
@@ -133,6 +132,52 @@ namespace WPCordovaClassLib.Cordova.Commands
}
}
+ private StreamResourceInfo GetSplashScreenImageResource()
+ {
+ // Get the base filename for the splash screen images
+ string imageName = System.IO.Path.GetFileNameWithoutExtension(prefImagePath);
+ Uri imageUri = null;
+ StreamResourceInfo imageResource = null;
+
+ // First, try to get a resolution-specific splashscreen
+ try
+ {
+ // Determine the device's resolution
+ switch (ResolutionHelper.CurrentResolution)
+ {
+ case Resolutions.HD:
+ imageUri = new Uri(imageName + ".screen-720p.jpg", UriKind.Relative);
+ break;
+
+ case Resolutions.WVGA:
+ imageUri = new Uri(imageName + ".screen-WVGA.jpg", UriKind.Relative);
+ break;
+
+ case Resolutions.WXGA:
+ default:
+ imageUri = new Uri(imageName + ".screen-WXGA.jpg", UriKind.Relative);
+ break;
+ }
+
+ imageResource = Application.GetResourceStream(imageUri);
+ }
+ catch (Exception)
+ {
+ // It's OK if we didn't get a resolution-specific image
+ }
+
+ // Fallback to the default image name without decoration
+ if (imageResource == null)
+ {
+ imageUri = new Uri(prefImagePath, UriKind.Relative);
+ imageResource = Application.GetResourceStream(imageUri);
+ }
+
+ if (imageUri != null) Debug.WriteLine("INFO :: SplashScreen: using image {0}", imageUri.OriginalString);
+
+ return imageResource;
+ }
+
public void show(string options = null)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/4] cordova-plugin-splashscreen git commit: CB-8750 [wp8]: Rewrite
resoultion helper
Posted by vi...@apache.org.
CB-8750 [wp8]: Rewrite resoultion helper
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/00e8999e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/00e8999e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/00e8999e
Branch: refs/heads/CB-8860cordova-plugin-splashscreen
Commit: 00e8999eeb03291baef71b5e1b1ce380e12f0449
Parents: 9549ce3
Author: sgrebnov <v-...@microsoft.com>
Authored: Sat Apr 25 14:56:39 2015 -0700
Committer: sgrebnov <v-...@microsoft.com>
Committed: Sat Apr 25 14:56:39 2015 -0700
----------------------------------------------------------------------
src/wp/ResolutionHelper.cs | 39 +++++++++------------------------------
1 file changed, 9 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/00e8999e/src/wp/ResolutionHelper.cs
----------------------------------------------------------------------
diff --git a/src/wp/ResolutionHelper.cs b/src/wp/ResolutionHelper.cs
index 4d7996c..050c392 100644
--- a/src/wp/ResolutionHelper.cs
+++ b/src/wp/ResolutionHelper.cs
@@ -21,39 +21,18 @@ namespace WPCordovaClassLib.Cordova.Commands
public enum Resolutions { WVGA, WXGA, HD };
public static class ResolutionHelper
- {
- private static bool IsWvga
+ {
+ public static Resolutions CurrentResolution
{
get
{
- return Application.Current.Host.Content.ScaleFactor == 100;
- }
- }
-
- private static bool IsWxga
- {
- get
- {
- return Application.Current.Host.Content.ScaleFactor == 160;
- }
- }
-
- private static bool IsHD
- {
- get
- {
- return Application.Current.Host.Content.ScaleFactor == 150;
- }
- }
-
- public static Resolutions CurrentResolution
- {
- get
- {
- if (IsWvga) return Resolutions.WVGA;
- else if (IsWxga) return Resolutions.WXGA;
- else if (IsHD) return Resolutions.HD;
- else throw new InvalidOperationException("Unknown resolution");
+ switch (Application.Current.Host.Content.ScaleFactor)
+ {
+ case 100: return Resolutions.WVGA;
+ case 160: return Resolutions.WXGA;
+ case 150: return Resolutions.HD;
+ }
+ throw new InvalidOperationException("Unknown resolution");
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[4/4] cordova-plugin-splashscreen git commit: Removed wp7 from
plugin.xml and package.json
Posted by vi...@apache.org.
Removed wp7 from plugin.xml and package.json
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/commit/b7750760
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/b7750760
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/b7750760
Branch: refs/heads/CB-8860cordova-plugin-splashscreen
Commit: b7750760f40c22034c311df94eb46ed216f96f12
Parents: 00e8999
Author: sgrebnov <v-...@microsoft.com>
Authored: Sat Apr 25 14:58:11 2015 -0700
Committer: sgrebnov <v-...@microsoft.com>
Committed: Sat Apr 25 14:58:11 2015 -0700
----------------------------------------------------------------------
package.json | 2 --
plugin.xml | 14 --------------
2 files changed, 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/b7750760/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 7432794..688aca9 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,6 @@
"ubuntu",
"ios",
"blackberry10",
- "wp7",
"wp8",
"windows8",
"windows",
@@ -30,7 +29,6 @@
"cordova-ubuntu",
"cordova-ios",
"cordova-blackberry10",
- "cordova-wp7",
"cordova-wp8",
"cordova-windows8",
"cordova-windows",
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/b7750760/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 19f0e8e..d054cc6 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -88,20 +88,6 @@
</config-file>
</platform>
- <!-- wp7 -->
- <platform name="wp7">
- <config-file target="config.xml" parent="/*">
- <feature name="SplashScreen">
- <param name="wp-package" value="SplashScreen"/>
- <param name="onload" value="true"/>
- </feature>
- </config-file>
-
- <source-file src="src/wp/SplashScreen.cs" />
- <source-file src="src/wp/ResolutionHelper.cs" />
-
- </platform>
-
<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org