OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell.h" |
| 6 |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" |
| 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 9 #import "ios/chrome/browser/ui/material_components/activity_indicator.h" |
| 10 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato
r/src/MaterialActivityIndicator.h" |
| 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 16 const CGFloat kIndicatorSize = 32; |
| 17 |
| 18 @implementation ActivityIndicatorCell |
| 19 |
| 20 @synthesize activityIndicator = _activityIndicator; |
| 21 |
| 22 - (instancetype)initWithFrame:(CGRect)frame { |
| 23 self = [super initWithFrame:frame]; |
| 24 if (self) { |
| 25 _activityIndicator = [[MDCActivityIndicator alloc] |
| 26 initWithFrame:CGRectMake(0, 0, kIndicatorSize, kIndicatorSize)]; |
| 27 _activityIndicator.cycleColors = ActivityIndicatorBrandedCycleColors(); |
| 28 [self.contentView addSubview:_activityIndicator]; |
| 29 _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; |
| 30 [NSLayoutConstraint activateConstraints:@[ |
| 31 [_activityIndicator.topAnchor |
| 32 constraintEqualToAnchor:self.contentView.topAnchor], |
| 33 [_activityIndicator.bottomAnchor |
| 34 constraintEqualToAnchor:self.contentView.bottomAnchor], |
| 35 [_activityIndicator.leadingAnchor |
| 36 constraintEqualToAnchor:self.contentView.leadingAnchor], |
| 37 [_activityIndicator.trailingAnchor |
| 38 constraintEqualToAnchor:self.contentView.trailingAnchor], |
| 39 ]]; |
| 40 [_activityIndicator startAnimating]; |
| 41 } |
| 42 return self; |
| 43 } |
| 44 |
| 45 @end |
OLD | NEW |