Commit f3f73653 authored by Tobias's avatar Tobias Committed by Felix Paul Kühne

use double tap to reset delay and speed sliders to default value fixes #14588

(cherry picked from commit 626a7dda)
parent 21163e0e
......@@ -207,9 +207,15 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="ahb-li-nqH" customClass="VLCSlider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="ahb-li-nqH" customClass="VLCResettingSlider">
<rect key="frame" x="18" y="21" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="resetOnDoubleTap" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="defaultValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="MB1-sB-W8m"/>
</connections>
......@@ -228,9 +234,15 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="juX-HR-PqD" customClass="VLCSlider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="juX-HR-PqD" customClass="VLCResettingSlider">
<rect key="frame" x="18" y="58" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="resetOnDoubleTap" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="defaultValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="acG-8w-Mgd"/>
</connections>
......@@ -249,9 +261,15 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="180" customClass="VLCSlider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="180" customClass="VLCResettingSlider">
<rect key="frame" x="18" y="96" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="resetOnDoubleTap" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="defaultValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="4Xo-T4-hPJ"/>
</connections>
......
......@@ -348,9 +348,15 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="oQe-Uu-1HY" customClass="VLCSlider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="oQe-Uu-1HY" customClass="VLCResettingSlider">
<rect key="frame" x="18" y="20" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="resetOnDoubleTap" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="defaultValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="MaZ-VI-xre"/>
</connections>
......@@ -369,9 +375,15 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="JRI-0m-C0M" customClass="VLCSlider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="JRI-0m-C0M" customClass="VLCResettingSlider">
<rect key="frame" x="18" y="58" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="resetOnDoubleTap" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="defaultValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="NUV-tI-BV8"/>
</connections>
......@@ -390,9 +402,15 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="168" customClass="VLCSlider">
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="168" customClass="VLCResettingSlider">
<rect key="frame" x="18" y="97" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="resetOnDoubleTap" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="defaultValue">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="6n6-9i-WXd"/>
</connections>
......
......@@ -19,3 +19,8 @@
@interface VLCSlider : UISlider
@end
@interface VLCResettingSlider : VLCSlider
@property (nonatomic) IBInspectable float defaultValue;
@property (nonatomic) IBInspectable BOOL resetOnDoubleTap;
@end
\ No newline at end of file
......@@ -83,3 +83,38 @@
}
@end
@interface VLCResettingSlider ()
@property (nonatomic, weak) UITapGestureRecognizer *doubleTapRecognizer;
@end
@implementation VLCResettingSlider
- (void)awakeFromNib
{
[super awakeFromNib];
if (self.resetOnDoubleTap) {
[self setResetOnDoubleTap:YES];
}
}
- (void)setResetOnDoubleTap:(BOOL)resetOnDoubleTap
{
_resetOnDoubleTap = resetOnDoubleTap;
if (resetOnDoubleTap && self.doubleTapRecognizer == nil) {
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didDoubleTap:)];
recognizer.numberOfTapsRequired = 2;
[self addGestureRecognizer:recognizer];
self.doubleTapRecognizer = recognizer;
} else if (!resetOnDoubleTap) {
UITapGestureRecognizer *recognizer = self.doubleTapRecognizer;
[self removeGestureRecognizer:recognizer];
self.doubleTapRecognizer = nil;
}
}
- (IBAction)didDoubleTap:(id)sender {
self.value = self.defaultValue;
[self sendActionsForControlEvents:UIControlEventValueChanged];
}
@end
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