UI: tap to hide controls in video call

This commit is contained in:
Gautier Pelloux-Prayer 2015-11-19 17:08:46 +01:00
parent dfb4d1d387
commit 6cea81b103
2 changed files with 18 additions and 11 deletions

View file

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CallOutgoingView">
<connections>
<outlet property="addressLabel" destination="2fa-Ag-3GW" id="2Oe-UW-rPC"/>
<outlet property="avatarImage" destination="bNo-O5-DWh" id="eqo-0s-UoN"/>
<outlet property="landscapeView" destination="25" id="BE7-nd-tcd"/>
<outlet property="nameLabel" destination="d5s-yP-8VE" id="0VY-HP-ovD"/>
<outlet property="portraitView" destination="25" id="32"/>
<outlet property="view" destination="25" id="26"/>
@ -108,7 +109,7 @@
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<animations/>
<accessibility key="accessibilityConfiguration" label="Contact avatar">
<accessibilityTraits key="traits" none="YES" image="YES" notEnabled="YES"/>
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
<bool key="isElement" value="YES"/>
</accessibility>
</imageView>
@ -138,9 +139,4 @@
<image name="speaker_disabled.png" width="27" height="25"/>
<image name="speaker_selected.png" width="27" height="25"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -43,7 +43,7 @@ const NSInteger SECURE_BUTTON_TAG = 5;
- (id)init {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:[NSBundle mainBundle]];
if (self != nil) {
singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControls:)];
singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControls:)];
videoZoomHandler = [[VideoZoomHandler alloc] init];
blackVideoStatusBar = [[UIView alloc] init];
blackVideoStatusBar.backgroundColor = [UIColor blackColor];
@ -172,7 +172,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[singleFingerTap setNumberOfTapsRequired:1];
[singleFingerTap setCancelsTouchesInView:FALSE];
[PhoneMainView.instance.view addGestureRecognizer:singleFingerTap];
[self.videoView addGestureRecognizer:singleFingerTap];
[videoZoomHandler setup:_videoGroup];
_videoGroup.alpha = 0;
@ -289,6 +289,15 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
- (void)toggleControls:(id)sender {
bool controlsHidden = (_bottomBar.alpha == 0.0);
if (controlsHidden) {
[self showControls:sender];
} else {
[self hideControls:sender];
}
}
- (void)showControls:(id)sender {
if (hideControlsTimer) {
[hideControlsTimer invalidate];
@ -297,7 +306,6 @@ static UICompositeViewDescription *compositeDescription = nil;
if ([[PhoneMainView.instance currentView] equal:CallView.compositeViewDescription]) {
// show controls
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.35];
_pausedCallsTable.tableView.alpha = _videoCameraSwitch.alpha = _callPauseButton.alpha = 1.0;
@ -319,6 +327,9 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)hideControls:(id)sender {
if (!videoShown)
return;
if (hideControlsTimer) {
[hideControlsTimer invalidate];
hideControlsTimer = nil;