fix formatting
This commit is contained in:
parent
fb0764c528
commit
2b5187b909
@ -82,11 +82,16 @@
|
|||||||
NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
|
NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
|
||||||
UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
|
UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
|
||||||
|
|
||||||
if ([topActivityIndicator isEqualToString:@"whiteLarge"]) {
|
if ([topActivityIndicator isEqualToString:@"whiteLarge"])
|
||||||
|
{
|
||||||
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge;
|
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge;
|
||||||
} else if ([topActivityIndicator isEqualToString:@"white"]) {
|
}
|
||||||
|
else if ([topActivityIndicator isEqualToString:@"white"])
|
||||||
|
{
|
||||||
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite;
|
topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite;
|
||||||
} else if ([topActivityIndicator isEqualToString:@"gray"]) {
|
}
|
||||||
|
else if ([topActivityIndicator isEqualToString:@"gray"])
|
||||||
|
{
|
||||||
topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
|
topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +109,8 @@
|
|||||||
|
|
||||||
id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
|
id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
|
||||||
// backwards compatibility - if key is missing, default to true
|
// backwards compatibility - if key is missing, default to true
|
||||||
if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) {
|
if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue])
|
||||||
|
{
|
||||||
[parentView addSubview:_activityView];
|
[parentView addSubview:_activityView];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,21 +179,33 @@
|
|||||||
// this means there are no mixed orientations in there
|
// this means there are no mixed orientations in there
|
||||||
BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape);
|
BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape);
|
||||||
|
|
||||||
if (imageName) {
|
if (imageName)
|
||||||
|
{
|
||||||
imageName = [imageName stringByDeletingPathExtension];
|
imageName = [imageName stringByDeletingPathExtension];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
imageName = @"Default";
|
imageName = @"Default";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device.iPhone5) { // does not support landscape
|
if (device.iPhone5)
|
||||||
|
{ // does not support landscape
|
||||||
imageName = [imageName stringByAppendingString:@"-568h"];
|
imageName = [imageName stringByAppendingString:@"-568h"];
|
||||||
} else if (device.iPhone6) { // does not support landscape
|
}
|
||||||
|
else if (device.iPhone6)
|
||||||
|
{ // does not support landscape
|
||||||
imageName = [imageName stringByAppendingString:@"-667h"];
|
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" : @"")];
|
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
|
||||||
} else {
|
}
|
||||||
switch (currentOrientation) {
|
else
|
||||||
|
{
|
||||||
|
switch (currentOrientation)
|
||||||
|
{
|
||||||
case UIInterfaceOrientationLandscapeLeft:
|
case UIInterfaceOrientationLandscapeLeft:
|
||||||
case UIInterfaceOrientationLandscapeRight:
|
case UIInterfaceOrientationLandscapeRight:
|
||||||
imageName = [imageName stringByAppendingString:@"-Landscape"];
|
imageName = [imageName stringByAppendingString:@"-Landscape"];
|
||||||
@ -198,11 +216,17 @@
|
|||||||
}
|
}
|
||||||
imageName = [imageName stringByAppendingString:@"-736h"];
|
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")];
|
imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")];
|
||||||
} else {
|
}
|
||||||
switch (currentOrientation) {
|
else
|
||||||
|
{
|
||||||
|
switch (currentOrientation)
|
||||||
|
{
|
||||||
case UIInterfaceOrientationLandscapeLeft:
|
case UIInterfaceOrientationLandscapeLeft:
|
||||||
case UIInterfaceOrientationLandscapeRight:
|
case UIInterfaceOrientationLandscapeRight:
|
||||||
imageName = [imageName stringByAppendingString:@"-Landscape"];
|
imageName = [imageName stringByAppendingString:@"-Landscape"];
|
||||||
@ -225,16 +249,20 @@
|
|||||||
{
|
{
|
||||||
NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
|
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];
|
UIImage* img = [UIImage imageNamed:imageName];
|
||||||
_imageView.image = img;
|
_imageView.image = img;
|
||||||
_curImageName = imageName;
|
_curImageName = imageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that splash screen's image exists before updating bounds
|
// Check that splash screen's image exists before updating bounds
|
||||||
if (_imageView.image) {
|
if (_imageView.image)
|
||||||
|
{
|
||||||
[self updateBounds];
|
[self updateBounds];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
|
NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,26 +282,34 @@
|
|||||||
* correctly.
|
* correctly.
|
||||||
*/
|
*/
|
||||||
BOOL isIPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
|
BOOL isIPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
|
||||||
if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad) {
|
if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad)
|
||||||
|
{
|
||||||
imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
|
imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
|
||||||
imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width);
|
imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There's a special case when the image is the size of the screen.
|
// 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];
|
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;
|
imgBounds.origin.y -= statusFrame.size.height;
|
||||||
}
|
}
|
||||||
} else if (imgBounds.size.width > 0) {
|
}
|
||||||
|
else if (imgBounds.size.width > 0)
|
||||||
|
{
|
||||||
CGRect viewBounds = self.viewController.view.bounds;
|
CGRect viewBounds = self.viewController.view.bounds;
|
||||||
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
|
CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
|
||||||
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
|
CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
|
||||||
// This matches the behaviour of the native splash screen.
|
// This matches the behaviour of the native splash screen.
|
||||||
CGFloat ratio;
|
CGFloat ratio;
|
||||||
if (viewAspect > imgAspect) {
|
if (viewAspect > imgAspect)
|
||||||
|
{
|
||||||
ratio = viewBounds.size.width / imgBounds.size.width;
|
ratio = viewBounds.size.width / imgBounds.size.width;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ratio = viewBounds.size.height / imgBounds.size.height;
|
ratio = viewBounds.size.height / imgBounds.size.height;
|
||||||
}
|
}
|
||||||
imgBounds.size.height *= ratio;
|
imgBounds.size.height *= ratio;
|
||||||
@ -286,8 +322,8 @@
|
|||||||
|
|
||||||
- (void)setVisible:(BOOL)visible
|
- (void)setVisible:(BOOL)visible
|
||||||
{
|
{
|
||||||
if (visible != _visible) {
|
if (visible != _visible)
|
||||||
|
{
|
||||||
_visible = visible;
|
_visible = visible;
|
||||||
|
|
||||||
id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
|
id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
|
||||||
@ -295,11 +331,11 @@
|
|||||||
|
|
||||||
float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
|
float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
|
||||||
|
|
||||||
if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue]) {
|
if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue])
|
||||||
|
{
|
||||||
fadeDuration = 0;
|
fadeDuration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_visible)
|
if (_visible)
|
||||||
{
|
{
|
||||||
if (_imageView == nil)
|
if (_imageView == nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user