Commit 38d41736 authored by Felix Paul Kühne's avatar Felix Paul Kühne

playback: give the user full control over the gestures to choose from (close #15449)

parent a91c79cf
......@@ -96,15 +96,55 @@
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_GESTURE_TITLE</string>
<string>SETTINGS_GESTURE</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableGesturesToControlPlayback</string>
<string>EnableVolumeGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES</string>
<string>SETTINGS_GESTURES_VOLUME</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnablePlayPauseGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_PLAYPAUSE</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableBrightnessGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_BRIGHTNESS</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableSeekGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_SEEK</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableCloseGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_CLOSE</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
......
......@@ -86,15 +86,55 @@
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_GESTURE_TITLE</string>
<string>SETTINGS_GESTURE</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableGesturesToControlPlayback</string>
<string>EnableVolumeGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES</string>
<string>SETTINGS_GESTURES_VOLUME</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnablePlayPauseGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_PLAYPAUSE</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableBrightnessGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_BRIGHTNESS</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableCloseGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_CLOSE</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableSeekGesture</string>
<key>Title</key>
<string>SETTINGS_GESTURES_SEEK</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
......
B/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */
......
......@@ -72,7 +72,12 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaultValue,
kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue,
kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue,
kVLCSettingPlaybackGestures : @(YES),
kVLCSettingVolumeGesture : @(YES),
kVLCSettingPlayPauseGesture : @(YES),
kVLCSettingBrightnessGesture : @(YES),
kVLCSettingSeekGesture : @(YES),
kVLCSettingCloseGesture : @(YES),
kVLCSettingVariableJumpDuration : @(NO),
kVLCSettingVideoFullscreenPlayback : @(YES),
kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue,
kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue,
......
......@@ -42,7 +42,11 @@
#define kVLCSettingNetworkCaching @"network-caching"
#define kVLCSettingNetworkCachingDefaultValue @(999)
#define kVLCSettingsDecrapifyTitles @"MLDecrapifyTitles"
#define kVLCSettingPlaybackGestures @"EnableGesturesToControlPlayback"
#define kVLCSettingVolumeGesture @"EnableVolumeGesture"
#define kVLCSettingPlayPauseGesture @"EnablePlayPauseGesture"
#define kVLCSettingBrightnessGesture @"EnableBrightnessGesture"
#define kVLCSettingSeekGesture @"EnableSeekGesture"
#define kVLCSettingCloseGesture @"EnableCloseGesture"
#define kVLCSettingVariableJumpDuration @"EnableVariableJumpDuration"
#define kVLCSettingVideoFullscreenPlayback @"AlwaysUseFullscreenForVideo"
#define kVLCSettingFTPTextEncoding @"ftp-text-encoding"
......
......@@ -247,17 +247,12 @@ static NSString *WiFiCellIdentifier = @"VLCMenuWiFiCell";
self.settingsViewController.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self.settingsController.viewController andSelector:@selector(dismiss:)];
}
_hiddenSettingKeys = [[NSMutableSet alloc] init];
IASKAppSettingsViewController *settingsVC = self.settingsViewController;
settingsVC.modalPresentationStyle = UIModalPresentationFormSheet;
settingsVC.delegate = self.settingsController;
settingsVC.showDoneButton = NO;
settingsVC.showCreditsFooter = NO;
if (![[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue])
[_hiddenSettingKeys addObject:@"EnableVariableJumpDuration"];
[self.settingsController.viewController setHiddenKeys:_hiddenSettingKeys];
viewController = settingsVC;
} else if (itemIndex == 1)
viewController = [[VLCAboutViewController alloc] init];
......
......@@ -71,7 +71,11 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
BOOL _switchingTracksNotChapters;
BOOL _audioOnly;
BOOL _swipeGesturesEnabled;
BOOL _volumeGestureEnabled;
BOOL _playPauseGestureEnabled;
BOOL _brightnessGestureEnabled;
BOOL _seekGestureEnabled;
BOOL _closeGestureEnabled;
BOOL _variableJumpDurationEnabled;
UIPinchGestureRecognizer *_pinchRecognizer;
VLCPanType _currentPanType;
......@@ -217,8 +221,6 @@ 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;
......@@ -399,17 +401,22 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.artistNameLabel.text = nil;
self.albumNameLabel.text = nil;
_swipeGesturesEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue];
_variableJumpDurationEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingVariableJumpDuration] boolValue];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
_volumeGestureEnabled = [[defaults objectForKey:kVLCSettingVolumeGesture] boolValue];
_playPauseGestureEnabled = [[defaults objectForKey:kVLCSettingPlayPauseGesture] boolValue];
_brightnessGestureEnabled = [[defaults objectForKey:kVLCSettingBrightnessGesture] boolValue];
_seekGestureEnabled = [[defaults objectForKey:kVLCSettingSeekGesture] boolValue];
_closeGestureEnabled = [[defaults objectForKey:kVLCSettingCloseGesture] boolValue];
_variableJumpDurationEnabled = [[defaults objectForKey:kVLCSettingVariableJumpDuration] boolValue];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.navigationController setNavigationBarHidden:YES animated:animated];
VLCPlaybackController *vpc = self.playbackController;
vpc.delegate = self;
[vpc recoverPlaybackState];
[self screenBrightnessChanged:nil];
[self setControlsHidden:NO animated:YES];
[self setControlsHidden:NO animated:animated];
}
- (void)viewDidAppear:(BOOL)animated
......@@ -497,7 +504,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
if (!_closeGestureEnabled)
return;
if (recognizer.velocity < 0.)
......@@ -1279,7 +1286,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
if (!_playPauseGestureEnabled)
return;
VLCPlaybackController *vpc = self.playbackController;
......@@ -1317,9 +1324,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
return;
CGFloat panDirectionX = [panRecognizer velocityInView:self.view].x;
CGFloat panDirectionY = [panRecognizer velocityInView:self.view].y;
......@@ -1327,6 +1331,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
_currentPanType = [self detectPanTypeForPan:panRecognizer];
if (_currentPanType == VLCPanTypeSeek) {
if (!_seekGestureEnabled)
return;
VLCMediaPlayer *mediaPlayer = self.playbackController.mediaPlayer;
double timeRemainingDouble = (-mediaPlayer.remainingTime.intValue*0.001);
int timeRemaining = timeRemainingDouble;
......@@ -1337,6 +1343,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
} else
[mediaPlayer jumpBackward:1];
} else if (_currentPanType == VLCPanTypeVolume) {
if (!_volumeGestureEnabled)
return;
MPMusicPlayerController *musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
......@@ -1348,6 +1356,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
musicPlayer.volume += 0.01;
#pragma clang diagnostic pop
} else if (_currentPanType == VLCPanTypeBrightness) {
if (!_brightnessGestureEnabled)
return;
CGFloat brightness = [UIScreen mainScreen].brightness;
if (panDirectionY > 0)
......@@ -1382,7 +1392,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{
LOCKCHECK;
if (!_swipeGesturesEnabled)
if (!_seekGestureEnabled)
return;
NSString * hudString = @" ";
......
......@@ -53,10 +53,6 @@
[self didChangePasscodeStatus:NO];
}
}
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
......
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