improve keyboard toggle by adding keyboard notification. minor UI string change
This commit is contained in:
1 parent
72547b1b59
commit
f85b736c97
4 files changed
+32
-12
No files matched your search
@@ -75,6 +75,15 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
keyboardToggleRecognizer.tapDownTimeThreshold = 300.0; // tap down time threshold in milli seconds.
|
keyboardToggleRecognizer.tapDownTimeThreshold = 300.0; // tap down time threshold in milli seconds.
|
||||||
keyboardToggleRecognizer.delaysTouchesBegan = NO;
|
keyboardToggleRecognizer.delaysTouchesBegan = NO;
|
||||||
keyboardToggleRecognizer.delaysTouchesEnded = NO;
|
keyboardToggleRecognizer.delaysTouchesEnded = NO;
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(keyboardWillShow)
|
||||||
|
name:UIKeyboardWillShowNotification
|
||||||
|
object:nil];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(keyboardWillHide)
|
||||||
|
name:UIKeyboardWillHideNotification
|
||||||
|
object:nil];
|
||||||
[self addGestureRecognizer:keyboardToggleRecognizer];
|
[self addGestureRecognizer:keyboardToggleRecognizer];
|
||||||
|
|
||||||
#if TARGET_OS_TV
|
#if TARGET_OS_TV
|
||||||
@@ -143,15 +152,25 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
[self becomeFirstResponder];
|
[self becomeFirstResponder];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyboardWillShow{
|
||||||
|
isInputingText = true;
|
||||||
|
// NSLog(@"keyboard will show");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)keyboardWillHide{
|
||||||
|
isInputingText = false;
|
||||||
|
// NSLog(@"keyboard will hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)toggleKeyboard{
|
- (void)toggleKeyboard{
|
||||||
if (false){
|
|
||||||
isInputingText = false;
|
|
||||||
}
|
|
||||||
if (isInputingText) {
|
if (isInputingText) {
|
||||||
Log(LOG_D, @"Closing the keyboard");
|
Log(LOG_D, @"Closing the keyboard");
|
||||||
|
// NSLog(@"Closing the keyboard");
|
||||||
[keyInputField resignFirstResponder];
|
[keyInputField resignFirstResponder];
|
||||||
isInputingText = false;
|
isInputingText = false;
|
||||||
} else {
|
} else {
|
||||||
|
// NSLog(@"Opening the keyboard");
|
||||||
Log(LOG_D, @"Opening the keyboard");
|
Log(LOG_D, @"Opening the keyboard");
|
||||||
// Prepare the textbox used to capture keyboard events.
|
// Prepare the textbox used to capture keyboard events.
|
||||||
keyInputField.delegate = self;
|
keyInputField.delegate = self;
|
||||||
@@ -178,7 +197,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
[keyInputField addTarget:self action:@selector(onKeyboardPressed:) forControlEvents:UIControlEventEditingChanged];
|
[keyInputField addTarget:self action:@selector(onKeyboardPressed:) forControlEvents:UIControlEventEditingChanged];
|
||||||
// Undo causes issues for our state management, so turn it off
|
// Undo causes issues for our state management, so turn it off
|
||||||
[keyInputField.undoManager disableUndoRegistration];
|
[keyInputField.undoManager disableUndoRegistration];
|
||||||
isInputingText = true;
|
//isInputingText = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,7 +508,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
// activation of one or two finger gestures when a three finger gesture
|
// activation of one or two finger gestures when a three finger gesture
|
||||||
// is triggered.
|
// is triggered.
|
||||||
[touchHandler touchesBegan:touches withEvent:event];
|
[touchHandler touchesBegan:touches withEvent:event];
|
||||||
|
// I refactored keyboard toggle by the CustomTapGestureRecognizer
|
||||||
// if ([[event allTouches] count] == keyboardToggleFingers) [self toggleKeyboard];
|
// if ([[event allTouches] count] == keyboardToggleFingers) [self toggleKeyboard];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ BOOL isCustomResolution(CGSize res) {
|
|||||||
[self updateBitrateText];
|
[self updateBitrateText];
|
||||||
[self updateResolutionDisplayViewText];
|
[self updateResolutionDisplayViewText];
|
||||||
[self.keyboardToggleFingerNumSlider setValue:(CGFloat)currentSettings.keyboardToggleFingers.intValue animated:YES]; // Load old setting. old setting was converted to uint32_t before saving.
|
[self.keyboardToggleFingerNumSlider setValue:(CGFloat)currentSettings.keyboardToggleFingers.intValue animated:YES]; // Load old setting. old setting was converted to uint32_t before saving.
|
||||||
[self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Fingers to Tap on Local Keyboard: %@", @((uint16_t)self.keyboardToggleFingerNumSlider.value)]]; // Initiate label display
|
[self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Fingers to Tap-Toggle Local Keyboard: %@", @((uint16_t)self.keyboardToggleFingerNumSlider.value)]]; // Initiate label display
|
||||||
[self.keyboardToggleFingerNumSlider addTarget:self action:@selector(keyboardToggleFingerNumSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
[self.keyboardToggleFingerNumSlider addTarget:self action:@selector(keyboardToggleFingerNumSliderMoved) forControlEvents:(UIControlEventValueChanged)]; // Update label display when slider is being moved.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ BOOL isCustomResolution(CGSize res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void) keyboardToggleFingerNumSliderMoved{
|
- (void) keyboardToggleFingerNumSliderMoved{
|
||||||
[self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Fingers to Tap on Local Keyboard: %@", @((uint8_t)self.keyboardToggleFingerNumSlider.value)]];
|
[self.keyboardToggleFingerNumLabel setText:[NSString stringWithFormat:@"Fingers to Tap-Toggle Local Keyboard: %@", @((uint8_t)self.keyboardToggleFingerNumSlider.value)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
// FIXME: This doesn't work reliably on iPad for some reason. Showing and hiding the keyboard
|
// FIXME: This doesn't work reliably on iPad for some reason. Showing and hiding the keyboard
|
||||||
// several times in a row will not correctly restore the state of the UIScrollView.
|
// several times in a row will not correctly restore the state of the UIScrollView.
|
||||||
|
// I add this notification to the StreamView, works well on ipad mini6.
|
||||||
[[NSNotificationCenter defaultCenter] addObserver: self
|
[[NSNotificationCenter defaultCenter] addObserver: self
|
||||||
selector: @selector(keyboardWillShow:)
|
selector: @selector(keyboardWillShow:)
|
||||||
name: UIKeyboardWillShowNotification
|
name: UIKeyboardWillShowNotification
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="EVd-wq-ego">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="EVd-wq-ego">
|
||||||
<device id="ipad11_0rounded" orientation="portrait" layout="fullscreen" appearance="dark"/>
|
<device id="ipad11_0rounded" orientation="portrait" layout="fullscreen" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
|
||||||
@@ -130,11 +130,11 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="e4G-id-vjI" userLabel="Touch Mode Selector">
|
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="e4G-id-vjI" userLabel="Touch Mode Selector">
|
||||||
<rect key="frame" x="16" y="284" width="459" height="28"/>
|
<rect key="frame" x="16" y="282" width="459" height="32"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<segments>
|
<segments>
|
||||||
<segment title="Touchpad"/>
|
<segment title="Touchpad"/>
|
||||||
<segment title="Touchscreen"/>
|
<segment title="Native Multi-Point Touch"/>
|
||||||
</segments>
|
</segments>
|
||||||
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="selectedSegmentTintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
@@ -319,8 +319,8 @@
|
|||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
</slider>
|
</slider>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Fingers to Tap on Local Keyboard: 3 " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="nh6-cn-z23">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Fingers to Tap-Toggle Local Keyboard: 3 " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="nh6-cn-z23">
|
||||||
<rect key="frame" x="20" y="396" width="324" height="21"/>
|
<rect key="frame" x="20" y="396" width="358" height="21"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<color key="tintColor" red="0.81533776120000001" green="0.85979419950000002" blue="0.91372549020000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="tintColor" red="0.81533776120000001" green="0.85979419950000002" blue="0.91372549020000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
|
|||||||
Reference in new issue
Block a user