Commit 90b8e991 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Apple TV: added support for dark UI style

parent 925b274d
Pipeline #252 failed with stage
in 0 seconds
......@@ -39,5 +39,7 @@
<array>
<string>arm64</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Automatic</string>
</dict>
</plist>
......@@ -45,6 +45,16 @@
- (void)viewWillAppear:(BOOL)animated
{
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
UIColor *lightColor = [UIColor VLCLightTextColor];
self.titleLabel.textColor = lightColor;
self.metaDataLabel.textColor = lightColor;
} else {
UIColor *darkColor = [UIColor VLCDarkTextColor];
self.titleLabel.textColor = darkColor;
self.metaDataLabel.textColor = darkColor;
}
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
self.titleLabel.text = vpc.mediaTitle;
......
......@@ -14,6 +14,7 @@
@interface VLCPlaybackInfoSubtitlesFetcherViewController : VLCPlaybackInfoPanelTVViewController
@property (readwrite, weak, nonatomic) IBOutlet UIVisualEffectView *visualEffectView;
@property (readwrite, weak, nonatomic) IBOutlet UITableView *tableView;
@property (readwrite, weak, nonatomic) IBOutlet UILabel *titleLabel;
......
......@@ -77,7 +77,19 @@
multiplier:1.0
constant:0.0];
[self.view addConstraint:xConstraint];
}
- (void)viewWillAppear:(BOOL)animated
{
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
self.visualEffectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
self.titleLabel.textColor = [UIColor VLCLightTextColor];
} else {
self.visualEffectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
self.titleLabel.textColor = [UIColor VLCDarkTextColor];
}
[super viewWillAppear:animated];
}
#pragma mark - OSO Fetcher delegation
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9531" systemVersion="15C47a" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="12121" systemVersion="17B48" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="appleTV" orientation="landscape">
<adaptation id="light"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCPlaybackInfoSubtitlesFetcherViewController">
......@@ -10,6 +14,7 @@
<outlet property="tableView" destination="KQh-Wx-8D3" id="dMO-09-KJP"/>
<outlet property="titleLabel" destination="eRo-wP-AW8" id="R5P-l1-Qv2"/>
<outlet property="view" destination="iN0-l3-epB" id="Eym-vH-oyN"/>
<outlet property="visualEffectView" destination="oKA-TY-HnF" id="hBt-8E-I8f"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
......@@ -28,13 +33,13 @@
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eRo-wP-AW8">
<rect key="frame" x="870" y="100" width="180" height="91"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="66" sectionHeaderHeight="40" sectionFooterHeight="40" translatesAutoresizingMaskIntoConstraints="NO" id="KQh-Wx-8D3">
<rect key="frame" x="460" y="230" width="1000" height="620"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="sectionIndexBackgroundColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="sectionIndexBackgroundColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="-1" id="0hS-DY-15g"/>
<outlet property="delegate" destination="-1" id="WmP-OZ-DyT"/>
......@@ -55,4 +60,9 @@
</constraints>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<nil key="statusBar"/>
<simulatedOrientationMetrics key="orientation" orientation="landscapeRight"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>
......@@ -19,7 +19,11 @@
if (self) {
UILabel *label = [[UILabel alloc] initWithFrame:frame];
label.font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
label.textColor = [UIColor darkGrayColor];
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
label.textColor = [UIColor VLCLightTextColor];
} else {
label.textColor = [UIColor VLCDarkTextColor];
}
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self addSubview:label];
_titleLabel = label;
......
......@@ -39,8 +39,15 @@
[super prepareForReuse];
self.selectionMarkerVisible = NO;
self.titleLabel.text = nil;
self.selectionMarkerView.textColor = [UIColor darkGrayColor];
self.titleLabel.textColor = [UIColor darkGrayColor];
UIColor *textColor;
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
textColor = [UIColor VLCLightTextColor];
} else {
textColor = [UIColor VLCDarkTextColor];
}
self.selectionMarkerView.textColor = textColor;
self.titleLabel.textColor = textColor;
}
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
......
......@@ -14,6 +14,7 @@
@interface VLCPlaybackInfoTVViewController : UIViewController <UITabBarControllerDelegate, UIGestureRecognizerDelegate>
@property (nonatomic) IBOutlet UIView *containerView;
@property (nonatomic) IBOutlet UIVisualEffectView *visualEffectView;
@property (nonatomic) IBOutlet UIView *dimmingView;
@property (nonatomic) IBOutlet NSLayoutConstraint *tabBarRegiomHeightConstraint;
@property (nonatomic) IBOutlet NSLayoutConstraint *containerHeightConstraint;
......
......@@ -77,6 +77,10 @@
- (void)viewWillAppear:(BOOL)animated
{
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
self.visualEffectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
}
UITabBarController *tabBarController = self.tabBarController;
UIViewController *oldSelectedVC = tabBarController.selectedViewController;
tabBarController.viewControllers = [self tabViewControllers];
......
......@@ -29,15 +29,20 @@
self.titleLabel.text = self.title;
self.titleLabel.textColor = [UIColor colorWithWhite:0.5 alpha:1.];
NSMutableAttributedString *aboutContents = [[NSMutableAttributedString alloc] initWithData:[[NSString stringWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:@"About Contents" ofType:@"html"]
encoding:NSUTF8StringEncoding
error:nil]
dataUsingEncoding:NSUTF8StringEncoding]
options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}
documentAttributes:nil error:nil];
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
[aboutContents addAttribute:NSForegroundColorAttributeName value:[UIColor VLCLightTextColor] range:NSMakeRange(0., aboutContents.length)];
}
UITextView *textView = self.blablaTextView;
textView.attributedText = [[NSAttributedString alloc] initWithData:[[NSString stringWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:@"About Contents" ofType:@"html"]
encoding:NSUTF8StringEncoding
error:nil]
dataUsingEncoding:NSUTF8StringEncoding]
options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}
documentAttributes:nil error:nil];
textView.attributedText = aboutContents;
textView.scrollEnabled = YES;
textView.panGestureRecognizer.allowedTouchTypes = @[ @(UITouchTypeIndirect) ];
[textView.panGestureRecognizer addTarget:self action:@selector(scrollViewPan:)];
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="12121" systemVersion="17B48" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="appleTV" orientation="landscape">
<adaptation id="light"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCPlaybackInfoTVViewController">
......@@ -11,6 +15,7 @@
<outlet property="dimmingView" destination="fkF-mr-3nG" id="NO9-Ww-dkm"/>
<outlet property="tabBarRegiomHeightConstraint" destination="qQN-Xf-pTW" id="rPf-Al-chE"/>
<outlet property="view" destination="iN0-l3-epB" id="aoh-6Y-hrX"/>
<outlet property="visualEffectView" destination="ley-eR-13d" id="QNu-Ic-DqV"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
......@@ -42,7 +47,7 @@
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fkF-mr-3nG" userLabel="DimmingView">
<rect key="frame" x="0.0" y="340" width="1920" height="740"/>
<color key="backgroundColor" white="0.0" alpha="0.29999999999999999" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.29999999999999999" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<constraints>
......@@ -56,4 +61,9 @@
</constraints>
</view>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<nil key="statusBar"/>
<simulatedOrientationMetrics key="orientation" orientation="landscapeRight"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>
......@@ -3,6 +3,7 @@ tvOS 1.1.0:
· Full support for tvOS 11 and Apple TV 4K
· Hardware decoding of H.264
· Greatly improved playback engine
· Added support for dark user interface style
· Improved support for pass-through audio playback and multi-channel audio
· Fixes an unexpected app termination when uploading specifically crafted files through Remote Playback
......
......@@ -17,6 +17,7 @@
+ (UIColor *)VLCDarkBackgroundColor;
+ (UIColor *)VLCTransparentDarkBackgroundColor;
+ (UIColor *)VLCLightTextColor;
+ (UIColor *)VLCDarkTextColor;
+ (UIColor *)VLCDarkTextShadowColor;
+ (UIColor *)VLCOrangeTintColor;
+ (UIColor *)VLCMenuBackgroundColor;
......
......@@ -29,6 +29,11 @@
return [UIColor colorWithWhite:.72 alpha:1.];
}
+ (UIColor *)VLCDarkTextColor
{
return [UIColor colorWithWhite:.28 alpha:1.];
}
+ (UIColor *)VLCDarkTextShadowColor
{
return [UIColor colorWithWhite:0. alpha:.25f];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment