Commit 4a0ebf28 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

Revert "Playback: remove unrecognized tap gesture"

This reverts commit 26a8d4c9.
parent 88fc21cf
...@@ -49,9 +49,11 @@ ...@@ -49,9 +49,11 @@
BOOL _swipeGesturesEnabled; BOOL _swipeGesturesEnabled;
NSString * panType; NSString * panType;
UIView *_rootView; UIView *_rootView;
UIView *_splashView;
UIPanGestureRecognizer *_panRecognizer; UIPanGestureRecognizer *_panRecognizer;
UISwipeGestureRecognizer *_swipeRecognizerLeft; UISwipeGestureRecognizer *_swipeRecognizerLeft;
UISwipeGestureRecognizer *_swipeRecognizerRight; UISwipeGestureRecognizer *_swipeRecognizerRight;
UITapGestureRecognizer *_tapRecognizer;
} }
@property (nonatomic, strong) UIPopoverController *masterPopoverController; @property (nonatomic, strong) UIPopoverController *masterPopoverController;
...@@ -69,6 +71,10 @@ ...@@ -69,6 +71,10 @@
- (void)dealloc - (void)dealloc
{ {
if (_splashView)
[_splashView removeFromSuperview];
if (_tapRecognizer)
[_rootView removeGestureRecognizer:_tapRecognizer];
if (_swipeRecognizerLeft) if (_swipeRecognizerLeft)
[_rootView removeGestureRecognizer:_swipeRecognizerLeft]; [_rootView removeGestureRecognizer:_swipeRecognizerLeft];
if (_swipeRecognizerRight) if (_swipeRecognizerRight)
...@@ -190,6 +196,8 @@ ...@@ -190,6 +196,8 @@
_swipeGesturesEnabled = YES; _swipeGesturesEnabled = YES;
if (_swipeGesturesEnabled) { if (_swipeGesturesEnabled) {
_tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)];
[_tapRecognizer setNumberOfTouchesRequired:2];
_panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)]; _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
[_panRecognizer setMinimumNumberOfTouches:1]; [_panRecognizer setMinimumNumberOfTouches:1];
[_panRecognizer setMaximumNumberOfTouches:1]; [_panRecognizer setMaximumNumberOfTouches:1];
...@@ -204,12 +212,14 @@ ...@@ -204,12 +212,14 @@
[_rootView addGestureRecognizer:_swipeRecognizerLeft]; [_rootView addGestureRecognizer:_swipeRecognizerLeft];
[_rootView addGestureRecognizer:_swipeRecognizerRight]; [_rootView addGestureRecognizer:_swipeRecognizerRight];
[_rootView addGestureRecognizer:_panRecognizer]; [_rootView addGestureRecognizer:_panRecognizer];
[_rootView addGestureRecognizer:_tapRecognizer];
[_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft]; [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft];
[_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight]; [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight];
_panRecognizer.delegate = self; _panRecognizer.delegate = self;
_swipeRecognizerRight.delegate = self; _swipeRecognizerRight.delegate = self;
_swipeRecognizerLeft.delegate = self; _swipeRecognizerLeft.delegate = self;
_tapRecognizer.delegate = self;
} }
_aspectRatios = @[@"DEFAULT", @"FILL_TO_SCREEN", @"4:3", @"16:9", @"16:10", @"2.21:1"]; _aspectRatios = @[@"DEFAULT", @"FILL_TO_SCREEN", @"4:3", @"16:9", @"16:10", @"2.21:1"];
...@@ -858,6 +868,21 @@ ...@@ -858,6 +868,21 @@
#pragma mark - multi-touch gestures #pragma mark - multi-touch gestures
- (void)tapRecognized
{
if ([_mediaPlayer isPlaying]) {
[_mediaPlayer pause];
[self.statusLabel showStatusMessage:@" ▌▌"];
} else {
[_mediaPlayer play];
[self.statusLabel showStatusMessage:@" ►"];
}
[_rootView addSubview:_splashView];
[UIView animateWithDuration:1
animations:^{ _splashView.alpha = 0.0f;}
completion:^(BOOL finished){ [_splashView removeFromSuperview]; }];
}
- (NSString*)detectPanTypeForPan:(UIPanGestureRecognizer*)panRecognizer - (NSString*)detectPanTypeForPan:(UIPanGestureRecognizer*)panRecognizer
{ {
NSString * type; NSString * type;
...@@ -950,6 +975,7 @@ ...@@ -950,6 +975,7 @@
} }
if (swipeRecognizer.state == UIGestureRecognizerStateEnded) { if (swipeRecognizer.state == UIGestureRecognizerStateEnded) {
[_rootView addSubview:_splashView];
if ([_mediaPlayer isPlaying]) if ([_mediaPlayer isPlaying])
[_mediaPlayer play]; [_mediaPlayer play];
......
Supports Markdown
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