OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 [_roomText resignFirstResponder]; | 107 [_roomText resignFirstResponder]; |
108 } | 108 } |
109 | 109 |
110 - (void)updateClearButton { | 110 - (void)updateClearButton { |
111 _clearButton.hidden = _roomText.text.length == 0; | 111 _clearButton.hidden = _roomText.text.length == 0; |
112 } | 112 } |
113 | 113 |
114 @end | 114 @end |
115 | 115 |
116 @implementation ARDMainView { | 116 @implementation ARDMainView { |
117 UILabel *_appLabel; | |
118 ARDRoomTextField *_roomText; | 117 ARDRoomTextField *_roomText; |
119 UILabel *_callOptionsLabel; | 118 UILabel *_callOptionsLabel; |
120 UISwitch *_audioOnlySwitch; | 119 UISwitch *_audioOnlySwitch; |
121 UILabel *_audioOnlyLabel; | 120 UILabel *_audioOnlyLabel; |
122 UISwitch *_aecdumpSwitch; | 121 UISwitch *_aecdumpSwitch; |
123 UILabel *_aecdumpLabel; | 122 UILabel *_aecdumpLabel; |
124 UISwitch *_levelControlSwitch; | 123 UISwitch *_levelControlSwitch; |
125 UILabel *_levelControlLabel; | 124 UILabel *_levelControlLabel; |
126 UISwitch *_loopbackSwitch; | 125 UISwitch *_loopbackSwitch; |
127 UILabel *_loopbackLabel; | 126 UILabel *_loopbackLabel; |
128 UISwitch *_useManualAudioSwitch; | 127 UISwitch *_useManualAudioSwitch; |
129 UILabel *_useManualAudioLabel; | 128 UILabel *_useManualAudioLabel; |
130 UIButton *_startCallButton; | 129 UIButton *_startCallButton; |
131 UIButton *_audioLoopButton; | 130 UIButton *_audioLoopButton; |
132 } | 131 } |
133 | 132 |
134 @synthesize delegate = _delegate; | 133 @synthesize delegate = _delegate; |
135 @synthesize isAudioLoopPlaying = _isAudioLoopPlaying; | 134 @synthesize isAudioLoopPlaying = _isAudioLoopPlaying; |
136 | 135 |
137 - (instancetype)initWithFrame:(CGRect)frame { | 136 - (instancetype)initWithFrame:(CGRect)frame { |
138 if (self = [super initWithFrame:frame]) { | 137 if (self = [super initWithFrame:frame]) { |
139 _appLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | |
140 _appLabel.text = @"AppRTCMobile"; | |
141 _appLabel.font = [UIFont fontWithName:@"Roboto" size:34]; | |
142 _appLabel.textColor = [UIColor colorWithWhite:0 alpha:.2]; | |
143 [_appLabel sizeToFit]; | |
144 [self addSubview:_appLabel]; | |
145 | |
146 _roomText = [[ARDRoomTextField alloc] initWithFrame:CGRectZero]; | 138 _roomText = [[ARDRoomTextField alloc] initWithFrame:CGRectZero]; |
147 [self addSubview:_roomText]; | 139 [self addSubview:_roomText]; |
148 | 140 |
149 UIFont *controlFont = [UIFont fontWithName:@"Roboto" size:20]; | 141 UIFont *controlFont = [UIFont fontWithName:@"Roboto" size:20]; |
150 UIColor *controlFontColor = [UIColor colorWithWhite:0 alpha:.6]; | 142 UIColor *controlFontColor = [UIColor colorWithWhite:0 alpha:.6]; |
151 | 143 |
152 _callOptionsLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 144 _callOptionsLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
153 _callOptionsLabel.text = @"Call Options"; | 145 _callOptionsLabel.text = @"Call Options"; |
154 _callOptionsLabel.font = controlFont; | 146 _callOptionsLabel.font = controlFont; |
155 _callOptionsLabel.textColor = controlFontColor; | 147 _callOptionsLabel.textColor = controlFontColor; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 return; | 248 return; |
257 } | 249 } |
258 _isAudioLoopPlaying = isAudioLoopPlaying; | 250 _isAudioLoopPlaying = isAudioLoopPlaying; |
259 [self updateAudioLoopButton]; | 251 [self updateAudioLoopButton]; |
260 } | 252 } |
261 | 253 |
262 - (void)layoutSubviews { | 254 - (void)layoutSubviews { |
263 CGRect bounds = self.bounds; | 255 CGRect bounds = self.bounds; |
264 CGFloat roomTextWidth = bounds.size.width - 2 * kRoomTextFieldMargin; | 256 CGFloat roomTextWidth = bounds.size.width - 2 * kRoomTextFieldMargin; |
265 CGFloat roomTextHeight = [_roomText sizeThatFits:bounds.size].height; | 257 CGFloat roomTextHeight = [_roomText sizeThatFits:bounds.size].height; |
266 _roomText.frame = CGRectMake(kRoomTextFieldMargin, | 258 _roomText.frame = |
267 kStatusBarHeight + kRoomTextFieldMargin, | 259 CGRectMake(kRoomTextFieldMargin, kRoomTextFieldMargin, roomTextWidth, room
TextHeight); |
268 roomTextWidth, | |
269 roomTextHeight); | |
270 _appLabel.center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); | |
271 | 260 |
272 CGFloat callOptionsLabelTop = | 261 CGFloat callOptionsLabelTop = |
273 CGRectGetMaxY(_roomText.frame) + kCallControlMargin * 4; | 262 CGRectGetMaxY(_roomText.frame) + kCallControlMargin * 4; |
274 _callOptionsLabel.frame = CGRectMake(kCallControlMargin, | 263 _callOptionsLabel.frame = CGRectMake(kCallControlMargin, |
275 callOptionsLabelTop, | 264 callOptionsLabelTop, |
276 _callOptionsLabel.frame.size.width, | 265 _callOptionsLabel.frame.size.width, |
277 _callOptionsLabel.frame.size.height); | 266 _callOptionsLabel.frame.size.height); |
278 | 267 |
279 CGFloat audioOnlyTop = | 268 CGFloat audioOnlyTop = |
280 CGRectGetMaxY(_callOptionsLabel.frame) + kCallControlMargin * 2; | 269 CGRectGetMaxY(_callOptionsLabel.frame) + kCallControlMargin * 2; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 [_delegate mainView:self | 372 [_delegate mainView:self |
384 didInputRoom:room | 373 didInputRoom:room |
385 isLoopback:_loopbackSwitch.isOn | 374 isLoopback:_loopbackSwitch.isOn |
386 isAudioOnly:_audioOnlySwitch.isOn | 375 isAudioOnly:_audioOnlySwitch.isOn |
387 shouldMakeAecDump:_aecdumpSwitch.isOn | 376 shouldMakeAecDump:_aecdumpSwitch.isOn |
388 shouldUseLevelControl:_levelControlSwitch.isOn | 377 shouldUseLevelControl:_levelControlSwitch.isOn |
389 useManualAudio:_useManualAudioSwitch.isOn]; | 378 useManualAudio:_useManualAudioSwitch.isOn]; |
390 } | 379 } |
391 | 380 |
392 @end | 381 @end |
OLD | NEW |