Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: remoting/ios/app/client_connection_view_controller.mm

Issue 2929663002: [CRD iOS] Fix color scheme and other UI issues (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if !defined(__has_feature) || !__has_feature(objc_arc) 5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support." 6 #error "This file requires ARC support."
7 #endif 7 #endif
8 8
9 #import "remoting/ios/app/client_connection_view_controller.h" 9 #import "remoting/ios/app/client_connection_view_controller.h"
10 10
11 #import "base/mac/bind_objc_block.h" 11 #import "base/mac/bind_objc_block.h"
12 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato r/src/MDCActivityIndicator.h" 12 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato r/src/MDCActivityIndicator.h"
13 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h" 13 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h"
14 #import "ios/third_party/material_components_ios/src/components/NavigationBar/sr c/MaterialNavigationBar.h" 14 #import "ios/third_party/material_components_ios/src/components/NavigationBar/sr c/MaterialNavigationBar.h"
15 #import "remoting/ios/app/host_view_controller.h" 15 #import "remoting/ios/app/host_view_controller.h"
16 #import "remoting/ios/app/pin_entry_view.h" 16 #import "remoting/ios/app/pin_entry_view.h"
17 #import "remoting/ios/app/remoting_styles.h"
nicholss 2017/06/07 21:01:41 Most apps call this theme, ie remoting_theme
Yuwei 2017/06/07 22:25:22 Done.
17 #import "remoting/ios/domain/client_session_details.h" 18 #import "remoting/ios/domain/client_session_details.h"
18 #import "remoting/ios/domain/host_info.h" 19 #import "remoting/ios/domain/host_info.h"
19 #import "remoting/ios/facade/remoting_authentication.h" 20 #import "remoting/ios/facade/remoting_authentication.h"
20 #import "remoting/ios/facade/remoting_service.h" 21 #import "remoting/ios/facade/remoting_service.h"
21 #import "remoting/ios/session/remoting_client.h" 22 #import "remoting/ios/session/remoting_client.h"
22 23
23 #include "base/strings/sys_string_conversions.h" 24 #include "base/strings/sys_string_conversions.h"
24 #include "remoting/protocol/client_authentication_config.h" 25 #include "remoting/protocol/client_authentication_config.h"
25 26
26 static const CGFloat kIconRadius = 30.f; 27 static const CGFloat kIconRadius = 30.f;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 forState:UIControlStateNormal]; 80 forState:UIControlStateNormal];
80 [cancelButton addTarget:self 81 [cancelButton addTarget:self
81 action:@selector(didTapCancel:) 82 action:@selector(didTapCancel:)
82 forControlEvents:UIControlEventTouchUpInside]; 83 forControlEvents:UIControlEventTouchUpInside];
83 self.navigationItem.leftBarButtonItem = 84 self.navigationItem.leftBarButtonItem =
84 [[UIBarButtonItem alloc] initWithCustomView:cancelButton]; 85 [[UIBarButtonItem alloc] initWithCustomView:cancelButton];
85 86
86 _navBar = [[MDCNavigationBar alloc] initWithFrame:CGRectZero]; 87 _navBar = [[MDCNavigationBar alloc] initWithFrame:CGRectZero];
87 [_navBar observeNavigationItem:self.navigationItem]; 88 [_navBar observeNavigationItem:self.navigationItem];
88 89
89 [_navBar setBackgroundColor:[UIColor blackColor]]; 90 [_navBar setBackgroundColor:RemotingStyles.connectionViewBackgroundColor];
90 MDCNavigationBarTextColorAccessibilityMutator* mutator = 91 MDCNavigationBarTextColorAccessibilityMutator* mutator =
91 [[MDCNavigationBarTextColorAccessibilityMutator alloc] init]; 92 [[MDCNavigationBarTextColorAccessibilityMutator alloc] init];
92 [mutator mutate:_navBar]; 93 [mutator mutate:_navBar];
93 [self.view addSubview:_navBar]; 94 [self.view addSubview:_navBar];
94 _navBar.translatesAutoresizingMaskIntoConstraints = NO; 95 _navBar.translatesAutoresizingMaskIntoConstraints = NO;
95 96
96 // Attach navBar to the top of the view. 97 // Attach navBar to the top of the view.
97 [NSLayoutConstraint activateConstraints:@[ 98 [NSLayoutConstraint activateConstraints:@[
98 [[_navBar topAnchor] constraintEqualToAnchor:[self.view topAnchor]], 99 [[_navBar topAnchor] constraintEqualToAnchor:[self.view topAnchor]],
99 [[_navBar leadingAnchor] 100 [[_navBar leadingAnchor]
100 constraintEqualToAnchor:[self.view leadingAnchor]], 101 constraintEqualToAnchor:[self.view leadingAnchor]],
101 [[_navBar trailingAnchor] 102 [[_navBar trailingAnchor]
102 constraintEqualToAnchor:[self.view trailingAnchor]], 103 constraintEqualToAnchor:[self.view trailingAnchor]],
103 [[_navBar heightAnchor] constraintEqualToConstant:kBarHeight], 104 [[_navBar heightAnchor] constraintEqualToConstant:kBarHeight],
104 ]]; 105 ]];
105 } 106 }
106 return self; 107 return self;
107 } 108 }
108 109
109 #pragma mark - UIViewController 110 #pragma mark - UIViewController
110 111
111 - (void)loadView { 112 - (void)loadView {
112 [super loadView]; 113 [super loadView];
113 114
114 self.view.backgroundColor = [UIColor blackColor]; 115 self.view.backgroundColor = RemotingStyles.connectionViewBackgroundColor;
115 116
116 _activityIndicator = [[MDCActivityIndicator alloc] initWithFrame:CGRectZero]; 117 _activityIndicator = [[MDCActivityIndicator alloc] initWithFrame:CGRectZero];
117 [self.view addSubview:_activityIndicator]; 118 [self.view addSubview:_activityIndicator];
118 119
119 _statusLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 120 _statusLabel = [[UILabel alloc] initWithFrame:CGRectZero];
120 [self.view addSubview:_statusLabel]; 121 [self.view addSubview:_statusLabel];
121 122
122 _iconView = [[UIImageView alloc] initWithFrame:CGRectZero]; 123 _iconView = [[UIImageView alloc] initWithFrame:CGRectZero];
123 [self.view addSubview:_iconView]; 124 [self.view addSubview:_iconView];
124 125
125 _pinEntryView = [[PinEntryView alloc] init]; 126 _pinEntryView = [[PinEntryView alloc] init];
126 [self.view addSubview:_pinEntryView]; 127 [self.view addSubview:_pinEntryView];
127 _pinEntryView.delegate = self; 128 _pinEntryView.delegate = self;
128 } 129 }
129 130
130 - (void)viewDidLoad { 131 - (void)viewDidLoad {
131 [super viewDidLoad]; 132 [super viewDidLoad];
132 133
133 _iconView.contentMode = UIViewContentModeCenter; 134 _iconView.contentMode = UIViewContentModeCenter;
134 _iconView.alpha = 0.87f; 135 _iconView.alpha = 0.87f;
135 _iconView.backgroundColor = UIColor.lightGrayColor; 136 _iconView.backgroundColor = RemotingStyles.onlineHostColor;
136 _iconView.layer.cornerRadius = kIconRadius; 137 _iconView.layer.cornerRadius = kIconRadius;
137 _iconView.layer.masksToBounds = YES; 138 _iconView.layer.masksToBounds = YES;
138 _iconView.image = [UIImage imageNamed:@"ic_desktop"]; 139 _iconView.image = [UIImage imageNamed:@"ic_desktop"];
139 140
140 _activityIndicator.radius = kActivityIndicatorRadius; 141 _activityIndicator.radius = kActivityIndicatorRadius;
141 _activityIndicator.trackEnabled = YES; 142 _activityIndicator.trackEnabled = YES;
142 _activityIndicator.strokeWidth = kActivityIndicatorStrokeWidth; 143 _activityIndicator.strokeWidth = kActivityIndicatorStrokeWidth;
143 _activityIndicator.cycleColors = @[ [UIColor whiteColor] ]; 144 _activityIndicator.cycleColors = @[ UIColor.whiteColor ];
144 145
145 _statusLabel.numberOfLines = 1; 146 _statusLabel.numberOfLines = 1;
146 _statusLabel.lineBreakMode = NSLineBreakByTruncatingTail; 147 _statusLabel.lineBreakMode = NSLineBreakByTruncatingTail;
147 _statusLabel.textColor = [UIColor whiteColor]; 148 _statusLabel.textColor = [UIColor whiteColor];
148 _statusLabel.textAlignment = NSTextAlignmentCenter; 149 _statusLabel.textAlignment = NSTextAlignmentCenter;
149 150
150 _pinEntryView.hidden = YES; 151 _pinEntryView.hidden = YES;
151 } 152 }
152 153
153 - (void)viewWillLayoutSubviews { 154 - (void)viewWillLayoutSubviews {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 animateWithDuration:kKeyboardAnimationTime 222 animateWithDuration:kKeyboardAnimationTime
222 animations:^{ 223 animations:^{
223 CGRect f = self.view.frame; 224 CGRect f = self.view.frame;
224 CGFloat newHeight = 225 CGFloat newHeight =
225 self.view.frame.size.height - keyboardSize.height; 226 self.view.frame.size.height - keyboardSize.height;
226 CGFloat overlap = 227 CGFloat overlap =
227 newHeight - (_pinEntryView.frame.origin.y + 228 newHeight - (_pinEntryView.frame.origin.y +
228 _pinEntryView.frame.size.height + kPadding); 229 _pinEntryView.frame.size.height + kPadding);
229 if (overlap < 0) { 230 if (overlap < 0) {
230 f.origin.y = overlap; 231 f.origin.y = overlap;
232 // TODO(yuweih): This may push the navigation bar off screen.
231 self.view.frame = f; 233 self.view.frame = f;
232 } 234 }
233 }]; 235 }];
234 } 236 }
235 237
236 - (void)keyboardWillHide:(NSNotification*)notification { 238 - (void)keyboardWillHide:(NSNotification*)notification {
237 [UIView animateWithDuration:kKeyboardAnimationTime 239 [UIView animateWithDuration:kKeyboardAnimationTime
238 animations:^{ 240 animations:^{
239 CGRect f = self.view.frame; 241 CGRect f = self.view.frame;
240 f.origin.y = 0.f; 242 f.origin.y = 0.f;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 default: 352 default:
351 LOG(ERROR) << "Unknown State for Session, " << sessionDetails.state; 353 LOG(ERROR) << "Unknown State for Session, " << sessionDetails.state;
352 return; 354 return;
353 } 355 }
354 [[NSOperationQueue mainQueue] addOperationWithBlock:^{ 356 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
355 [self setState:state]; 357 [self setState:state];
356 }]; 358 }];
357 } 359 }
358 360
359 @end 361 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698