Add UINavigationController and settings bar button to AppRTCMobile.

The navigation controller is used to display the title of the app
and to feature the settings button.

This  work is foundation for adding settings screen to the app (see webrtc:6473 for more info)

BUG=webrtc:6618, webrtc:6473

Review-Url: https://codereview.webrtc.org/2455363002
Cr-Commit-Position: refs/heads/master@{#14816}
This commit is contained in:
denicija 2016-10-28 04:53:16 -07:00 committed by Commit bot
parent 5da65f241c
commit 6d6762cb0e
6 changed files with 24 additions and 14 deletions

View File

@ -269,6 +269,8 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"objc/AppRTCMobile/ios/resources/ic_call_end_black_24dp@2x.png",
"objc/AppRTCMobile/ios/resources/ic_clear_black_24dp.png",
"objc/AppRTCMobile/ios/resources/ic_clear_black_24dp@2x.png",
"objc/AppRTCMobile/ios/resources/ic_settings_black_24dp.png",
"objc/AppRTCMobile/ios/resources/ic_settings_black_24dp@2x.png",
"objc/AppRTCMobile/ios/resources/ic_surround_sound_black_24dp.png",
"objc/AppRTCMobile/ios/resources/ic_surround_sound_black_24dp@2x.png",
"objc/AppRTCMobile/ios/resources/ic_switch_video_black_24dp.png",

View File

@ -31,7 +31,11 @@
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[_window makeKeyAndVisible];
ARDMainViewController *viewController = [[ARDMainViewController alloc] init];
_window.rootViewController = viewController;
UINavigationController *root =
[[UINavigationController alloc] initWithRootViewController:viewController];
root.navigationBar.translucent = NO;
_window.rootViewController = root;
#if defined(NDEBUG)
// In debug builds the default level is LS_INFO and in non-debug builds it is

View File

@ -114,7 +114,6 @@ static CGFloat const kCallControlMargin = 8;
@end
@implementation ARDMainView {
UILabel *_appLabel;
ARDRoomTextField *_roomText;
UILabel *_callOptionsLabel;
UISwitch *_audioOnlySwitch;
@ -136,13 +135,6 @@ static CGFloat const kCallControlMargin = 8;
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
_appLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_appLabel.text = @"AppRTCMobile";
_appLabel.font = [UIFont fontWithName:@"Roboto" size:34];
_appLabel.textColor = [UIColor colorWithWhite:0 alpha:.2];
[_appLabel sizeToFit];
[self addSubview:_appLabel];
_roomText = [[ARDRoomTextField alloc] initWithFrame:CGRectZero];
[self addSubview:_roomText];
@ -263,11 +255,8 @@ static CGFloat const kCallControlMargin = 8;
CGRect bounds = self.bounds;
CGFloat roomTextWidth = bounds.size.width - 2 * kRoomTextFieldMargin;
CGFloat roomTextHeight = [_roomText sizeThatFits:bounds.size].height;
_roomText.frame = CGRectMake(kRoomTextFieldMargin,
kStatusBarHeight + kRoomTextFieldMargin,
roomTextWidth,
roomTextHeight);
_appLabel.center = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
_roomText.frame =
CGRectMake(kRoomTextFieldMargin, kRoomTextFieldMargin, roomTextWidth, roomTextHeight);
CGFloat callOptionsLabelTop =
CGRectGetMaxY(_roomText.frame) + kCallControlMargin * 4;

View File

@ -21,6 +21,8 @@
#import "ARDMainView.h"
#import "ARDVideoCallViewController.h"
static NSString *barButtonImageString = @"ic_settings_black_24dp.png";
@interface ARDMainViewController () <
ARDMainViewDelegate,
ARDVideoCallViewControllerDelegate,
@ -34,9 +36,11 @@
}
- (void)loadView {
self.title = @"AppRTC Mobile";
_mainView = [[ARDMainView alloc] initWithFrame:CGRectZero];
_mainView.delegate = self;
self.view = _mainView;
[self addSettingsBarButton];
RTCAudioSessionConfiguration *webRTCConfig =
[RTCAudioSessionConfiguration webRTCConfiguration];
@ -51,6 +55,15 @@
[self setupAudioPlayer];
}
- (void)addSettingsBarButton {
UIBarButtonItem *settingsButton =
[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:barButtonImageString]
style:UIBarButtonItemStylePlain
target:self
action:@selector(showSettings:)];
self.navigationItem.rightBarButtonItem = settingsButton;
}
#pragma mark - ARDMainViewDelegate
- (void)mainView:(ARDMainView *)mainView
@ -155,6 +168,8 @@
}
#pragma mark - Private
- (void)showSettings:(id)sender {
}
- (void)configureAudioSession {
RTCAudioSessionConfiguration *configuration =

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B