Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 9df5cebfc3
commit 19633a9f61

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 20 KiB

@ -173,14 +173,13 @@ class CallViewController: UIViewController, CallDelegate {
var hangUpButton: UIButton! var hangUpButton: UIButton!
var muteButton: UIButton! var muteButton: UIButton!
var speakerPhoneButton: UIButton! var speakerPhoneButton: UIButton!
var ongoingTextMessageButton: UIButton! var textMessageButton: UIButton!
var videoButton: UIButton! var videoButton: UIButton!
// MARK: Incoming Call Controls // MARK: Incoming Call Controls
var incomingCallView: UIView! var incomingCallView: UIView!
var incomingTextMessageButton: UIButton!
var acceptIncomingButton: UIButton! var acceptIncomingButton: UIButton!
var declineIncomingButton: UIButton! var declineIncomingButton: UIButton!
@ -191,11 +190,11 @@ class CallViewController: UIViewController, CallDelegate {
} }
var incomingCallControls: [UIView] { var incomingCallControls: [UIView] {
return [ incomingTextMessageButton, acceptIncomingButton, declineIncomingButton ] return [ acceptIncomingButton, declineIncomingButton ]
} }
var ongoingCallControls: [UIView] { var ongoingCallControls: [UIView] {
return [ muteButton, speakerPhoneButton, ongoingTextMessageButton, hangUpButton, videoButton ] return [ muteButton, speakerPhoneButton, textMessageButton, hangUpButton, videoButton ]
} }
// MARK: Initializers // MARK: Initializers
@ -275,26 +274,25 @@ class CallViewController: UIViewController, CallDelegate {
return ScaleFromIPhone5To7Plus(84, 108) return ScaleFromIPhone5To7Plus(84, 108)
} }
func buttonInset() -> CGFloat {
return ScaleFromIPhone5To7Plus(7, 9)
}
func createOngoingCallControls() { func createOngoingCallControls() {
ongoingTextMessageButton = createButton(imageName:"message-active-wide", textMessageButton = createButton(imageName:"message-active-wide",
action:#selector(didPressTextMessage), action:#selector(didPressTextMessage))
buttonSize:buttonSize())
muteButton = createButton(imageName:"mute-active-wide", muteButton = createButton(imageName:"mute-active-wide",
action:#selector(didPressMute), action:#selector(didPressMute))
buttonSize:buttonSize())
speakerPhoneButton = createButton(imageName:"speaker-active-wide", speakerPhoneButton = createButton(imageName:"speaker-active-wide",
action:#selector(didPressSpeakerphone), action:#selector(didPressSpeakerphone))
buttonSize:buttonSize())
videoButton = createButton(imageName:"video-active-wide", videoButton = createButton(imageName:"video-active-wide",
action:#selector(didPressVideo), action:#selector(didPressVideo))
buttonSize:buttonSize())
hangUpButton = createButton(imageName:"hangup-active-wide", hangUpButton = createButton(imageName:"hangup-active-wide",
action:#selector(didPressHangup), action:#selector(didPressHangup))
buttonSize:buttonSize())
ongoingCallView = createContainerForCallControls(controlGroups : [ ongoingCallView = createContainerForCallControls(controlGroups : [
[ongoingTextMessageButton, videoButton], [textMessageButton, videoButton],
[muteButton, speakerPhoneButton ], [muteButton, speakerPhoneButton ],
[hangUpButton ] [hangUpButton ]
]) ])
@ -302,18 +300,12 @@ class CallViewController: UIViewController, CallDelegate {
func createIncomingCallControls() { func createIncomingCallControls() {
incomingTextMessageButton = createButton(imageName:"message-active-wide",
action:#selector(didPressTextMessage),
buttonSize:buttonSize())
acceptIncomingButton = createButton(imageName:"call-active-wide", acceptIncomingButton = createButton(imageName:"call-active-wide",
action:#selector(didPressAnswerCall), action:#selector(didPressAnswerCall))
buttonSize:buttonSize())
declineIncomingButton = createButton(imageName:"hangup-active-wide", declineIncomingButton = createButton(imageName:"hangup-active-wide",
action:#selector(didPressDeclineCall), action:#selector(didPressDeclineCall))
buttonSize:buttonSize())
incomingCallView = createContainerForCallControls(controlGroups : [ incomingCallView = createContainerForCallControls(controlGroups : [
[incomingTextMessageButton],
[acceptIncomingButton, declineIncomingButton ] [acceptIncomingButton, declineIncomingButton ]
]) ])
} }
@ -323,8 +315,7 @@ class CallViewController: UIViewController, CallDelegate {
self.view.addSubview(containerView) self.view.addSubview(containerView)
var rows: [UIView] = [] var rows: [UIView] = []
for controlGroup in controlGroups { for controlGroup in controlGroups {
rows.append(rowWithSubviews(subviews:controlGroup, rows.append(rowWithSubviews(subviews:controlGroup))
fixedHeight:buttonSize()))
} }
let rowspacing = ScaleFromIPhone5To7Plus(6, 7) let rowspacing = ScaleFromIPhone5To7Plus(6, 7)
var prevRow: UIView? var prevRow: UIView?
@ -343,21 +334,25 @@ class CallViewController: UIViewController, CallDelegate {
return containerView return containerView
} }
func createButton(imageName: String, action: Selector, buttonSize: CGFloat) -> UIButton { func createButton(imageName: String, action: Selector) -> UIButton {
let image = UIImage(named:imageName) let image = UIImage(named:imageName)
let button = UIButton() let button = UIButton()
button.setImage(image, for:.normal) button.setImage(image, for:.normal)
button.imageEdgeInsets = UIEdgeInsetsMake(buttonInset(),
buttonInset(),
buttonInset(),
buttonInset())
button.addTarget(self, action:action, for:.touchUpInside) button.addTarget(self, action:action, for:.touchUpInside)
button.autoSetDimension(.width, toSize:buttonSize) button.autoSetDimension(.width, toSize:buttonSize())
button.autoSetDimension(.height, toSize:buttonSize) button.autoSetDimension(.height, toSize:buttonSize())
return button return button
} }
// Creates a row containing a given set of subviews. // Creates a row containing a given set of subviews.
func rowWithSubviews(subviews: [UIView], fixedHeight: CGFloat) -> UIView { func rowWithSubviews(subviews: [UIView]) -> UIView {
let row = UIView() let row = UIView()
row.setContentHuggingVerticalHigh() row.setContentHuggingVerticalHigh()
row.autoSetDimension(.height, toSize:fixedHeight) row.autoSetDimension(.height, toSize:buttonSize())
if subviews.count > 1 { if subviews.count > 1 {
// If there's more than one subview in the row, // If there's more than one subview in the row,

Loading…
Cancel
Save