Commit 1c3372f6 authored by Tobias's avatar Tobias

fix info VC appearance animations

implement manual swipe down detection in addition to up arrow press to show info VC
only allow menu tap gesture recognizer to begin if currently scrubbing (removes the need for manual dismissal)
parent 02703d26
......@@ -13,7 +13,7 @@
#import "VLCPlaybackInfoTVViewController.h"
@interface VLCFullscreenMovieTVViewController (UIViewControllerTransitioningDelegate) <UIViewControllerTransitioningDelegate>
@interface VLCFullscreenMovieTVViewController (UIViewControllerTransitioningDelegate) <UIViewControllerTransitioningDelegate, UIGestureRecognizerDelegate>
@end
@interface VLCFullscreenMovieTVViewController ()
......@@ -60,15 +60,6 @@
// Panning and Swiping
// does not work with pan gesture
// UISwipeGestureRecognizer *swipeDownRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeDownRecognized:)];
// swipeDownRecognizer.direction = UISwipeGestureRecognizerDirectionDown;
// [self.view addGestureRecognizer:swipeDownRecognizer];
UITapGestureRecognizer *swipeDownRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(swipeDownRecognized:)];
swipeDownRecognizer.allowedPressTypes = @[@(UIPressTypeUpArrow)];
[self.view addGestureRecognizer:swipeDownRecognizer];
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGesture:)];
[self.view addGestureRecognizer:panGestureRecognizer];
......@@ -83,7 +74,13 @@
UITapGestureRecognizer *menuTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(menuButtonPressed:)];
menuTapGestureRecognizer.allowedPressTypes = @[@(UIPressTypeMenu)];
menuTapGestureRecognizer.delegate = self;
[self.view addGestureRecognizer:menuTapGestureRecognizer];
UITapGestureRecognizer *upArrowRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showInfoVCIfNotScrubbing)];
upArrowRecognizer.allowedPressTypes = @[@(UIPressTypeUpArrow)];
[self.view addGestureRecognizer:upArrowRecognizer];
}
#pragma mark - view events
......@@ -147,8 +144,11 @@
CGPoint translation = [panGestureRecognizer translationInView:view];
if (!bar.scrubbing) {
if (ABS(translation.x) > 100.0) {
if (ABS(translation.x) > 150.0) {
[self startScrubbing];
} else if (translation.y > 200.0) {
[self showInfoVCIfNotScrubbing];
return;
} else {
return;
}
......@@ -184,12 +184,10 @@
}];
[self updateTimeLabelsForScrubbingFraction:bar.playbackFraction];
[self stopScrubbing];
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}
- (void)swipeDownRecognized:(UITapGestureRecognizer *)recognizer
- (void)showInfoVCIfNotScrubbing
{
if (self.transportBar.scrubbing) {
return;
......@@ -312,6 +310,15 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
transportBar.playbackFraction = mediaPlayer.position;
}
#pragma mark - gesture recognizer delegate
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
if ([gestureRecognizer.allowedPressTypes containsObject:@(UIPressTypeMenu)]) {
return self.transportBar.scrubbing;
}
return YES;
}
@end
......
......@@ -96,6 +96,7 @@
}
infoVC.view.frame = fromFrame;
[infoVC.view layoutIfNeeded];
// fallback
if (!infoVC) {
......@@ -105,6 +106,7 @@
[UIView animateWithDuration:[self transitionDuration:transitionContext]
animations:^{
infoVC.view.frame = toFrame;
[infoVC.view layoutIfNeeded];
infoVC.dimmingView.alpha = targetAlpha;
}
completion:^(BOOL finished) {
......
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