Sfoglia il codice sorgente

Fixes: Control playback with gestures

If the users disabled gestures and then started playback for the first
time, gesture recognizers weren't added to the viewController. If the
user now turned on gesture recognizers viewDidLoad wouldn't happen again
and the user had to kill the application to get gestures working.

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Christopher Loessl 11 anni fa
parent
commit
da70a4cdeb
1 ha cambiato i file con 26 aggiunte e 28 eliminazioni
  1. 26 28
      Sources/VLCMovieViewController.m

+ 26 - 28
Sources/VLCMovieViewController.m

@@ -237,34 +237,32 @@
     _displayRemainingTime = [[defaults objectForKey:kVLCShowRemainingTime] boolValue];
     _swipeGesturesEnabled = [[defaults objectForKey:kVLCSettingPlaybackGestures] boolValue];
 
-    if (_swipeGesturesEnabled) {
-        _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
-        _pinchRecognizer.delegate = self;
-        [self.view addGestureRecognizer:_pinchRecognizer];
-
-        _tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)];
-        [_tapRecognizer setNumberOfTouchesRequired:2];
-        _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
-        [_panRecognizer setMinimumNumberOfTouches:1];
-        [_panRecognizer setMaximumNumberOfTouches:1];
-
-        _swipeRecognizerLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
-        _swipeRecognizerLeft.direction = UISwipeGestureRecognizerDirectionLeft;
-        _swipeRecognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
-        _swipeRecognizerRight.direction = UISwipeGestureRecognizerDirectionRight;
-
-        [self.view addGestureRecognizer:_swipeRecognizerLeft];
-        [self.view addGestureRecognizer:_swipeRecognizerRight];
-        [self.view addGestureRecognizer:_panRecognizer];
-        [self.view addGestureRecognizer:_tapRecognizer];
-        [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft];
-        [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight];
-
-        _panRecognizer.delegate = self;
-        _swipeRecognizerRight.delegate = self;
-        _swipeRecognizerLeft.delegate = self;
-        _tapRecognizer.delegate = self;
-    }
+    _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
+    _pinchRecognizer.delegate = self;
+    [self.view addGestureRecognizer:_pinchRecognizer];
+
+    _tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)];
+    [_tapRecognizer setNumberOfTouchesRequired:2];
+    _panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
+    [_panRecognizer setMinimumNumberOfTouches:1];
+    [_panRecognizer setMaximumNumberOfTouches:1];
+
+    _swipeRecognizerLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
+    _swipeRecognizerLeft.direction = UISwipeGestureRecognizerDirectionLeft;
+    _swipeRecognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRecognized:)];
+    _swipeRecognizerRight.direction = UISwipeGestureRecognizerDirectionRight;
+
+    [self.view addGestureRecognizer:_swipeRecognizerLeft];
+    [self.view addGestureRecognizer:_swipeRecognizerRight];
+    [self.view addGestureRecognizer:_panRecognizer];
+    [self.view addGestureRecognizer:_tapRecognizer];
+    [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft];
+    [_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight];
+
+    _panRecognizer.delegate = self;
+    _swipeRecognizerRight.delegate = self;
+    _swipeRecognizerLeft.delegate = self;
+    _tapRecognizer.delegate = self;
 
     _aspectRatios = @[@"DEFAULT", @"FILL_TO_SCREEN", @"4:3", @"16:9", @"16:10", @"2.21:1"];