WIP: call view changes

pull/1/head
Michael Kirk 7 years ago committed by Matthew Chen
parent 20424d9a7e
commit b8707b6fa4

@ -227,8 +227,6 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
blurView.isUserInteractionEnabled = false blurView.isUserInteractionEnabled = false
self.view.addSubview(blurView) self.view.addSubview(blurView)
self.view.setHLayoutMargins(0)
// Create the video views first, as they are under the other views. // Create the video views first, as they are under the other views.
createVideoViews() createVideoViews()
createContactViews() createContactViews()
@ -276,7 +274,8 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
contactNameLabel.trailingBuffer = ScaleFromIPhone5(80.0) contactNameLabel.trailingBuffer = ScaleFromIPhone5(80.0)
// label config // label config
contactNameLabel.font = UIFont.ows_lightFont(withSize: ScaleFromIPhone5To7Plus(32, 40)) contactNameLabel.font = UIFont.ows_dynamicTypeTitle1
contactNameLabel.textAlignment = .center
contactNameLabel.textColor = UIColor.white contactNameLabel.textColor = UIColor.white
contactNameLabel.layer.shadowOffset = CGSize.zero contactNameLabel.layer.shadowOffset = CGSize.zero
contactNameLabel.layer.shadowOpacity = 0.35 contactNameLabel.layer.shadowOpacity = 0.35
@ -285,11 +284,13 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
self.view.addSubview(contactNameLabel) self.view.addSubview(contactNameLabel)
callStatusLabel = UILabel() callStatusLabel = UILabel()
callStatusLabel.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(19, 25)) callStatusLabel.font = UIFont.ows_dynamicTypeBody
callStatusLabel.textAlignment = .center
callStatusLabel.textColor = UIColor.white callStatusLabel.textColor = UIColor.white
callStatusLabel.layer.shadowOffset = CGSize.zero callStatusLabel.layer.shadowOffset = CGSize.zero
callStatusLabel.layer.shadowOpacity = 0.35 callStatusLabel.layer.shadowOpacity = 0.35
callStatusLabel.layer.shadowRadius = 4 callStatusLabel.layer.shadowRadius = 4
self.view.addSubview(callStatusLabel) self.view.addSubview(callStatusLabel)
contactAvatarContainerView = UIView.container() contactAvatarContainerView = UIView.container()
@ -358,8 +359,6 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
func createOngoingCallControls() { func createOngoingCallControls() {
// textMessageButton = createButton(imageName:"message-active-wide",
// action:#selector(didPressTextMessage))
audioSourceButton = createButton(image: #imageLiteral(resourceName: "audio-call-speaker-inactive"), audioSourceButton = createButton(image: #imageLiteral(resourceName: "audio-call-speaker-inactive"),
action: #selector(didPressAudioSource)) action: #selector(didPressAudioSource))
audioSourceButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_AUDIO_SOURCE_LABEL", audioSourceButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_AUDIO_SOURCE_LABEL",
@ -482,8 +481,10 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
// MARK: - Layout // MARK: - Layout
var localVideoViewTopConstraint: NSLayoutConstraint!
func createViewConstraints() { func createViewConstraints() {
let topMargin = CGFloat(40)
let contactVSpacing = CGFloat(3) let contactVSpacing = CGFloat(3)
let settingsNagHMargin = CGFloat(30) let settingsNagHMargin = CGFloat(30)
let ongoingBottomMargin = ScaleFromIPhone5To7Plus(23, 41) let ongoingBottomMargin = ScaleFromIPhone5To7Plus(23, 41)
@ -501,27 +502,30 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
// Dark blurred background. // Dark blurred background.
blurView.autoPinEdgesToSuperviewEdges() blurView.autoPinEdgesToSuperviewEdges()
localVideoView.autoPinTrailingToSuperviewMargin(withInset: videoPreviewHMargin) leaveCallViewButton.autoPinEdge(toSuperviewMargin: .leading)
localVideoView.autoPinEdge(toSuperviewEdge: .top, withInset: topMargin) leaveCallViewButton.autoPinEdge(toSuperviewMargin: .top)
let localVideoSize = ScaleFromIPhone5To7Plus(80, 100)
localVideoView.autoSetDimension(.width, toSize: localVideoSize)
localVideoView.autoSetDimension(.height, toSize: localVideoSize)
remoteVideoView.autoPinEdgesToSuperviewEdges()
leaveCallViewButton.autoPinEdge(toSuperviewMargin: .left)
leaveCallViewButton.autoPinEdge(toSuperviewEdge: .top, withInset: topMargin)
contactNameLabel.autoPinEdge(.top, to: .bottom, of: leaveCallViewButton, withOffset: 8) // MJK TODO height of contact name label should be ~same as back button
contactNameLabel.autoPinLeadingToSuperviewMargin() contactNameLabel.autoPinEdge(toSuperviewMargin: .top)
contactNameLabel.autoPinEdge(.leading, to: .trailing, of: leaveCallViewButton, withOffset: 8, relation: .greaterThanOrEqual)
contactNameLabel.autoHCenterInSuperview()
contactNameLabel.setContentHuggingVerticalHigh() contactNameLabel.setContentHuggingVerticalHigh()
contactNameLabel.setCompressionResistanceHigh() contactNameLabel.setCompressionResistanceHigh()
callStatusLabel.autoPinEdge(.top, to: .bottom, of: contactNameLabel, withOffset: contactVSpacing) callStatusLabel.autoPinEdge(.top, to: .bottom, of: contactNameLabel, withOffset: contactVSpacing)
callStatusLabel.autoPinLeadingToSuperviewMargin() callStatusLabel.autoHCenterInSuperview()
callStatusLabel.setContentHuggingVerticalHigh() callStatusLabel.setContentHuggingVerticalHigh()
callStatusLabel.setCompressionResistanceHigh() callStatusLabel.setCompressionResistanceHigh()
localVideoView.autoPinTrailingToSuperviewMargin(withInset: videoPreviewHMargin)
// MJK TODO, depends on whether contactNameLabel is visible
self.localVideoViewTopConstraint = localVideoView.autoPinEdge(.top, to: .bottom, of: callStatusLabel, withOffset: 4)
let localVideoSize = ScaleFromIPhone5To7Plus(80, 100)
localVideoView.autoSetDimension(.width, toSize: localVideoSize)
localVideoView.autoSetDimension(.height, toSize: localVideoSize)
remoteVideoView.autoPinEdgesToSuperviewEdges()
contactAvatarContainerView.autoPinEdge(.top, to: .bottom, of: callStatusLabel, withOffset: +avatarTopSpacing) contactAvatarContainerView.autoPinEdge(.top, to: .bottom, of: callStatusLabel, withOffset: +avatarTopSpacing)
contactAvatarContainerView.autoPinEdge(.bottom, to: .top, of: ongoingCallControls, withOffset: -avatarBottomSpacing) contactAvatarContainerView.autoPinEdge(.bottom, to: .top, of: ongoingCallControls, withOffset: -avatarBottomSpacing)
contactAvatarContainerView.autoPinWidthToSuperview(withMargin: avatarTopSpacing) contactAvatarContainerView.autoPinWidthToSuperview(withMargin: avatarTopSpacing)
@ -577,12 +581,12 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
if localVideoView.isHidden { if localVideoView.isHidden {
let contactHMargin = CGFloat(5) let contactHMargin = CGFloat(5)
constraints.append(contactNameLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin)) // constraints.append(contactNameLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin))
constraints.append(callStatusLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin)) // constraints.append(callStatusLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin))
} else { } else {
let spacing = CGFloat(10) let spacing = CGFloat(10)
constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: contactNameLabel, offset: spacing)) // constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: contactNameLabel, offset: spacing))
constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: callStatusLabel, offset: spacing)) // constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: callStatusLabel, offset: spacing))
} }
self.localVideoConstraints = constraints self.localVideoConstraints = constraints

Loading…
Cancel
Save