Ver código fonte

Gesture submenu added & ability to choose jump mode

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>

include new menu items in Root.plist

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Kevin Chromik 10 anos atrás
pai
commit
4bb5a378ac

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

@@ -57,16 +57,6 @@
 			</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>PSMultiValueSpecifier</string>
 			<key>Title</key>
@@ -96,6 +86,32 @@
 			<key>Type</key>
 			<string>PSGroupSpecifier</string>
 			<key>Title</key>
+			<string>SETTINGS_GESTURE_TITLE</string>
+		</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>DefaultValue</key>
+			<false/>
+			<key>Key</key>
+			<string>EnableVariableJumpDuration</string>
+			<key>Title</key>
+			<string>SETTINGS_GESTURE_JUMP_DURATION</string>
+			<key>Type</key>
+			<string>PSToggleSwitchSpecifier</string>
+		</dict>
+		<dict>
+			<key>Type</key>
+			<string>PSGroupSpecifier</string>
+			<key>Title</key>
 			<string>SETTINGS_VIDEO_TITLE</string>
 		</dict>
 		<dict>

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

@@ -47,16 +47,6 @@
 			</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>PSMultiValueSpecifier</string>
 			<key>Title</key>
@@ -86,6 +76,32 @@
 			<key>Type</key>
 			<string>PSGroupSpecifier</string>
 			<key>Title</key>
+			<string>SETTINGS_GESTURE_TITLE</string>
+		</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>DefaultValue</key>
+			<false/>
+			<key>Key</key>
+			<string>EnableVariableJumpDuration</string>
+			<key>Title</key>
+			<string>SETTINGS_GESTURE_JUMP_DURATION</string>
+			<key>Type</key>
+			<string>PSToggleSwitchSpecifier</string>
+		</dict>
+		<dict>
+			<key>Type</key>
+			<string>PSGroupSpecifier</string>
+			<key>Title</key>
 			<string>SETTINGS_VIDEO_TITLE</string>
 		</dict>
 		<dict>

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


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
Sources/VLCAppDelegate.m


+ 1 - 0
Sources/VLCConstants.h

@@ -41,6 +41,7 @@
 #define kVLCSettingNetworkCachingDefaultValue @(999)
 #define kVLCSettingsDecrapifyTitles @"MLDecrapifyTitles"
 #define kVLCSettingPlaybackGestures @"EnableGesturesToControlPlayback"
+#define kVLCSettingVariableJumpDuration @"EnableVariableJumpDuration"
 #define kVLCSettingFTPTextEncoding @"ftp-text-encoding"
 #define kVLCSettingFTPTextEncodingDefaultValue @(5) // ISO Latin 1
 #define kVLCSettingPlaybackSpeedDefaultValue @"playback-speed"

+ 7 - 0
Sources/VLCMenuTableViewController.m

@@ -42,6 +42,7 @@
     NSArray *_menuItemsSectionOne;
     NSArray *_menuItemsSectionTwo;
     NSArray *_menuItemsSectionThree;
+    NSMutableSet *_hiddenSettingKeys;
 
     UILabel *_uploadLocationLabel;
     UIButton *_uploadButton;
@@ -330,12 +331,18 @@
                 self.settingsViewController.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self.settingsController.viewController andSelector:@selector(dismiss:)];
             }
 
+            _hiddenSettingKeys = [[NSMutableSet alloc] init];
             self.settingsViewController.modalPresentationStyle = UIModalPresentationFormSheet;
             self.settingsViewController.delegate = self.settingsController;
             self.settingsViewController.showDoneButton = NO;
             self.settingsViewController.showCreditsFooter = NO;
 
+            if (![[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue])
+                [_hiddenSettingKeys addObject:@"EnableVariableJumpDuration"];
+
+            [self.settingsController.viewController setHiddenKeys:_hiddenSettingKeys];
             viewController = self.settingsController.viewController;
+
         } else if (itemIndex == 1)
             viewController = [[VLCAboutViewController alloc] init];
     } else {

+ 14 - 8
Sources/VLCMovieViewController.m

@@ -31,6 +31,8 @@
 #import "VLCStatusLabel.h"
 
 #define INPUT_RATE_DEFAULT  1000.
+#define FORWARD_SWIPE_DURATION 30
+#define BACKWARD_SWIPE_DURATION 10
 
 #define TRACK_SELECTOR_TABLEVIEW_CELL @"track selector table view cell"
 #define TRACK_SELECTOR_TABLEVIEW_SECTIONHEADER @"track selector table view section header"
@@ -75,6 +77,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
     BOOL _switchingTracksNotChapters;
 
     BOOL _swipeGesturesEnabled;
+    BOOL _variableJumpDurationEnabled;
     UIPinchGestureRecognizer *_pinchRecognizer;
     VLCPanType _currentPanType;
     UIPanGestureRecognizer *_panRecognizer;
@@ -288,6 +291,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     _displayRemainingTime = [[defaults objectForKey:kVLCShowRemainingTime] boolValue];
     _swipeGesturesEnabled = [[defaults objectForKey:kVLCSettingPlaybackGestures] boolValue];
+    _variableJumpDurationEnabled = [[defaults objectForKey:kVLCSettingVariableJumpDuration] boolValue];
 
     _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
     _pinchRecognizer.delegate = self;
@@ -521,6 +525,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
     self.albumNameLabel.text = nil;
 
     _swipeGesturesEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue];
+    _variableJumpDurationEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingVariableJumpDuration] boolValue];
 
     [self.navigationController setNavigationBarHidden:YES animated:YES];
 
@@ -1890,25 +1895,26 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
         return;
 
     NSString * hudString = @" ";
-    int swipeDuration = (int)(_mediaDuration*0.001*0.05);
+    int swipeForwardDuration = (_variableJumpDurationEnabled) ? ((int)(_mediaDuration*0.001*0.05)) : FORWARD_SWIPE_DURATION;
+    int swipeBackwardDuration = (_variableJumpDurationEnabled) ? ((int)(_mediaDuration*0.001*0.05)) : BACKWARD_SWIPE_DURATION;
 
     if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
         double timeRemainingDouble = (-_mediaPlayer.remainingTime.intValue*0.001);
         int timeRemaining = timeRemainingDouble;
 
-        if (swipeDuration < timeRemaining) {
-            if (swipeDuration < 1)
-                swipeDuration = 1;
-            [_mediaPlayer jumpForward:swipeDuration];
-            hudString = [NSString stringWithFormat:@"⇒ %is", swipeDuration];
+        if (swipeForwardDuration < timeRemaining) {
+            if (swipeForwardDuration < 1)
+                swipeForwardDuration = 1;
+            [_mediaPlayer jumpForward:swipeForwardDuration];
+            hudString = [NSString stringWithFormat:@"⇒ %is", swipeForwardDuration];
         } else {
             [_mediaPlayer jumpForward:(timeRemaining - 5)];
             hudString = [NSString stringWithFormat:@"⇒ %is",(timeRemaining - 5)];
         }
     }
     else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
-        [_mediaPlayer jumpBackward:swipeDuration];
-        hudString = [NSString stringWithFormat:@"⇐ %is",swipeDuration];
+        [_mediaPlayer jumpBackward:swipeBackwardDuration];
+        hudString = [NSString stringWithFormat:@"⇐ %is",swipeBackwardDuration];
     }else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionUp) {
         [self backward:self];
     }

+ 4 - 2
Sources/VLCSettingsController.m

@@ -20,9 +20,7 @@
 #import "PAPasscodeViewController.h"
 
 @interface VLCSettingsController ()<PAPasscodeViewControllerDelegate, IASKSettingsDelegate>
-{
 
-}
 @end
 
 @implementation VLCSettingsController
@@ -52,6 +50,10 @@
             [self.viewController presentViewController:passcodeLockController animated:YES completion:nil];
         }
     }
+    if ([notification.object isEqual:kVLCSettingPlaybackGestures]) {
+        BOOL enabled = (BOOL)[[notification.userInfo objectForKey:@"EnableGesturesToControlPlayback"] intValue];
+        [self.viewController setHiddenKeys:enabled ? nil : [NSSet setWithObjects:@"EnableVariableJumpDuration", nil] animated:YES];
+    }
 }
 
 - (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender