You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2015/10/06 02:24:56 UTC
[2/3] cordova-plugin-splashscreen git commit: fix formatting
fix formatting
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/2b5187b9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/tree/2b5187b9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/diff/2b5187b9
Branch: refs/heads/master
Commit: 2b5187b90926f13e339765a926548db482eddcb1
Parents: fb0764c
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Oct 5 17:20:57 2015 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Oct 5 17:20:57 2015 -0700
----------------------------------------------------------------------
src/ios/CDVSplashScreen.m | 94 +++++++++++++++++++++++++++++-------------
1 file changed, 65 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen/blob/2b5187b9/src/ios/CDVSplashScreen.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSplashScreen.m b/src/ios/CDVSplashScreen.m
index 72e75ff..35c10fe 100644
--- a/src/ios/CDVSplashScreen.m
+++ b/src/ios/CDVSplashScreen.m
@@ -82,11 +82,16 @@
NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
- if ([topActivityIndicator isEqualToString:@"whiteLarge"]) {
+ if ([topActivityIndicator isEqualToString:@"whiteLarge"])
+ {
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge;
- } else if ([topActivityIndicator isEqualToString:@"white"]) {
+ }
+ else if ([topActivityIndicator isEqualToString:@"white"])
+ {
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite;
- } else if ([topActivityIndicator isEqualToString:@"gray"]) {
+ }
+ else if ([topActivityIndicator isEqualToString:@"gray"])
+ {
topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
}
@@ -104,7 +109,8 @@
id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
// backwards compatibility - if key is missing, default to true
- if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) {
+ if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue])
+ {
[parentView addSubview:_activityView];
}
@@ -173,21 +179,33 @@
// this means there are no mixed orientations in there
BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape);
- if (imageName) {
+ if (imageName)
+ {
imageName = [imageName stringByDeletingPathExtension];
- } else {
+ }
+ else
+ {
imageName = @"Default";
}
- if (device.iPhone5) { // does not support landscape
+ if (device.iPhone5)
+ { // does not support landscape
imageName = [imageName stringByAppendingString:@"-568h"];
- } else if (device.iPhone6) { // does not support landscape
+ }
+ else if (device.iPhone6)
+ { // does not support landscape
imageName = [imageName stringByAppendingString:@"-667h"];
- } else if (device.iPhone6Plus) { // supports landscape
- if (isOrientationLocked) {
+ }
+ else if (device.iPhone6Plus)
+ { // supports landscape
+ if (isOrientationLocked)
+ {
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
- } else {
- switch (currentOrientation) {
+ }
+ else
+ {
+ switch (currentOrientation)
+ {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
@@ -198,11 +216,17 @@
}
imageName = [imageName stringByAppendingString:@"-736h"];
- } else if (device.iPad) { // supports landscape
- if (isOrientationLocked) {
+ }
+ else if (device.iPad)
+ { // supports landscape
+ if (isOrientationLocked)
+ {
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")];
- } else {
- switch (currentOrientation) {
+ }
+ else
+ {
+ switch (currentOrientation)
+ {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
imageName = [imageName stringByAppendingString:@"-Landscape"];
@@ -225,16 +249,20 @@
{
NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
- if (![imageName isEqualToString:_curImageName]) {
+ if (![imageName isEqualToString:_curImageName])
+ {
UIImage* img = [UIImage imageNamed:imageName];
_imageView.image = img;
_curImageName = imageName;
}
// Check that splash screen's image exists before updating bounds
- if (_imageView.image) {
+ if (_imageView.image)
+ {
[self updateBounds];
- } else {
+ }
+ else
+ {
NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
}
}
@@ -254,26 +282,34 @@
* correctly.
*/
BOOL isIPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
- if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad) {
+ if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad)
+ {
imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width);
}
// There's a special case when the image is the size of the screen.
- if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
+ if (CGSizeEqualToSize(screenSize, imgBounds.size))
+ {
CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
- if (!(IsAtLeastiOSVersion(@"7.0"))) {
+ if (!(IsAtLeastiOSVersion(@"7.0")))
+ {
imgBounds.origin.y -= statusFrame.size.height;
}
- } else if (imgBounds.size.width > 0) {
+ }
+ else if (imgBounds.size.width > 0)
+ {
CGRect viewBounds = self.viewController.view.bounds;
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
// This matches the behaviour of the native splash screen.
CGFloat ratio;
- if (viewAspect > imgAspect) {
+ if (viewAspect > imgAspect)
+ {
ratio = viewBounds.size.width / imgBounds.size.width;
- } else {
+ }
+ else
+ {
ratio = viewBounds.size.height / imgBounds.size.height;
}
imgBounds.size.height *= ratio;
@@ -286,8 +322,8 @@
- (void)setVisible:(BOOL)visible
{
- if (visible != _visible) {
-
+ if (visible != _visible)
+ {
_visible = visible;
id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
@@ -295,10 +331,10 @@
float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
- if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue]) {
+ if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue])
+ {
fadeDuration = 0;
}
-
if (_visible)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org