Commit 8a75aae2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

playback: implement pseudo-menu for secondary actions (closes #14028, #14030)

parent ced8633b
......@@ -19,18 +19,16 @@
<outlet property="brightnessLabel" destination="148" id="165"/>
<outlet property="brightnessSlider" destination="147" id="163"/>
<outlet property="bwdButton" destination="276" id="284"/>
<outlet property="chapterButton" destination="D3O-Bo-TYi" id="o5p-gI-ydF"/>
<outlet property="contrastLabel" destination="146" id="160"/>
<outlet property="contrastSlider" destination="145" id="161"/>
<outlet property="controllerPanel" destination="272" id="298"/>
<outlet property="currentScrubSpeedLabel" destination="244" id="246"/>
<outlet property="equalizerButton" destination="iAS-0C-clq" id="hu9-uh-EsK"/>
<outlet property="fwdButton" destination="274" id="286"/>
<outlet property="gammaLabel" destination="152" id="171"/>
<outlet property="gammaSlider" destination="151" id="169"/>
<outlet property="hueLabel" destination="143" id="158"/>
<outlet property="hueSlider" destination="144" id="157"/>
<outlet property="lockButton" destination="o2q-eo-cnU" id="08s-Qv-duE"/>
<outlet property="moreActionsButton" destination="o2v-AM-dqM" id="IzQ-ac-6DG"/>
<outlet property="movieView" destination="121" id="122"/>
<outlet property="playPauseButton" destination="275" id="282"/>
<outlet property="playbackSpeedButton" destination="278" id="295"/>
......@@ -42,7 +40,6 @@
<outlet property="playingExternallyTitle" destination="125" id="133"/>
<outlet property="playingExternallyView" destination="123" id="131"/>
<outlet property="positionSlider" destination="249" id="261"/>
<outlet property="repeatButton" destination="96c-QK-bZI" id="SPv-gB-C2a"/>
<outlet property="resetVideoFilterButton" destination="142" id="175"/>
<outlet property="saturationLabel" destination="150" id="166"/>
<outlet property="saturationSlider" destination="149" id="168"/>
......@@ -314,7 +311,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<subviews>
<view contentMode="scaleToFill" id="k3r-6B-CmK" userLabel="audioSwitcherContainer">
<rect key="frame" x="258" y="5" width="50" height="40"/>
<rect key="frame" x="241" y="5" width="50" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="278">
......@@ -337,7 +334,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" id="OCK-fG-mgo" userLabel="videoEffectsContainer">
<rect key="frame" x="599" y="5" width="50" height="40"/>
<rect key="frame" x="617" y="5" width="50" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="279">
......@@ -360,7 +357,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="277">
<rect key="frame" x="493" y="5" width="32" height="40"/>
<rect key="frame" x="535" y="5" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
......@@ -431,48 +428,21 @@
<action selector="playPause" destination="-1" eventType="touchUpInside" id="283"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="96c-QK-bZI">
<rect key="frame" x="217" y="5" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<state key="normal" image="repeat.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="toggleRepeatMode:" destination="-1" eventType="touchUpInside" id="UWl-MQ-MX7"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="o2q-eo-cnU">
<rect key="frame" x="541" y="5" width="32" height="40"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="o2v-AM-dqM">
<rect key="frame" x="727" y="5" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="L"/>
<connections>
<action selector="lock:" destination="-1" eventType="touchUpInside" id="QFm-Re-ySf"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="D3O-Bo-TYi">
<rect key="frame" x="577" y="6" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="C"/>
<connections>
<action selector="switchChapter:" destination="-1" eventType="touchUpInside" id="NHE-kB-Qpz"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="iAS-0C-clq">
<rect key="frame" x="657" y="6" width="32" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<inset key="contentEdgeInsets" minX="0.0" minY="4" maxX="0.0" maxY="4"/>
<state key="normal" title="E"/>
<state key="normal" image="More.png">
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="highlighted">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="equalizer:" destination="-2" eventType="touchUpInside" id="fpe-ay-cLY"/>
<action selector="moreActions:" destination="-1" eventType="touchUpInside" id="ZhG-d9-vzl"/>
</connections>
</button>
</subviews>
......@@ -575,13 +545,13 @@
</view>
</objects>
<resources>
<image name="More.png" width="20" height="6"/>
<image name="PlayingExternally.png" width="261" height="195"/>
<image name="audioTrackIcon.png" width="19" height="19"/>
<image name="backIcon.png" width="32" height="16"/>
<image name="forwardIcon.png" width="32" height="16"/>
<image name="playIcon.png" width="19" height="17"/>
<image name="ratioIcon.png" width="15" height="15"/>
<image name="repeat.png" width="23" height="18"/>
<image name="resetIcon.png" width="24" height="30"/>
<image name="speedIcon.png" width="19" height="19"/>
<image name="videoEffectsIcon.png" width="21" height="21"/>
......
This diff is collapsed.
......@@ -33,13 +33,6 @@
@property (nonatomic, strong) IBOutlet UIButton *fwdButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *trackSwitcherButton;
@property (nonatomic, strong) IBOutlet UIButton *trackSwitcherButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *repeatButton;
@property (nonatomic, strong) IBOutlet UIButton *repeatButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *lockButton;
@property (nonatomic, strong) IBOutlet UIButton *lockButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *chapterButton;
@property (nonatomic, strong) IBOutlet UIButton *chapterButtonLandscape;
@property (nonatomic, strong) IBOutlet UIButton *equalizerButton;
@property (nonatomic, strong) IBOutlet UIButton *sleepTimerButton;
@property (nonatomic, strong) IBOutlet UINavigationBar *toolbar;
@property (nonatomic, strong) IBOutlet VLCFrostedGlasView *controllerPanel;
......@@ -80,6 +73,7 @@
@property (nonatomic, strong) IBOutlet UILabel *spuDelayLabel;
@property (nonatomic, strong) IBOutlet UILabel *spuDelayIndicator;
@property (nonatomic, strong) IBOutlet UIButton *aspectRatioButton;
@property (nonatomic, strong) IBOutlet UIButton *moreActionsButton;
@property (nonatomic, strong) IBOutlet VLCFrostedGlasView *scrubIndicatorView;
@property (nonatomic, strong) IBOutlet UILabel *currentScrubSpeedLabel;
......@@ -108,12 +102,9 @@
- (IBAction)playPause;
- (IBAction)backward:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)toggleRepeatMode:(id)sender;
- (IBAction)switchTrack:(id)sender;
- (IBAction)lock:(id)sender;
- (IBAction)switchChapter:(id)sender;
- (IBAction)equalizer:(id)sender;
- (IBAction)sleepTimer:(id)sender;
- (IBAction)moreActions:(id)sender;
- (IBAction)videoFilterToggle:(id)sender;
- (IBAction)videoFilterSliderAction:(id)sender;
......@@ -121,6 +112,12 @@
- (IBAction)playbackSliderAction:(id)sender;
- (IBAction)videoDimensionAction:(id)sender;
- (void)toggleRepeatMode;
- (void)toggleEqualizer;
- (void)toggleUILock;
- (void)toggleChapterAndTitleSelector;
- (void)hideMenu;
- (BOOL)rotationIsDisabled;
@end
......@@ -25,6 +25,7 @@
#import "VLCTrackSelectorTableViewCell.h"
#import "VLCTrackSelectorHeaderView.h"
#import "VLCEqualizerView.h"
#import "VLCMultiSelectionMenuView.h"
#import "OBSlider.h"
#import "VLCStatusLabel.h"
......@@ -47,7 +48,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
VLCPanTypeVolume,
};
@interface VLCMovieViewController () <UIGestureRecognizerDelegate, AVAudioSessionDelegate, VLCMediaDelegate, UITableViewDataSource, UITableViewDelegate, VLCEqualizerViewDelegate>
@interface VLCMovieViewController () <UIGestureRecognizerDelegate, AVAudioSessionDelegate, VLCMediaDelegate, UITableViewDataSource, UITableViewDelegate, VLCEqualizerViewDelegate, VLCMultiSelectionViewDelegate>
{
VLCMediaListPlayer *_listPlayer;
VLCMediaPlayer *_mediaPlayer;
......@@ -88,6 +89,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
UITableView *_trackSelectorTableView;
VLCEqualizerView *_equalizerView;
VLCMultiSelectionMenuView *_multiSelectionView;
UIView *_sleepTimerContainer;
UIDatePicker *_sleepTimeDatePicker;
......@@ -209,10 +211,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_trackSwitcherButton.isAccessibilityElement = YES;
_trackSwitcherButtonLandscape.accessibilityLabel = NSLocalizedString(@"OPEN_TRACK_PANEL", nil);
_trackSwitcherButtonLandscape.isAccessibilityElement = YES;
_chapterButton.accessibilityLabel = NSLocalizedString(@"JUMP_TO_TITLE_OR_CHAPTER", nil);
_chapterButton.isAccessibilityElement = YES;
_chapterButtonLandscape.accessibilityLabel = NSLocalizedString(@"JUMP_TO_TITLE_OR_CHAPTER", nil);
_chapterButtonLandscape.isAccessibilityElement = YES;
_playbackSpeedButton.accessibilityLabel = _playbackSpeedLabel.text;
_playbackSpeedButton.isAccessibilityElement = YES;
_playbackSpeedButtonLandscape.accessibilityLabel = _playbackSpeedLabel.text;
......@@ -237,14 +235,16 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_fwdButton.isAccessibilityElement = YES;
_fwdButtonLandscape.accessibilityLabel = NSLocalizedString(@"FWD_BUTTON", nil);
_fwdButtonLandscape.isAccessibilityElement = YES;
_repeatButton.accessibilityLabel = NSLocalizedString(@"BUTTON_REPEAT", nil);
_repeatButton.isAccessibilityElement = YES;
_equalizerButton.accessibilityLabel = NSLocalizedString(@"BUTTON_EQUALIZER", nil);
_equalizerButton.isAccessibilityElement = YES;
_sleepTimerButton.accessibilityLabel = NSLocalizedString(@"BUTTON_SLEEP_TIMER", nil);
_sleepTimerButton.isAccessibilityElement = YES;
[_sleepTimerButton setTitle:NSLocalizedString(@"BUTTON_SLEEP_TIMER", nil) forState:UIControlStateNormal];
_multiSelectionView = [[VLCMultiSelectionMenuView alloc] init];
_multiSelectionView.delegate = self;
_multiSelectionView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
_multiSelectionView.hidden = YES;
[self.view addSubview:_multiSelectionView];
_scrubHelpLabel.text = NSLocalizedString(@"PLAYBACK_SCRUB_HELP", nil);
self.playbackSpeedView.hidden = YES;
......@@ -473,18 +473,42 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
- (void)viewWillLayoutSubviews
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
CGSize viewSize = self.view.frame.size;
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
[_controllerPanel removeFromSuperview];
_controllerPanelLandscape.frame = (CGRect){CGPointMake(0, viewSize.height - _controllerPanelLandscape.frame.size.height), CGSizeMake(viewSize.width, _controllerPanelLandscape.frame.size.height)};
[self.view addSubview:_controllerPanelLandscape];
} else {
[_controllerPanelLandscape removeFromSuperview];
_controllerPanel.frame = (CGRect){CGPointMake(0, viewSize.height - _controllerPanel.frame.size.height), CGSizeMake(viewSize.width, _controllerPanel.frame.size.height)};
[self.view addSubview:_controllerPanel];
}
CGRect multiSelectionFrame;
CGRect controllerPanelFrame;
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone) {
controllerPanelFrame = _controllerPanel.frame;
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
_multiSelectionView.frame = multiSelectionFrame;
_multiSelectionView.showsEqualizer = YES;
return;
}
CGSize viewSize = self.view.frame.size;
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
[_controllerPanel removeFromSuperview];
controllerPanelFrame = (CGRect){CGPointMake(0, viewSize.height - _controllerPanelLandscape.frame.size.height), CGSizeMake(viewSize.width, _controllerPanelLandscape.frame.size.height)};
_controllerPanelLandscape.frame = controllerPanelFrame;
[self.view addSubview:_controllerPanelLandscape];
_multiSelectionView.showsEqualizer = YES;
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
} else {
[_controllerPanelLandscape removeFromSuperview];
controllerPanelFrame = (CGRect){CGPointMake(0, viewSize.height - _controllerPanel.frame.size.height), CGSizeMake(viewSize.width, _controllerPanel.frame.size.height)};
_controllerPanel.frame = controllerPanelFrame;
[self.view addSubview:_controllerPanel];
_multiSelectionView.showsEqualizer = NO;
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
}
_multiSelectionView.frame = multiSelectionFrame;
}
- (void)_startPlayback
......@@ -584,8 +608,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.positionSlider.value = 0.;
[self.timeDisplay setTitle:@"" forState:UIControlStateNormal];
self.timeDisplay.accessibilityLabel = @"";
[self.repeatButton setImage:[UIImage imageNamed:@"repeat"] forState:UIControlStateNormal];
[self.repeatButtonLandscape setImage:[UIImage imageNamed:@"repeat"] forState:UIControlStateNormal];
if (![self _isMediaSuitableForDevice]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DEVICE_TOOSLOW_TITLE", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DEVICE_TOOSLOW", nil), [[UIDevice currentDevice] model], self.fileFromMediaLibrary.title] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:NSLocalizedString(@"BUTTON_OPEN", nil), nil];
......@@ -952,6 +974,8 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_sleepTimerContainer.alpha = 0.0f;
_sleepTimerContainer.hidden = YES;
}
_multiSelectionView.alpha = 0.0f;
_multiSelectionView.hidden = YES;
}
void (^animationBlock)() = ^() {
......@@ -962,6 +986,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_playbackSpeedView.alpha = alpha;
_trackSelectorContainer.alpha = alpha;
_equalizerView.alpha = alpha;
_multiSelectionView.alpha = alpha;
if (_sleepTimerContainer)
_sleepTimerContainer.alpha = alpha;
};
......@@ -976,6 +1001,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_equalizerView.hidden = YES;
if (_sleepTimerContainer)
_sleepTimerContainer.hidden = YES;
_multiSelectionView.hidden = YES;
};
UIStatusBarAnimation animationType = animated? UIStatusBarAnimationFade: UIStatusBarAnimationNone;
......@@ -1168,13 +1194,10 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.trackSwitcherButtonLandscape.hidden = YES;
}
if (_mediaPlayer.titles.count > 1 || [_mediaPlayer chaptersForTitleIndex:_mediaPlayer.currentTitleIndex].count > 1) {
self.chapterButton.hidden = NO;
self.chapterButtonLandscape.hidden = NO;
} else {
self.chapterButton.hidden = YES;
self.chapterButtonLandscape.hidden = YES;
}
if (_mediaPlayer.titles.count > 1 || [_mediaPlayer chaptersForTitleIndex:_mediaPlayer.currentTitleIndex].count > 1)
_multiSelectionView.mediaHasChapters = YES;
else
_multiSelectionView.mediaHasChapters = NO;
}
- (IBAction)playPause
......@@ -1207,19 +1230,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[_mediaPlayer mediumJumpBackward];
}
- (void)toggleRepeatMode:(id)sender
{
if (_listPlayer.repeatMode == VLCDoNotRepeat) {
_listPlayer.repeatMode = VLCRepeatCurrentItem;
[self.repeatButton setImage:[UIImage imageNamed:@"repeatOne"] forState:UIControlStateNormal];
[self.repeatButtonLandscape setImage:[UIImage imageNamed:@"repeatOne"] forState:UIControlStateNormal];
} else {
_listPlayer.repeatMode = VLCDoNotRepeat;
[self.repeatButton setImage:[UIImage imageNamed:@"repeat"] forState:UIControlStateNormal];
[self.repeatButtonLandscape setImage:[UIImage imageNamed:@"repeat"] forState:UIControlStateNormal];
}
}
- (IBAction)switchTrack:(id)sender
{
LOCKCHECK;
......@@ -1248,33 +1258,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
}
}
- (IBAction)switchChapter:(id)sender
{
LOCKCHECK;
if (_trackSelectorContainer.hidden == YES || _switchingTracksNotChapters == YES) {
_switchingTracksNotChapters = NO;
[_trackSelectorTableView reloadData];
_trackSelectorContainer.hidden = NO;
_trackSelectorContainer.alpha = 1.;
if (!_playbackSpeedViewHidden)
self.playbackSpeedView.hidden = _playbackSpeedViewHidden = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (!_controlsHidden) {
self.controllerPanel.hidden = _controlsHidden = YES;
self.controllerPanelLandscape.hidden = YES;
}
}
self.videoFilterView.hidden = _videoFiltersHidden = YES;
} else {
_trackSelectorContainer.hidden = YES;
}
}
- (IBAction)toggleTimeDisplay:(id)sender
{
LOCKCHECK;
......@@ -1284,33 +1267,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[self _resetIdleTimer];
}
- (IBAction)lock:(id)sender
{
_interfaceIsLocked = !_interfaceIsLocked;
}
- (IBAction)equalizer:(id)sender
{
LOCKCHECK;
if (_equalizerView.hidden) {
if (!_playbackSpeedViewHidden)
self.playbackSpeedView.hidden = _playbackSpeedViewHidden = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (!_controlsHidden) {
self.controllerPanel.hidden = _controlsHidden = YES;
self.controllerPanelLandscape.hidden = YES;
}
}
self.videoFilterView.hidden = _videoFiltersHidden = YES;
_equalizerView.alpha = 1.;
_equalizerView.hidden = NO;
} else
_equalizerView.hidden = YES;
}
- (IBAction)sleepTimer:(id)sender
{
if (!_sleepTimerContainer) {
......@@ -1381,6 +1337,124 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_sleepTimer = [NSTimer scheduledTimerWithTimeInterval:_sleepTimeDatePicker.countDownDuration target:self selector:@selector(closePlayback:) userInfo:nil repeats:NO];
}
- (void)moreActions:(id)sender
{
if (_multiSelectionView.hidden == NO) {
[UIView animateWithDuration:.3
animations:^{
_multiSelectionView.hidden = YES;
}
completion:^(BOOL finished){
}];
return;
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
_multiSelectionView.showsEqualizer = YES;
else
_multiSelectionView.showsEqualizer = NO;
}
CGRect workFrame = _multiSelectionView.frame;
workFrame.size = [_multiSelectionView proposedDisplaySize];
workFrame.origin.x = self.toolbar.frame.size.width - workFrame.size.width;
_multiSelectionView.alpha = 1.0f;
/* animate */
_multiSelectionView.frame = CGRectMake(workFrame.origin.x, workFrame.origin.y + workFrame.size.height, workFrame.size.width, 0.);
[UIView animateWithDuration:.3
animations:^{
_multiSelectionView.frame = workFrame;
_multiSelectionView.hidden = NO;
}
completion:^(BOOL finished){
}];
[self _resetIdleTimer];
}
#pragma mark - multi-select delegation
- (void)toggleUILock
{
_interfaceIsLocked = !_interfaceIsLocked;
}
- (void)toggleEqualizer
{
LOCKCHECK;
if (_equalizerView.hidden) {
if (!_playbackSpeedViewHidden)
self.playbackSpeedView.hidden = _playbackSpeedViewHidden = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (!_controlsHidden) {
self.controllerPanel.hidden = _controlsHidden = YES;
self.controllerPanelLandscape.hidden = YES;
self.toolbar.hidden = YES;
}
}
self.videoFilterView.hidden = _videoFiltersHidden = YES;
_equalizerView.alpha = 1.;
_equalizerView.hidden = NO;
} else
_equalizerView.hidden = YES;
}
- (void)toggleChapterAndTitleSelector
{
LOCKCHECK;
if (_trackSelectorContainer.hidden == YES || _switchingTracksNotChapters == YES) {
_switchingTracksNotChapters = NO;
[_trackSelectorTableView reloadData];
_trackSelectorContainer.hidden = NO;
_trackSelectorContainer.alpha = 1.;
if (!_playbackSpeedViewHidden)
self.playbackSpeedView.hidden = _playbackSpeedViewHidden = YES;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
if (!_controlsHidden) {
self.controllerPanel.hidden = _controlsHidden = YES;
self.controllerPanelLandscape.hidden = YES;
}
}
self.videoFilterView.hidden = _videoFiltersHidden = YES;
} else {
_trackSelectorContainer.hidden = YES;
}
}
- (void)toggleRepeatMode
{
LOCKCHECK;
if (_listPlayer.repeatMode == VLCDoNotRepeat) {
_listPlayer.repeatMode = VLCRepeatCurrentItem;
_multiSelectionView.displayRepeatOne = YES;
} else {
_listPlayer.repeatMode = VLCDoNotRepeat;
_multiSelectionView.displayRepeatOne = NO;
}
}
- (void)hideMenu
{
[UIView animateWithDuration:.2
animations:^{
_multiSelectionView.hidden = YES;
}
completion:^(BOOL finished){
}];
[self _resetIdleTimer];
}
#pragma mark - track selector table view
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
......
//
// VLCMultiSelectionMenuView.h
// VLC for iOS
//
// Created by Felix Paul Kühne on 09/03/15.
// Copyright (c) 2015 VideoLAN. All rights reserved.
//
#import "VLCFrostedGlasView.h"
@protocol VLCMultiSelectionViewDelegate <NSObject>
@required
- (void)toggleUILock;
- (void)toggleEqualizer;
- (void)toggleChapterAndTitleSelector;
- (void)toggleRepeatMode;
- (void)hideMenu;
@end
@interface VLCMultiSelectionMenuView : VLCFrostedGlasView
@property (readwrite, weak) id<VLCMultiSelectionViewDelegate> delegate;
@property (readwrite, assign) BOOL showsEqualizer;
@property (readwrite, assign) BOOL mediaHasChapters;
- (void)setDisplayRepeatOne:(BOOL)displayRepeatOne;
- (CGSize)proposedDisplaySize;
@end
//
// VLCMultiSelectionMenuView.m
// VLC for iOS
//
// Created by Felix Paul Kühne on 09/03/15.
// Copyright (c) 2015 VideoLAN. All rights reserved.
//
#import "VLCMultiSelectionMenuView.h"
#define buttonWidth 32.
#define buttonHeight 35.
#define spacer 8.
@interface VLCMultiSelectionMenuView ()
{
UIButton *_equalizerButton;
UIButton *_chapterSelectorButton;
UIButton *_repeatButton;
UIButton *_lockButton;
BOOL _showsEQ;
}
@end
@implementation VLCMultiSelectionMenuView
- (instancetype)init
{
self = [super initWithFrame:CGRectMake(0., 0., buttonWidth, buttonHeight)];
if (self) {
_equalizerButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_equalizerButton setTitle:@"E" forState:UIControlStateNormal];
_equalizerButton.titleLabel.textColor = [UIColor whiteColor];
_equalizerButton.frame = CGRectMake(spacer, spacer, buttonWidth, buttonHeight);
[_equalizerButton addTarget:self action:@selector(equalizerAction:) forControlEvents:UIControlEventTouchUpInside];
_equalizerButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
[self addSubview:_equalizerButton];
_chapterSelectorButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_chapterSelectorButton setTitle:@"C" forState:UIControlStateNormal];
_chapterSelectorButton.titleLabel.textColor = [UIColor whiteColor];
_chapterSelectorButton.frame = CGRectMake(spacer, spacer + buttonHeight + spacer, buttonWidth, buttonHeight);
[_chapterSelectorButton addTarget:self action:@selector(chapterSelectorAction:) forControlEvents:UIControlEventTouchUpInside];
_chapterSelectorButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
[self addSubview:_chapterSelectorButton];
_repeatButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_repeatButton setImage:[UIImage imageNamed:@"repeat.png"] forState:UIControlStateNormal];
_repeatButton.frame = CGRectMake(spacer, spacer + buttonHeight + spacer + buttonHeight + spacer, buttonWidth, buttonHeight);
[_repeatButton addTarget:self action:@selector(repeatAction:) forControlEvents:UIControlEventTouchUpInside];
_repeatButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
[self addSubview:_repeatButton];
_lockButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_lockButton setImage:[UIImage imageNamed:@"lock.png"] forState:UIControlStateNormal];
_lockButton.frame = CGRectMake(spacer, spacer + buttonHeight + spacer + buttonHeight + spacer + buttonHeight + spacer, buttonWidth, buttonHeight);
[_lockButton addTarget:self action:@selector(lockAction:) forControlEvents:UIControlEventTouchUpInside];
_lockButton.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
[self addSubview:_lockButton];
}
return self;
}
- (CGSize)proposedDisplaySize
{
_equalizerButton.hidden = !_showsEqualizer;
_chapterSelectorButton.hidden = !_mediaHasChapters;
CGFloat height;
CGRect workFrame;
if (_showsEqualizer) {
if (_mediaHasChapters) {
height = 5. * spacer + 4. * buttonHeight;
workFrame = _equalizerButton.frame;
workFrame.origin.y = spacer;
_equalizerButton.frame = workFrame;
_equalizerButton.hidden = NO;
workFrame = _chapterSelectorButton.frame;
workFrame.origin.y = spacer * 2. + buttonHeight;
_chapterSelectorButton.frame = workFrame;
_chapterSelectorButton.hidden = NO;
workFrame = _repeatButton.frame;
workFrame.origin.y = spacer * 3. + buttonHeight * 2.;
_repeatButton.frame = workFrame;
workFrame = _lockButton.frame;
workFrame.origin.y = spacer * 4. + buttonHeight * 3.;
_lockButton.frame = workFrame;
} else {
height = 4. * spacer + 3. * buttonHeight;
workFrame = _equalizerButton.frame;
workFrame.origin.y = spacer;
_equalizerButton.frame = workFrame;
_equalizerButton.hidden = NO;
_chapterSelectorButton.hidden = YES;
workFrame = _repeatButton.frame;
workFrame.origin.y = spacer * 2. + buttonHeight;
_repeatButton.frame = workFrame;
workFrame = _lockButton.frame;
workFrame.origin.y = spacer * 3. + buttonHeight * 2.;
_lockButton.frame = workFrame;
}
} else {
if (_mediaHasChapters) {
height = 4. * spacer + 3. * buttonHeight;
_equalizerButton.hidden = YES;
workFrame = _chapterSelectorButton.frame;