| Index: ios/chrome/widget_extension/widget_view.mm
|
| diff --git a/ios/chrome/widget_extension/widget_view.mm b/ios/chrome/widget_extension/widget_view.mm
|
| index 843adccd36fe5b34934dab71aa87cc878f48b023..d2c5a77ea27efe1d1bc675171590c3c510784604 100644
|
| --- a/ios/chrome/widget_extension/widget_view.mm
|
| +++ b/ios/chrome/widget_extension/widget_view.mm
|
| @@ -8,13 +8,59 @@
|
| #error "This file requires ARC support."
|
| #endif
|
|
|
| +namespace {
|
| +
|
| +const CGFloat kCursorHeight = 40;
|
| +const CGFloat kCursorWidth = 2;
|
| +const CGFloat kCursorHorizontalPadding = 40;
|
| +
|
| +} // namespace
|
| +
|
| +@interface WidgetView ()
|
| +
|
| +@property(nonatomic, weak) UIView* cursor;
|
| +
|
| +// Creates a cursor, adds it to the view and sets the class cursor property.
|
| +- (void)addCursor;
|
| +
|
| +@end
|
| +
|
| @implementation WidgetView
|
|
|
| -#pragma mark - Lifecycle
|
| +@synthesize cursor = _cursor;
|
|
|
| - (instancetype)init {
|
| self = [super initWithFrame:CGRectZero];
|
| + if (self) {
|
| + [self addCursor];
|
| + }
|
| return self;
|
| }
|
|
|
| +- (void)addCursor {
|
| + UIView* cursor = [[UIView alloc] initWithFrame:CGRectZero];
|
| + self.cursor = cursor;
|
| + self.cursor.backgroundColor = [UIColor blueColor];
|
| + [self addSubview:self.cursor];
|
| +
|
| + [self.cursor setTranslatesAutoresizingMaskIntoConstraints:NO];
|
| + [NSLayoutConstraint activateConstraints:@[
|
| + [[self.cursor widthAnchor] constraintEqualToConstant:kCursorWidth],
|
| + [[self.cursor leadingAnchor]
|
| + constraintEqualToAnchor:self.leadingAnchor
|
| + constant:kCursorHorizontalPadding],
|
| + [[self.cursor heightAnchor] constraintEqualToConstant:kCursorHeight],
|
| + [[self.cursor centerYAnchor] constraintEqualToAnchor:self.centerYAnchor]
|
| + ]];
|
| +
|
| + [UIView animateWithDuration:0.3
|
| + delay:0.0
|
| + options:UIViewAnimationOptionRepeat |
|
| + UIViewAnimationOptionAutoreverse
|
| + animations:^{
|
| + self.cursor.alpha = 0.0f;
|
| + }
|
| + completion:nil];
|
| +}
|
| +
|
| @end
|
|
|