Commit 857f410d authored by Carola Nitz's avatar Carola Nitz

VLCMovieViewcontroller: move navigationbar into Movieviewcontroller to use...

VLCMovieViewcontroller: move navigationbar into Movieviewcontroller to use autolayoutconstraints and use the presenting navigationbar instead of creating a new one. This removes a lot of unnecessary code and fixes an issue where the navigation bar was colliding with the statusbar (closes #34)
parent 529bf307
Pipeline #123 failed with stage
in 0 seconds
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13189.4" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13165.3"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCMovieViewController">
<connections>
<outlet property="timeNavigationTitleView" destination="SbC-6V-aXT" id="6H3-z2-IYF"/>
<outlet property="widthConstraint" destination="dEx-l7-vH3" id="XHq-1C-HCh"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="SbC-6V-aXT" userLabel="Time view" customClass="VLCTimeNavigationTitleView">
<rect key="frame" x="0.0" y="0.0" width="700" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sdb-a5-RTT">
<rect key="frame" x="662" y="5" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="Ap6-VL-6UH"/>
<constraint firstAttribute="width" constant="30" id="dEx-l7-vH3"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="contentEdgeInsets" minX="5" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" image="ratioIcon.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="videoDimensionAction:" destination="-1" eventType="touchUpInside" id="evk-ak-iUc"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x1t-3m-s0G">
<rect key="frame" x="618" y="5" width="44" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="fv5-Cp-MOv"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="contentEdgeInsets" minX="5" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" title="--:--">
<color key="titleColor" red="0.74659199620000005" green="0.74659199620000005" blue="0.74659199620000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="toggleTimeDisplay:" destination="-1" eventType="touchUpInside" id="EMV-R7-M8p"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SBq-Am-6MD">
<rect key="frame" x="0.0" y="11" width="30" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="kLC-QM-zcI"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="contentEdgeInsets" minX="5" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" image="minimizePlayback">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="minimizePlayback:" destination="-1" eventType="touchUpInside" id="wmf-OK-ep3"/>
</connections>
</button>
<slider opaque="NO" contentMode="scaleToFill" semanticContentAttribute="playback" insetsLayoutMarginsFromSafeArea="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="axb-6M-lSX" userLabel="Position Slider" customClass="VLCOBSlider">
<rect key="frame" x="28" y="5" width="584" height="31"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" updatesFrequently="YES"/>
</accessibility>
<connections>
<action selector="positionSliderAction:" destination="-1" eventType="valueChanged" id="7eD-p7-L4J"/>
<action selector="positionSliderDrag:" destination="-1" eventType="touchDragInside" id="MjW-el-bCi"/>
<action selector="positionSliderDrag:" destination="-1" eventType="touchDragOutside" id="XGm-Pc-lSQ"/>
<action selector="positionSliderTouchDown:" destination="-1" eventType="touchDown" id="Uv4-iS-P3y"/>
<action selector="positionSliderTouchUp:" destination="-1" eventType="touchUpInside" id="dhA-x8-HoE"/>
<action selector="positionSliderTouchUp:" destination="-1" eventType="touchUpOutside" id="f6i-U3-Qv6"/>
</connections>
</slider>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Sdb-a5-RTT" firstAttribute="leading" secondItem="x1t-3m-s0G" secondAttribute="trailing" id="1fD-hg-Y99"/>
<constraint firstItem="Sdb-a5-RTT" firstAttribute="centerY" secondItem="SbC-6V-aXT" secondAttribute="centerY" id="9Tz-Di-uIS"/>
<constraint firstItem="axb-6M-lSX" firstAttribute="centerY" secondItem="SbC-6V-aXT" secondAttribute="centerY" id="dZG-UA-csl"/>
<constraint firstItem="SBq-Am-6MD" firstAttribute="centerY" secondItem="SbC-6V-aXT" secondAttribute="centerY" id="eoy-59-SkO"/>
<constraint firstItem="axb-6M-lSX" firstAttribute="trailing" secondItem="x1t-3m-s0G" secondAttribute="leading" constant="-8" id="l05-q4-Dha"/>
<constraint firstItem="x1t-3m-s0G" firstAttribute="centerY" secondItem="SbC-6V-aXT" secondAttribute="centerY" id="mIZ-5x-1r6"/>
<constraint firstItem="SBq-Am-6MD" firstAttribute="leading" secondItem="SbC-6V-aXT" secondAttribute="leading" id="mf3-NF-cwy"/>
<constraint firstAttribute="trailing" secondItem="Sdb-a5-RTT" secondAttribute="trailing" constant="8" id="uI1-3o-gyT"/>
<constraint firstItem="axb-6M-lSX" firstAttribute="leading" secondItem="SBq-Am-6MD" secondAttribute="trailing" id="zQP-Wv-QPC"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="aspectRatioButton" destination="Sdb-a5-RTT" id="H3u-Yv-6na"/>
<outlet property="minimizePlaybackButton" destination="SBq-Am-6MD" id="LsO-JQ-mjt"/>
<outlet property="positionSlider" destination="axb-6M-lSX" id="UIA-jE-MfS"/>
<outlet property="timeDisplayButton" destination="x1t-3m-s0G" id="82s-l3-eg0"/>
</connections>
<point key="canvasLocation" x="-334" y="284"/>
</view>
</objects>
<resources>
<image name="minimizePlayback" width="15" height="5"/>
<image name="ratioIcon.png" width="16" height="16"/>
</resources>
</document>
......@@ -31,11 +31,8 @@ typedef NS_ENUM(NSInteger, VLCMovieJumpState) {
@interface VLCMovieViewController : UIViewController <UIActionSheetDelegate, VLCPlaybackControllerDelegate>
@property (nonatomic, strong) IBOutlet UIView *movieView;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *backButton;
@property (nonatomic, strong) IBOutlet VLCTimeNavigationTitleView *timeNavigationTitleView;
@property (nonatomic, strong) IBOutlet UIButton *sleepTimerButton;
@property (nonatomic, strong) IBOutlet UINavigationBar *toolbar;
@property (nonatomic, strong) IBOutlet VLCMovieViewControlPanelView *controllerPanel;
@property (nonatomic, strong) IBOutlet VLCStatusLabel *statusLabel;
@property (nonatomic, strong) IBOutlet UIView *playingExternallyView;
......@@ -74,6 +71,7 @@ typedef NS_ENUM(NSInteger, VLCMovieJumpState) {
@property (nonatomic, strong) IBOutlet UILabel *albumNameLabel;
@property (nonatomic, strong) IBOutlet UILabel *trackNameLabel;
@property (nonatomic, strong) IBOutlet UIImageView *artworkImageView;
@property (nonatomic, strong) IBOutlet NSLayoutConstraint *widthConstraint;
- (IBAction)closePlayback:(id)sender;
- (IBAction)minimizePlayback:(id)sender;
......
......@@ -115,7 +115,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
CGPoint _saveLocation;
CGSize _screenSizePixel;
}
@property (nonatomic, strong) VLCMovieViewControlPanelView *controllerPanel;
@property (nonatomic, strong) UIPopoverController *masterPopoverController;
@property (nonatomic, strong) UIWindow *externalWindow;
@end
......@@ -177,7 +177,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.playbackSpeedView.hidden = YES;
_playbackSpeedViewHidden = YES;
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(handleExternalScreenDidConnect:)
name:UIScreenDidConnectNotification object:nil];
......@@ -209,17 +208,9 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_previousJumpState = VLCMovieJumpStateDefault;
_numberOfTapSeek = 0;
self.backButton.tintColor = [UIColor colorWithRed:(190.0f/255.0f) green:(190.0f/255.0f) blue:(190.0f/255.0f) alpha:1.];
self.toolbar.tintColor = [UIColor whiteColor];
self.toolbar.barStyle = UIBarStyleBlack;
rect = self.resetVideoFilterButton.frame;
rect.origin.y = rect.origin.y + 5.;
self.resetVideoFilterButton.frame = rect;
rect = self.toolbar.frame;
rect.size.height = rect.size.height + rect.origin.y;
rect.origin.y = 0;
self.toolbar.frame = rect;
_playerIsSetup = NO;
......@@ -254,6 +245,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_saveLocation = CGPointMake(-1.f, -1.f);
[self setupConstraints];
}
- (void)setupGestureRecognizers
......@@ -361,20 +353,45 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[NSLayoutConstraint constraintWithItem:_trackSelectorContainer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationLessThanOrEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:2.0/3.0 constant:0],
];
[NSLayoutConstraint activateConstraints:constraints];
}
- (void)setupNavigationbar
{
UIButton *doneButton = [[UIButton alloc] initWithFrame:CGRectZero];
[doneButton addTarget:self action:@selector(closePlayback:) forControlEvents:UIControlEventTouchUpInside];
[doneButton setTitle:NSLocalizedString(@"BUTTON_DONE", nil) forState:UIControlStateNormal];
doneButton.translatesAutoresizingMaskIntoConstraints = NO;
self.timeNavigationTitleView = [[[NSBundle mainBundle] loadNibNamed:@"VLCTimeNavigationTitleView" owner:self options:nil] objectAtIndex:0];
self.timeNavigationTitleView.translatesAutoresizingMaskIntoConstraints = NO;
[self.navigationController.navigationBar addSubview:self.timeNavigationTitleView];
[self.navigationController.navigationBar addSubview:doneButton];
[NSLayoutConstraint activateConstraints: @[
[NSLayoutConstraint constraintWithItem:doneButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.navigationController.navigationBar attribute:NSLayoutAttributeLeft multiplier:1 constant:8],
[NSLayoutConstraint constraintWithItem:doneButton attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.navigationController.navigationBar attribute:NSLayoutAttributeCenterY multiplier:1 constant:0],
[NSLayoutConstraint constraintWithItem:self.timeNavigationTitleView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:doneButton attribute:NSLayoutAttributeRight multiplier:1 constant:0],
[NSLayoutConstraint constraintWithItem:self.timeNavigationTitleView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.navigationController.navigationBar attribute:NSLayoutAttributeRight multiplier:1 constant:0],
[NSLayoutConstraint constraintWithItem:self.timeNavigationTitleView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.navigationController.navigationBar attribute:NSLayoutAttributeTop multiplier:1 constant:0],
[NSLayoutConstraint constraintWithItem:self.timeNavigationTitleView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.navigationController.navigationBar attribute:NSLayoutAttributeBottom multiplier:1 constant:0],
]];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
[self setupNavigationbar];
/* reset audio meta data views */
self.artworkImageView.image = nil;
self.trackNameLabel.text = nil;
self.artistNameLabel.text = nil;
self.albumNameLabel.text = nil;
[self.navigationController setNavigationBarHidden:YES animated:animated];
_vpc = [VLCPlaybackController sharedInstance];
_vpc.delegate = self;
[_vpc recoverPlaybackState];
......@@ -383,7 +400,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[self setControlsHidden:NO animated:animated];
[self updateDefaults];
[NSUserDefaults standardUserDefaults];
//Disabling video gestures, media not init in the player yet.
[self enableNormalVideoGestures:NO];
......@@ -411,6 +427,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
}
[self enableNormalVideoGestures:!_mediaHasProjection];
}
- (void)viewDidLayoutSubviews
......@@ -457,7 +474,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[_idleTimer invalidate];
_idleTimer = nil;
}
[self.navigationController setNavigationBarHidden:NO animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
[super viewWillDisappear:animated];
......@@ -625,10 +642,10 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
CGFloat alpha = _controlsHidden? 0.0f: 1.0f;
if (!_controlsHidden) {
self.navigationController.navigationBar.alpha = 0.0;
self.navigationController.navigationBar.hidden = NO;
_controllerPanel.alpha = 0.0f;
_controllerPanel.hidden = !_videoFiltersHidden;
_toolbar.alpha = 0.0f;
_toolbar.hidden = NO;
_videoFilterView.alpha = 0.0f;
_videoFilterView.hidden = _videoFiltersHidden;
_playbackSpeedView.alpha = 0.0f;
......@@ -650,8 +667,8 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
}
void (^animationBlock)() = ^() {
self.navigationController.navigationBar.alpha = alpha;
_controllerPanel.alpha = alpha;
_toolbar.alpha = alpha;
_videoFilterView.alpha = alpha;
_playbackSpeedView.alpha = alpha;
_trackSelectorContainer.alpha = alpha;
......@@ -668,9 +685,9 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
_controllerPanel.hidden = _videoFiltersHidden ? _controlsHidden : NO;
_toolbar.hidden = _controlsHidden;
_videoFilterView.hidden = _videoFiltersHidden;
_playbackSpeedView.hidden = _playbackSpeedViewHidden;
self.navigationController.navigationBar.hidden = _controlsHidden;
_trackSelectorContainer.hidden = YES;
_equalizerView.hidden = YES;
if (_sleepTimerContainer)
......@@ -972,6 +989,15 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self.statusLabel showStatusMessage:statusMessage];
}
- (void)hideShowAspectratioButton:(BOOL)hide
{
[UIView animateWithDuration:.3
animations:^{
self.widthConstraint.constant = hide ? 0 : 30;
self.timeNavigationTitleView.aspectRatioButton.hidden = hide;
}];
}
- (void)displayMetadataForPlaybackController:(VLCPlaybackController *)controller
title:(NSString *)title
artwork:(UIImage *)artwork
......@@ -990,9 +1016,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
} else
self.artistNameLabel.text = self.albumNameLabel.text = nil;
self.timeNavigationTitleView.hideAspectRatio = audioOnly;
self.timeNavigationTitleView.positionSlider.hidden = NO;
[self hideShowAspectratioButton:audioOnly];
[_controllerPanel updateButtons];
_audioOnly = audioOnly;
......@@ -1039,7 +1063,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (!_controlsHidden) {
self.controllerPanel.hidden = _controlsHidden = YES;
self.toolbar.hidden = YES;
self.navigationController.navigationBar.hidden = YES;
}
}
......@@ -1156,7 +1180,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
_interfaceIsLocked = !_interfaceIsLocked;
_multiSelectionView.displayLock = _interfaceIsLocked;
self.backButton.enabled = !_interfaceIsLocked;
}
- (void)toggleEqualizer
......@@ -1170,7 +1193,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (!_controlsHidden) {
self.controllerPanel.hidden = _controlsHidden = YES;
self.toolbar.hidden = YES;
self.navigationController.navigationBar.hidden = YES;
}
}
......
......@@ -938,7 +938,7 @@ VLCMediaDelegate>
{
if (_needsMetadataUpdate == NO) {
_needsMetadataUpdate = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{
[self _updateDisplayedMetadata];
});
}
......
......@@ -15,10 +15,6 @@
#import "VLCMovieViewController.h"
#endif
@interface VLCPlaybackNavigationController ()
@end
@implementation VLCPlaybackNavigationController
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
......
......@@ -248,24 +248,20 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
- (void)_presentFullscreenPlaybackViewIfNeeded
{
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(_presentFullscreenPlaybackViewIfNeeded) withObject:nil waitUntilDone:NO];
return;
}
if (!self.movieViewController.presentingViewController) {
[self _presentMovieViewControllerAnimated:[self shouldAnimate]];
}
dispatch_async(dispatch_get_main_queue(), ^{
if (!self.movieViewController.presentingViewController) {
[self _presentMovieViewControllerAnimated:[self shouldAnimate]];
}
});
}
- (void)_closeFullscreenPlayback
{
if (![NSThread isMainThread]) {
[self performSelectorOnMainThread:@selector(_closeFullscreenPlayback) withObject:nil waitUntilDone:NO];
return;
}
BOOL animated = [self shouldAnimate];
[self.movieViewController dismissViewControllerAnimated:animated completion:nil];
[self _showHideMiniPlaybackView];
dispatch_async(dispatch_get_main_queue(), ^{
BOOL animated = [self shouldAnimate];
[self.movieViewController dismissViewControllerAnimated:animated completion:nil];
[self _showHideMiniPlaybackView];
});
}
- (void)_presentMovieViewControllerAnimated:(BOOL)animated
......@@ -274,7 +270,6 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:movieViewController];
[movieViewController prepareForMediaPlayback:self.playbackController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
[window.rootViewController presentViewController:navCon animated:animated completion:nil];
}
......
......@@ -19,6 +19,4 @@
@property (weak, nonatomic) IBOutlet VLCOBSlider *positionSlider;
@property (weak, nonatomic) IBOutlet UIButton *timeDisplayButton;
@property (weak, nonatomic) IBOutlet UIButton *aspectRatioButton;
@property (nonatomic) BOOL hideAspectRatio;
@end
......@@ -2,73 +2,26 @@
* VLCTimeNavigationTitleView.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2015 VideoLAN. All rights reserved.
* Copyright (c) 2017 VideoLAN. All rights reserved.
* $Id$
*
* Author: Tobias Conradi <videolan # tobias-conradi.de>
Carola Nitz <nitz.carola # gmail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCTimeNavigationTitleView.h"
#import "VLCSlider.h"
@implementation VLCTimeNavigationTitleView
-(void)awakeFromNib {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
self.positionSlider.scrubbingSpeedChangePositions = @[@(0.), @(100.), @(200.), @(300)];
- (void)awakeFromNib {
self.minimizePlaybackButton.accessibilityLabel = NSLocalizedString(@"MINIMIZE_PLAYBACK_VIEW", nil);
self.aspectRatioButton.accessibilityLabel = NSLocalizedString(@"VIDEO_ASPECT_RATIO_BUTTON", nil);
[self.aspectRatioButton setImage:[UIImage imageNamed:@"ratioIcon"] forState:UIControlStateNormal];
self.minimizePlaybackButton.accessibilityLabel = NSLocalizedString(@"MINIMIZE_PLAYBACK_VIEW", nil);
// workaround for radar://22897614 ( http://www.openradar.me/22897614 )
UISlider *slider = self.positionSlider;
if ([slider respondsToSelector:@selector(semanticContentAttribute)]) {
UISemanticContentAttribute attribute = slider.semanticContentAttribute;
slider.semanticContentAttribute = UISemanticContentAttributeUnspecified;
slider.semanticContentAttribute = attribute;
}
[self setNeedsLayout];
[super awakeFromNib];
}
- (void)layoutSubviews
{
[super layoutSubviews];
CGRect remainder = self.bounds;
CGRect slice;
CGRectDivide(remainder, &slice, &remainder, CGRectGetWidth(self.minimizePlaybackButton.frame), CGRectMinXEdge);
self.minimizePlaybackButton.frame = slice;
if (!self.aspectRatioButton.hidden) {
[self.aspectRatioButton sizeToFit];
CGRectDivide(remainder, &slice, &remainder, CGRectGetWidth(self.aspectRatioButton.frame), CGRectMaxXEdge);
self.aspectRatioButton.frame = slice;
}
[self.timeDisplayButton sizeToFit];
CGRectDivide(remainder, &slice, &remainder, CGRectGetWidth(self.timeDisplayButton.frame), CGRectMaxXEdge);
self.timeDisplayButton.frame = slice;
self.positionSlider.frame = remainder;
}
- (void)setHideAspectRatio:(BOOL)hideAspectRatio
{
_hideAspectRatio = hideAspectRatio;
self.aspectRatioButton.hidden = hideAspectRatio;
[self setNeedsLayout];
}
@end
......@@ -42,6 +42,9 @@
419A2C691F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; };
419A2C6A1F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; };
419A2C6B1F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; };
419D7F051F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; };
419D7F071F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; };
419D7F081F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; };
41B93C011A53833B00102E8B /* VLCProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C001A53833B00102E8B /* VLCProgressView.m */; };
41B93C051A53835300102E8B /* VLCCloudServiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C031A53835300102E8B /* VLCCloudServiceCell.m */; };
41B93C081A53853B00102E8B /* VLCCloudServiceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41B93C071A53853B00102E8B /* VLCCloudServiceCell.xib */; };
......@@ -1155,6 +1158,7 @@
4184AA131A5492070063DF5A /* VLCCloudStorageController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCloudStorageController.h; path = Sources/VLCCloudStorageController.h; sourceTree = SOURCE_ROOT; };
4184AA141A5492070063DF5A /* VLCCloudStorageController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCCloudStorageController.m; path = Sources/VLCCloudStorageController.m; sourceTree = SOURCE_ROOT; };
419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCStringsForLocalization.m; sourceTree = "<group>"; };
419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = VLCTimeNavigationTitleView.xib; path = Resources/VLCTimeNavigationTitleView.xib; sourceTree = SOURCE_ROOT; };
41B93BFF1A53833B00102E8B /* VLCProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCProgressView.h; path = Sources/VLCProgressView.h; sourceTree = SOURCE_ROOT; };
41B93C001A53833B00102E8B /* VLCProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCProgressView.m; path = Sources/VLCProgressView.m; sourceTree = SOURCE_ROOT; };
41B93C021A53835300102E8B /* VLCCloudServiceCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCloudServiceCell.h; path = Sources/VLCCloudServiceCell.h; sourceTree = SOURCE_ROOT; };
......@@ -2342,6 +2346,7 @@
7DBBF189183AB4300009A339 /* VLCEmptyLibraryView.xib */,
7DBBF18B183AB4300009A339 /* VLCPlaylistCollectionViewCell.xib */,
7DBBF18C183AB4300009A339 /* VLCPlaylistTableViewCell.xib */,
419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */,
);
name = Library;
sourceTree = "<group>";
......@@ -3674,6 +3679,7 @@
7D787FCC1D40FDE70003CFA1 /* VLCFirstStepsFourthPageViewController~iphone.xib in Resources */,
7D787FCD1D40FDE70003CFA1 /* VLCFirstStepsSixthPageViewController~iphone.xib in Resources */,
7D787FCE1D40FDE70003CFA1 /* VLCMigrationViewController.xib in Resources */,
419D7F081F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */,
7D787FCF1D40FDE70003CFA1 /* VLCCloudStorageTableViewController.xib in Resources */,
7D787FD01D40FDE70003CFA1 /* VLCFirstStepsThirdPageViewController~iphone.xib in Resources */,
7D787FD11D40FDE70003CFA1 /* VLCEmptyLibraryView.xib in Resources */,
......@@ -3716,6 +3722,7 @@
7AC862A91765E9510011611A /* jquery.ui.widget.js in Resources */,
A79246C8170F11DF0036AAF2 /* Localizable.strings in Resources */,
9B9231C4185A703700F89498 /* VLCNetworkLoginViewController.xib in Resources */,
419D7F051F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */,
7D1516431868D7E0004B18F3 /* VLCFirstStepsFirstPageViewController~iphone.xib in Resources */,
7DF04F4E1961F2B8004A5429 /* web-download.png in Resources */,
41B93C081A53853B00102E8B /* VLCCloudServiceCell.xib in Resources */,
......@@ -3778,6 +3785,7 @@
7DC550471C046615007B4E42 /* jquery.ui.widget.js in Resources */,
7DC550481C046615007B4E42 /* Localizable.strings in Resources */,
7DC550491C046615007B4E42 /* VLCNetworkLoginViewController.xib in Resources */,
419D7F071F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */,
7DC5504A1C046615007B4E42 /* VLCFirstStepsFirstPageViewController~iphone.xib in Resources */,
7DC5504B1C046615007B4E42 /* web-download.png in Resources */,
7DC5504E1C046615007B4E42 /* VLCCloudServiceCell.xib in Resources */,
......
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