OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #import "ios/chrome/browser/ui/elements/activity_overlay_view_controller.h" | 5 #import "ios/chrome/browser/ui/elements/activity_overlay_view_controller.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/material_components/activity_indicator.h" | 7 #import "ios/chrome/browser/ui/material_components/activity_indicator.h" |
8 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
9 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato
r/src/MaterialActivityIndicator.h" | 9 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato
r/src/MaterialActivityIndicator.h" |
10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
11 namespace { | 15 namespace { |
12 // Size of the activity indicator. | 16 // Size of the activity indicator. |
13 const CGFloat kActivityIndicatorSize = 48; | 17 const CGFloat kActivityIndicatorSize = 48; |
14 // Alpha of the presented view's background. | 18 // Alpha of the presented view's background. |
15 const CGFloat kBackgroundAlpha = 0.5; | 19 const CGFloat kBackgroundAlpha = 0.5; |
16 } | 20 } |
17 | 21 |
18 @implementation ActivityOverlayViewController | 22 @implementation ActivityOverlayViewController |
19 | 23 |
20 - (void)viewDidLoad { | 24 - (void)viewDidLoad { |
21 [super viewDidLoad]; | 25 [super viewDidLoad]; |
22 self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:kBackgroundAlpha]; | 26 self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:kBackgroundAlpha]; |
23 | 27 |
24 MDCActivityIndicator* activityIndicator = [[[MDCActivityIndicator alloc] | 28 MDCActivityIndicator* activityIndicator = [[MDCActivityIndicator alloc] |
25 initWithFrame:CGRectMake(0, 0, kActivityIndicatorSize, | 29 initWithFrame:CGRectMake(0, 0, kActivityIndicatorSize, |
26 kActivityIndicatorSize)] autorelease]; | 30 kActivityIndicatorSize)]; |
27 activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; | 31 activityIndicator.translatesAutoresizingMaskIntoConstraints = NO; |
28 [self.view addSubview:activityIndicator]; | 32 [self.view addSubview:activityIndicator]; |
29 AddSameCenterConstraints(self.view, activityIndicator); | 33 AddSameCenterConstraints(self.view, activityIndicator); |
30 activityIndicator.cycleColors = ActivityIndicatorBrandedCycleColors(); | 34 activityIndicator.cycleColors = ActivityIndicatorBrandedCycleColors(); |
31 [activityIndicator startAnimating]; | 35 [activityIndicator startAnimating]; |
32 } | 36 } |
33 | 37 |
34 @end | 38 @end |
OLD | NEW |