Просмотр исходного кода

Added option to disable playback control gestures (close #10592)

Felix Paul Kühne 11 лет назад
Родитель
Сommit
1dfa5ec732

+ 3 - 2
NEWS

@@ -2,13 +2,14 @@
 ------
 * WiFi uploads and HTTP downloads continue in the background
   (2 min on iOS 7, 10 min on iOS 6)
+* Added option to disable playback control gestures (#10592)
 * Fixed serial ftp downloads
 * Added support for m4b, caf, oma, w64 audio files
-* Stability improvements
+* Stability improvements and UX tweaks (amongst others #10601)
 
 2.2.2:
 ------
-* Fixed audio playback regression introduced in previous update
+* Fixed audio playback regression introduced in previous update (#10597)
 * Updated translations to Arabic, Chinese (Hans), Dutch, Galician, Hungarian,
   Portuguese
 

+ 10 - 0
Resources/Settings.bundle/Root.inApp.plist

@@ -57,6 +57,16 @@
 			</array>
 		</dict>
 		<dict>
+			<key>DefaultValue</key>
+			<true/>
+			<key>Key</key>
+			<string>EnableGesturesToControlPlayback</string>
+			<key>Title</key>
+			<string>SETTINGS_GESTURES</string>
+			<key>Type</key>
+			<string>PSToggleSwitchSpecifier</string>
+		</dict>
+		<dict>
 			<key>Type</key>
 			<string>PSGroupSpecifier</string>
 			<key>Title</key>

+ 10 - 0
Resources/Settings.bundle/Root.plist

@@ -47,6 +47,16 @@
 			</array>
 		</dict>
 		<dict>
+			<key>DefaultValue</key>
+			<true/>
+			<key>Key</key>
+			<string>EnableGesturesToControlPlayback</string>
+			<key>Title</key>
+			<string>SETTINGS_GESTURES</string>
+			<key>Type</key>
+			<string>PSToggleSwitchSpecifier</string>
+		</dict>
+		<dict>
 			<key>Type</key>
 			<string>PSGroupSpecifier</string>
 			<key>Title</key>

BIN
Resources/Settings.bundle/en.lproj/Root.strings


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
Sources/VLCAppDelegate.m


+ 3 - 2
Sources/VLCConstants.h

@@ -2,7 +2,7 @@
  * VLCConstants.h
  * VLC for iOS
  *****************************************************************************
- * Copyright (c) 2013 VideoLAN. All rights reserved.
+ * Copyright (c) 2013-2014 VideoLAN. All rights reserved.
  * $Id$
  *
  * Authors: Felix Paul Kühne <fkuehne # videolan.org>
@@ -36,7 +36,8 @@
 #define kVLCSettingDeinterlaceDefaultValue @(0)
 #define kVLCSettingNetworkCaching @"network-caching"
 #define kVLCSettingNetworkCachingDefaultValue @(999)
-#define kVLCSettingsDecrapifyTitles = @"MLDecrapifyTitles";
+#define kVLCSettingsDecrapifyTitles @"MLDecrapifyTitles"
+#define kVLCSettingPlaybackGestures @"EnableGesturesToControlPlayback"
 
 #define kVLCShowRemainingTime @"show-remaining-time"
 #define kVLCRecentURLs @"recent-urls"

+ 31 - 9
Sources/VLCMovieViewController.m

@@ -57,10 +57,12 @@
 
     BOOL _swipeGesturesEnabled;
     NSString * panType;
+    UIPinchGestureRecognizer *_pinchRecognizer;
     UIPanGestureRecognizer *_panRecognizer;
     UISwipeGestureRecognizer *_swipeRecognizerLeft;
     UISwipeGestureRecognizer *_swipeRecognizerRight;
     UITapGestureRecognizer *_tapRecognizer;
+    UITapGestureRecognizer *_tapOnVideoRecognizer;
 }
 
 @property (nonatomic, strong) UIPopoverController *masterPopoverController;
@@ -88,10 +90,18 @@
         [self.view removeGestureRecognizer:_swipeRecognizerRight];
     if (_panRecognizer)
         [self.view removeGestureRecognizer:_panRecognizer];
+    if (_pinchRecognizer)
+        [self.view removeGestureRecognizer:_pinchRecognizer];
+    [self.view removeGestureRecognizer:_tapOnVideoRecognizer];
+
     _tapRecognizer = nil;
     _swipeRecognizerLeft = nil;
     _swipeRecognizerRight = nil;
     _panRecognizer = nil;
+    _pinchRecognizer = nil;
+    _tapOnVideoRecognizer = nil;
+
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
 
 #pragma mark - Managing the media item
@@ -217,18 +227,19 @@
     self.trackNameLabel.text = self.artistNameLabel.text = self.albumNameLabel.text = @"";
 
     _movieView.userInteractionEnabled = NO;
-    UITapGestureRecognizer *tapOnVideoRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControlsVisible)];
-    tapOnVideoRecognizer.delegate = self;
-    [self.view addGestureRecognizer:tapOnVideoRecognizer];
-
-    _displayRemainingTime = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCShowRemainingTime] boolValue];
+    _tapOnVideoRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControlsVisible)];
+    _tapOnVideoRecognizer.delegate = self;
+    [self.view addGestureRecognizer:_tapOnVideoRecognizer];
 
-    UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
-    pinchRecognizer.delegate = self;
-    [self.view addGestureRecognizer:pinchRecognizer];
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    _displayRemainingTime = [[defaults objectForKey:kVLCShowRemainingTime] boolValue];
+    _swipeGesturesEnabled = [[defaults objectForKey:kVLCSettingPlaybackGestures] boolValue];
 
-    _swipeGesturesEnabled = YES;
     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:)];
@@ -351,6 +362,8 @@
 {
     [super viewWillAppear:animated];
 
+    _swipeGesturesEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue];
+
     [self.navigationController setNavigationBarHidden:YES animated:YES];
 
     if (!SYSTEM_RUNS_IOS7_OR_LATER) {
@@ -680,12 +693,18 @@
 
 - (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
 {
+    if (!_swipeGesturesEnabled)
+        return;
+
     if (recognizer.velocity < 0.)
         [self closePlayback:nil];
 }
 
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
 {
+    if (!_swipeGesturesEnabled)
+        return NO;
+
     if (touch.view != self.view)
         return NO;
 
@@ -694,6 +713,9 @@
 
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
 {
+    if (!_swipeGesturesEnabled)
+        return NO;
+
     return YES;
 }