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

Unified Diff: remoting/ios/app/session_reconnect_view.mm

Issue 2971903002: Adding error handling to the connection flow. (Closed)
Patch Set: Trying out activateConstraints. Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/ios/app/session_reconnect_view.h ('k') | remoting/ios/domain/client_session_details.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/app/session_reconnect_view.mm
diff --git a/remoting/ios/app/session_reconnect_view.mm b/remoting/ios/app/session_reconnect_view.mm
new file mode 100644
index 0000000000000000000000000000000000000000..3c3aafef0ee5f013493637dc28b9adfa4fc13813
--- /dev/null
+++ b/remoting/ios/app/session_reconnect_view.mm
@@ -0,0 +1,75 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+#import "remoting/ios/app/session_reconnect_view.h"
+
+#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h"
+#import "remoting/ios/app/remoting_theme.h"
+
+static const CGFloat kReconnectButtonWidth = 120.f;
+static const CGFloat kReconnectButtonHeight = 30.f;
+
+@interface SessionReconnectView () {
+ MDCRaisedButton* _reconnectButton;
+}
+@end
+
+@implementation SessionReconnectView
+
+@synthesize delegate = _delegate;
+
+- (id)initWithFrame:(CGRect)frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ self.backgroundColor = [UIColor clearColor];
+
+ _reconnectButton = [[MDCRaisedButton alloc] init];
+ [_reconnectButton setElevation:4.0f forState:UIControlStateNormal];
+ [_reconnectButton setTitle:@"Reconnect" forState:UIControlStateNormal];
+ [_reconnectButton addTarget:self
+ action:@selector(didTapReconnect:)
+ forControlEvents:UIControlEventTouchUpInside];
+ _reconnectButton.translatesAutoresizingMaskIntoConstraints = NO;
+ [self addSubview:_reconnectButton];
+
+ [self initializeLayoutConstraintsWithViews:NSDictionaryOfVariableBindings(
+ _reconnectButton)];
+ }
+ return self;
+}
+
+- (void)initializeLayoutConstraintsWithViews:(NSDictionary*)views {
+ NSMutableArray* layoutConstraints = [NSMutableArray array];
+
+ [layoutConstraints addObject:[_reconnectButton.centerYAnchor
+ constraintEqualToAnchor:self.centerYAnchor]];
+
+ [layoutConstraints addObject:[_reconnectButton.centerXAnchor
+ constraintEqualToAnchor:self.centerXAnchor]];
+
+ [layoutConstraints
+ addObject:[_reconnectButton.widthAnchor
+ constraintEqualToConstant:kReconnectButtonWidth]];
+
+ [layoutConstraints
+ addObject:[_reconnectButton.heightAnchor
+ constraintEqualToConstant:kReconnectButtonHeight]];
+
+ [NSLayoutConstraint activateConstraints:layoutConstraints];
+ [self setNeedsUpdateConstraints];
+}
+
+#pragma mark - Private
+
+- (void)didTapReconnect:(id)sender {
+ if ([_delegate respondsToSelector:@selector(didTapReconnect)]) {
+ [_delegate didTapReconnect];
+ }
+}
+
+@end
« no previous file with comments | « remoting/ios/app/session_reconnect_view.h ('k') | remoting/ios/domain/client_session_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698