appView update
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 34C26.4183 34 30 37.5817 30 42V48C30 52.4183 26.4183 56 22 56H16C11.7199 56 8.22523 52.6389 8.01074 48.4121L8 48V42C8 37.5817 11.5817 34 16 34H22ZM16 38C13.7909 38 12 39.7909 12 42V48L12.0049 48.2061C12.1087 50.2512 13.7488 51.8913 15.7939 51.9951L16 52H22L22.2061 51.9951C24.3194 51.8879 26 50.14 26 48V42C26 39.7909 24.2091 38 22 38H16Z" fill="black"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48 34C52.4183 34 56 37.5817 56 42V48C56 52.4183 52.4183 56 48 56H42C37.7199 56 34.2252 52.6389 34.0107 48.4121L34 48V42C34 37.5817 37.5817 34 42 34H48ZM42 38C39.7909 38 38 39.7909 38 42V48L38.0049 48.2061C38.1087 50.2512 39.7488 51.8913 41.7939 51.9951L42 52H48L48.2061 51.9951C50.3194 51.8879 52 50.14 52 48V42C52 39.7909 50.2091 38 48 38H42Z" fill="black"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 8C26.4183 8 30 11.5817 30 16V22C30 26.4183 26.4183 30 22 30H16C11.7199 30 8.22523 26.6389 8.01074 22.4121L8 22V16C8 11.5817 11.5817 8 16 8H22ZM16 12C13.7909 12 12 13.7909 12 16V22L12.0049 22.2061C12.1087 24.2512 13.7488 25.8913 15.7939 25.9951L16 26H22L22.2061 25.9951C24.3194 25.8879 26 24.14 26 22V16C26 13.7909 24.2091 12 22 12H16Z" fill="black"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48 8C52.4183 8 56 11.5817 56 16V22C56 26.4183 52.4183 30 48 30H42C37.7199 30 34.2252 26.6389 34.0107 22.4121L34 22V16C34 11.5817 37.5817 8 42 8H48ZM42 12C39.7909 12 38 13.7909 38 16V22L38.0049 22.2061C38.1087 24.2512 39.7488 25.8913 41.7939 25.9951L42 26H48L48.2061 25.9951C50.3194 25.8879 52 24.14 52 22V16C52 13.7909 50.2091 12 48 12H42Z" fill="black"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--Generator: Apple Native CoreSVG 341-->
|
||||
<!DOCTYPE svg
|
||||
PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 21.6992 21.3379">
|
||||
<g>
|
||||
<rect height="21.3379" opacity="0" width="21.6992" x="0" y="0"/>
|
||||
<path d="M21.3379 10.6641C21.3379 16.5527 16.5625 21.3281 10.6641 21.3281C4.77539 21.3281 0 16.5527 0 10.6641C0 4.77539 4.77539 0 10.6641 0C16.5625 0 21.3379 4.77539 21.3379 10.6641ZM7.31445 7.51953L7.31445 13.7793C7.31445 14.8926 8.38867 15.3809 9.31641 14.834L14.4922 11.7871C15.3711 11.2598 15.3613 10.0293 14.4922 9.52148L9.31641 6.47461C8.36914 5.9082 7.31445 6.40625 7.31445 7.51953Z" fill="white" fill-opacity="0.85"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 829 B |
+53
-25
@@ -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];
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user