diff --git a/VoidLink/.DS_Store b/VoidLink/.DS_Store index a37c9cc1..af91099b 100644 Binary files a/VoidLink/.DS_Store and b/VoidLink/.DS_Store differ diff --git a/VoidLink/Images.xcassets/icon-pc-app.imageset/Contents.json b/VoidLink/Images.xcassets/icon-pc-app.imageset/Contents.json new file mode 100644 index 00000000..3a3cb79a --- /dev/null +++ b/VoidLink/Images.xcassets/icon-pc-app.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "icon-pc-app.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/VoidLink/Images.xcassets/icon-pc-app.imageset/icon-pc-app.svg b/VoidLink/Images.xcassets/icon-pc-app.imageset/icon-pc-app.svg new file mode 100644 index 00000000..04e56c40 --- /dev/null +++ b/VoidLink/Images.xcassets/icon-pc-app.imageset/icon-pc-app.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/VoidLink/Images.xcassets/play.circle.fill.imageset/Contents.json b/VoidLink/Images.xcassets/play.circle.fill.imageset/Contents.json new file mode 100644 index 00000000..53dcb23d --- /dev/null +++ b/VoidLink/Images.xcassets/play.circle.fill.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play.circle.fill.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/VoidLink/Images.xcassets/play.circle.fill.imageset/play.circle.fill.svg b/VoidLink/Images.xcassets/play.circle.fill.imageset/play.circle.fill.svg new file mode 100644 index 00000000..c5320593 --- /dev/null +++ b/VoidLink/Images.xcassets/play.circle.fill.imageset/play.circle.fill.svg @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/VoidLink/UIAppView.m b/VoidLink/UIAppView.m index ca1319d2..9d98d353 100644 --- a/VoidLink/UIAppView.m +++ b/VoidLink/UIAppView.m @@ -29,6 +29,9 @@ static UIImage* noImage; _callback = callback; _artCache = cache; + self.layer.cornerRadius = 16; + self.clipsToBounds = YES; + // Cache the NoAppImage ourselves to avoid // having to load it each time if (noImage == nil) { @@ -71,7 +74,7 @@ static UIImage* noImage; #else // Rasterizing the cell layer increases rendering performance by quite a bit // but we want it unrasterized for tvOS where it must be scaled. - self.layer.shouldRasterize = YES; + //self.layer.shouldRasterize = YES; self.layer.rasterizationScale = [UIScreen mainScreen].scale; if (@available(iOS 13.4.1, *)) { @@ -115,6 +118,10 @@ static UIImage* noImage; } #endif +- (bool)isCurrentApp{ + return [_app.id isEqualToString:_app.host.currentGame]; +} + - (void) updateAppImage { if (_appOverlay != nil) { @@ -138,6 +145,8 @@ static UIImage* noImage; [_artCache setObject:appImage forKey:_app]; } } + + // [_artCache setObject:appImage forKey:_app]; if (appImage != nil) { @@ -156,12 +165,15 @@ static UIImage* noImage; noAppImage = true; } - if ([_app.id isEqualToString:_app.host.currentGame]) { + + if([self isCurrentApp]) { // Only create the app overlay if needed if (@available(iOS 13.0, *)) { - UIImageView* playIcon = [[UIImageView alloc] initWithImage:[[UIImage systemImageNamed:@"play.circle"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; - playIcon.tintColor = [[UIColor systemTealColor] colorWithAlphaComponent:0.8]; + UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightBlack ]; + UIImageView* playIcon = [[UIImageView alloc] initWithImage:[[UIImage systemImageNamed:@"play.circle.fill" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; + //playIcon.tintColor = [[ThemeManager widgetBackgroundColor] colorWithAlphaComponent:0.85]; + playIcon.tintColor = [[UIColor blackColor] colorWithAlphaComponent:0.55]; _appOverlay = playIcon; } else { @@ -170,23 +182,37 @@ static UIImage* noImage; } - _appOverlay.layer.shadowColor = [UIColor blackColor].CGColor; - _appOverlay.layer.shadowOffset = CGSizeMake(1, 1); - _appOverlay.layer.shadowOpacity = 1; - _appOverlay.layer.shadowRadius = 1.3; + //_appOverlay.layer.shadowColor = [UIColor blackColor].CGColor; + //_appOverlay.layer.shadowOffset = CGSizeMake(1, 1); + //_appOverlay.layer.shadowOpacity = 1; + //_appOverlay.layer.shadowRadius = 1.3; _appOverlay.contentMode = UIViewContentModeScaleAspectFit; } + else if(noAppImage){ + if (@available(iOS 13.0, *)) { + UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:70]; + UIImage* appIconImage = [[UIImage imageNamed:@"icon-pc-app"] imageWithConfiguration:config]; + UIImageView* appIcon = [[UIImageView alloc] initWithImage:[appIconImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; + + //layIcon.tintColor = [[ThemeManager widgetBackgroundColor] colorWithAlphaComponent:0.85]; + appIcon.tintColor = [[UIColor blackColor] colorWithAlphaComponent:0.55]; + + _appOverlay = appIcon; + } + } - if (noAppImage) { + if (true) { _appLabel = [[UILabel alloc] init]; - [_appLabel setTextColor:[[UIColor blackColor] colorWithAlphaComponent:0.75]]; + _appLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.55]; + [_appLabel setTextColor:[[UIColor whiteColor] colorWithAlphaComponent:1]]; //_appLabel.shadowColor = [UIColor blackColor]; [_appLabel setText:_app.name]; - [_appLabel setFont:[UIFont systemFontOfSize:20]]; + [_appLabel setFont:[UIFont systemFontOfSize:15]]; [_appLabel setBaselineAdjustment:UIBaselineAdjustmentAlignCenters]; [_appLabel setTextAlignment:NSTextAlignmentCenter]; [_appLabel setLineBreakMode:NSLineBreakByWordWrapping]; - [_appLabel setNumberOfLines:0]; + [_appLabel setNumberOfLines:2]; + _appLabel.lineBreakMode = NSLineBreakByTruncatingTail; } [self positionSubviews]; @@ -208,25 +234,26 @@ static UIImage* noImage; } - (void) positionSubviews { - CGFloat padding = 5.f; + // CGFloat padding = 28; + CGFloat verticalPadding = 10; CGSize frameSize = _appImage.frame.size; - CGPoint center = _appImage.center; + // CGPoint center = _appImage.center; + + [_appLabel setFrame:CGRectMake(0, frameSize.height-43, frameSize.width, 43)]; + //[_appLabel setFrame:CGRectMake(0, 0, 30, 12)]; + - if (_appLabel != nil) { if (_appOverlay != nil) { - _appOverlay.frame = CGRectMake(0, 0, frameSize.width / 3, frameSize.width / 3); - _appOverlay.center = CGPointMake(frameSize.width / 2, padding + _appOverlay.frame.size.height / 2); + _appOverlay.frame = [self isCurrentApp] ? CGRectMake(0, 0, frameSize.width / 2.39, frameSize.width / 2.39) : CGRectMake(0, 0, frameSize.width / 2, frameSize.width / 2); + _appOverlay.center = CGPointMake(frameSize.width/2, frameSize.height/2 - 2 * verticalPadding); - [_appLabel setFrame:CGRectMake(padding, _appOverlay.frame.size.height + padding, frameSize.width - 2 * padding, frameSize.height - _appOverlay.frame.size.height - 2 * padding)]; + //[_appLabel setFrame:CGRectMake(padding, _appOverlay.frame.size.height + padding, frameSize.width - 2 * padding, frameSize.height - _appOverlay.frame.size.height - 2 * padding)]; } - else { - [_appLabel setFrame:CGRectMake(padding, padding, frameSize.width - 2 * padding, frameSize.height - 2 * padding)]; - } - } + /* else if (_appOverlay != nil) { _appOverlay.frame = CGRectMake(0, 0, frameSize.width / 2, frameSize.width / 2); _appOverlay.center = center; - } + }*/ } - (void) updateLoop { @@ -244,8 +271,9 @@ static UIImage* noImage; // Show no shadow for hidden apps. Because we adjust the opacity of the // cells for hidden apps, it makes them look bad when the shadow draws // through the app tile. - self.superview.layer.shadowOpacity = _app.hidden ? 0.0f : 0.5f; - + // self.superview.layer.shadowOpacity = _app.hidden ? 0.0f : 0.5f; + self.superview.layer.shadowOpacity = 0; + // Update opacity if neccessary [self setAlpha:_app.hidden ? 0.4 : 1.0]; diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index a8878111..669b973f 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -2001,7 +2001,7 @@ static NSMutableSet* hostList; if (appView.bounds.size.width > 10.0) { CGFloat scale = cell.bounds.size.width / appView.bounds.size.width; [appView setCenter:CGPointMake(appView.bounds.size.width / 2 * scale, appView.bounds.size.height / 2 * scale)]; - appView.transform = CGAffineTransformMakeScale(scale, scale); + appView.transform = CGAffineTransformMakeScale(scale, scale); // view resize } [cell.subviews.firstObject removeFromSuperview]; // Remove a view that was previously added @@ -2009,15 +2009,15 @@ static NSMutableSet* hostList; // [self.settingsButton setEnabled:![self isIPhonePortrait]]; // update settings button after host is clicked & appview loaded // Shadow opacity is controlled inside UIAppView based on whether the app // is hidden or not during the update cycle. - UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:cell.bounds]; - cell.layer.masksToBounds = NO; - cell.layer.shadowColor = [UIColor blackColor].CGColor; - cell.layer.shadowOffset = CGSizeMake(1.0f, 5.0f); - cell.layer.shadowPath = shadowPath.CGPath; + //UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:cell.bounds]; + //cell.layer.masksToBounds = YES; + //cell.layer.shadowColor = [UIColor blackColor].CGColor; + //cell.layer.shadowOffset = CGSizeMake(1.0f, 5.0f); + //cell.layer.shadowPath = shadowPath.CGPath; #if !TARGET_OS_TV - cell.layer.borderWidth = 1; - cell.layer.borderColor = [[UIColor colorWithRed:0 green:0 blue:0 alpha:0.3f] CGColor]; + //cell.layer.borderWidth = 1; + //cell.layer.borderColor = [[UIColor colorWithRed:0 green:0 blue:0 alpha:0.3f] CGColor]; cell.exclusiveTouch = YES; #endif