mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-01 23:35:59 +00:00
system theme, tvos icon styling
- using tvos icon styling - updated to use system theme (light/dark) instead of always being grey
This commit is contained in:
parent
7fd3b8df1c
commit
befde5eb28
@ -32,7 +32,11 @@ static UIImage* noImage;
|
||||
noImage = [UIImage imageNamed:@"NoAppImage"];
|
||||
}
|
||||
|
||||
#if TARGET_OS_TV
|
||||
_appButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
#else
|
||||
_appButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
#endif
|
||||
[_appButton setBackgroundImage:noImage forState:UIControlStateNormal];
|
||||
[_appButton setContentEdgeInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
|
||||
[_appButton sizeToFit];
|
||||
@ -64,10 +68,15 @@ static UIImage* noImage;
|
||||
if ([_app.id isEqualToString:_app.host.currentGame]) {
|
||||
// Only create the app overlay if needed
|
||||
_appOverlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Play"]];
|
||||
#if TARGET_OS_TV
|
||||
_appOverlay.adjustsImageWhenAncestorFocused = YES;
|
||||
_appOverlay.userInteractionEnabled = YES;
|
||||
#else
|
||||
_appOverlay.layer.shadowColor = [UIColor blackColor].CGColor;
|
||||
_appOverlay.layer.shadowOffset = CGSizeMake(0, 0);
|
||||
_appOverlay.layer.shadowOpacity = 1;
|
||||
_appOverlay.layer.shadowRadius = 2.0;
|
||||
#endif
|
||||
|
||||
[self addSubview:_appOverlay];
|
||||
|
||||
@ -91,8 +100,20 @@ static UIImage* noImage;
|
||||
// TODO: Improve no-app image detection
|
||||
if (!(appImage.size.width == 130.f && appImage.size.height == 180.f) && // GFE 2.0
|
||||
!(appImage.size.width == 628.f && appImage.size.height == 888.f)) { // GFE 3.0
|
||||
#if TARGET_OS_TV
|
||||
//custom image to do TvOS hover popup effect
|
||||
UIImageView *imageView = [[UIImageView alloc] initWithImage:appImage];
|
||||
imageView.userInteractionEnabled = YES;
|
||||
imageView.adjustsImageWhenAncestorFocused = YES;
|
||||
imageView.frame = CGRectMake(0, 0, 200, 265);
|
||||
[_appButton addSubview:imageView];
|
||||
|
||||
_appButton.frame = CGRectMake(0, 0, 200, 265);
|
||||
self.frame = CGRectMake(0, 0, 200, 265);
|
||||
#else
|
||||
_appButton.frame = CGRectMake(0, 0, appImage.size.width / 2, appImage.size.height / 2);
|
||||
self.frame = CGRectMake(0, 0, appImage.size.width / 2, appImage.size.height / 2);
|
||||
#endif
|
||||
_appOverlay.frame = CGRectMake(0, 0, self.frame.size.width / 2.f, self.frame.size.height / 4.f);
|
||||
_appOverlay.layer.shadowRadius = 4.0;
|
||||
[_appOverlay setCenter:CGPointMake(self.frame.size.width/2, self.frame.size.height/6)];
|
||||
|
@ -992,9 +992,8 @@ static NSMutableSet* hostList;
|
||||
cell.layer.shadowOpacity = 0.5f;
|
||||
cell.layer.shadowPath = shadowPath.CGPath;
|
||||
|
||||
cell.layer.borderWidth = 1;
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
cell.layer.borderWidth = 1;
|
||||
cell.layer.borderColor = [[UIColor colorWithRed:0 green:0 blue:0 alpha:0.3f] CGColor];
|
||||
cell.exclusiveTouch = YES;
|
||||
#endif
|
||||
@ -1046,12 +1045,20 @@ static NSMutableSet* hostList;
|
||||
self.navigationController.navigationBar.topItem.rightBarButtonItem.enabled = YES;
|
||||
}
|
||||
|
||||
#if TARGET_OS_TV
|
||||
- (BOOL)canBecomeFocused {
|
||||
return YES;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
if (context.nextFocusedView != nil) {
|
||||
[context.nextFocusedView setAlpha:0.8];
|
||||
}
|
||||
[context.previouslyFocusedView setAlpha:1.0];
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="14113" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="pui-7y-JNH">
|
||||
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="14313.18" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="pui-7y-JNH">
|
||||
<device id="appleTV" orientation="landscape">
|
||||
<adaptation id="light"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="tvOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@ -39,7 +39,6 @@
|
||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" prefetchingEnabled="YES" id="8P0-wP-bDe">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.33333334329999997" green="0.33333334329999997" blue="0.33333334329999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="50" minimumInteritemSpacing="50" id="m6l-TM-5FZ">
|
||||
<size key="itemSize" width="300" height="400"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user