| OLD | NEW |
| 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 <UIKit/UIKit.h> | 9 #import <UIKit/UIKit.h> |
| 10 | 10 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 self.frame.size.width, _statusLabel.font.pointSize + kLinePadding); | 95 self.frame.size.width, _statusLabel.font.pointSize + kLinePadding); |
| 96 [_cellView addSubview:_statusLabel]; | 96 [_cellView addSubview:_statusLabel]; |
| 97 } | 97 } |
| 98 | 98 |
| 99 #pragma mark - HostCollectionViewCell Public | 99 #pragma mark - HostCollectionViewCell Public |
| 100 | 100 |
| 101 - (void)populateContentWithHostInfo:(HostInfo*)hostInfo { | 101 - (void)populateContentWithHostInfo:(HostInfo*)hostInfo { |
| 102 _hostInfo = hostInfo; | 102 _hostInfo = hostInfo; |
| 103 | 103 |
| 104 _titleLabel.text = _hostInfo.hostName; | 104 _titleLabel.text = _hostInfo.hostName; |
| 105 _statusLabel.text = _hostInfo.status; | |
| 106 | 105 |
| 107 _imageView.image = [UIImage imageNamed:@"ic_desktop"]; | 106 _imageView.image = [UIImage imageNamed:@"ic_desktop"]; |
| 108 | 107 |
| 109 // TODO(nicholss): These colors are incorrect for the final product. | 108 // TODO(nicholss): These colors are incorrect for the final product. |
| 110 // Need to update to the values in the mocks. | 109 // Need to update to the values in the mocks. |
| 111 if ([_hostInfo.status isEqualToString:@"ONLINE"]) { | 110 if ([_hostInfo.status isEqualToString:@"ONLINE"]) { |
| 112 _imageView.backgroundColor = UIColor.greenColor; | 111 _imageView.backgroundColor = UIColor.greenColor; |
| 112 _statusLabel.text = @"Online"; |
| 113 } else { | 113 } else { |
| 114 _imageView.backgroundColor = UIColor.lightGrayColor; | 114 _imageView.backgroundColor = UIColor.lightGrayColor; |
| 115 _statusLabel.text = |
| 116 [NSString stringWithFormat:@"Last online: %@", hostInfo.updatedTime]; |
| 115 } | 117 } |
| 116 } | 118 } |
| 117 | 119 |
| 118 #pragma mark - UICollectionReusableView | 120 #pragma mark - UICollectionReusableView |
| 119 | 121 |
| 120 - (void)prepareForReuse { | 122 - (void)prepareForReuse { |
| 121 [super prepareForReuse]; | 123 [super prepareForReuse]; |
| 122 _hostInfo = nil; | 124 _hostInfo = nil; |
| 123 _statusLabel.text = nil; | 125 _statusLabel.text = nil; |
| 124 _titleLabel.text = nil; | 126 _titleLabel.text = nil; |
| 125 } | 127 } |
| 126 | 128 |
| 127 @end | 129 @end |
| OLD | NEW |