Commit 1164003e authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Migrating from MDCInkView to MDCRippleView in IdentityPickerView

Migrating from MDCInkView to MDCRippleView in IdentityPickerView.
For more details:
https://material.io/develop/ios/components/ink/#migration-guide-ink-to-ripple

Fixed: 1099381
Change-Id: I074db9baabaff9461a456df48498d63089a13cc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2267323
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Auto-Submit: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarNohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782927}
parent a998fedf
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#import "ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.h" #import "ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.h"
#import <MaterialComponents/MaterialInk.h> #import <MaterialComponents/MaterialRipple.h>
#include "base/check.h" #include "base/check.h"
#include "base/feature_list.h" #include "base/feature_list.h"
...@@ -34,7 +34,8 @@ const CGFloat kArrowDownMargin = 12.; ...@@ -34,7 +34,8 @@ const CGFloat kArrowDownMargin = 12.;
@interface IdentityPickerView () @interface IdentityPickerView ()
@property(nonatomic, strong) IdentityView* identityView; @property(nonatomic, strong) IdentityView* identityView;
@property(nonatomic, strong) MDCInkView* inkView; // Ripple effect when the user starts or stop a touch in the view.
@property(nonatomic, strong) MDCRippleView* rippleView;
// Image View for the down arrow, letting the user know that more profiles can // Image View for the down arrow, letting the user know that more profiles can
// be selected. // be selected.
@property(nonatomic, strong) UIImageView* arrowDownImageView; @property(nonatomic, strong) UIImageView* arrowDownImageView;
...@@ -43,10 +44,6 @@ const CGFloat kArrowDownMargin = 12.; ...@@ -43,10 +44,6 @@ const CGFloat kArrowDownMargin = 12.;
@implementation IdentityPickerView @implementation IdentityPickerView
@synthesize identityView = _identityView;
@synthesize inkView = _inkView;
@synthesize arrowDownImageView = _arrowDownImageView;
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
...@@ -55,11 +52,11 @@ const CGFloat kArrowDownMargin = 12.; ...@@ -55,11 +52,11 @@ const CGFloat kArrowDownMargin = 12.;
self.backgroundColor = UIColor.cr_secondarySystemBackgroundColor; self.backgroundColor = UIColor.cr_secondarySystemBackgroundColor;
// Adding view elements inside. // Adding view elements inside.
// Ink view. // Ink view.
_inkView = [[MDCInkView alloc] initWithFrame:CGRectZero]; _rippleView = [[MDCRippleView alloc] initWithFrame:CGRectZero];
_inkView.layer.cornerRadius = kIdentityPickerViewRadius; _rippleView.layer.cornerRadius = kIdentityPickerViewRadius;
_inkView.inkStyle = MDCInkStyleBounded; _rippleView.rippleStyle = MDCRippleStyleBounded;
_inkView.translatesAutoresizingMaskIntoConstraints = NO; _rippleView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_inkView]; [self addSubview:_rippleView];
// Arrow down. // Arrow down.
_arrowDownImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; _arrowDownImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
...@@ -141,19 +138,19 @@ const CGFloat kArrowDownMargin = 12.; ...@@ -141,19 +138,19 @@ const CGFloat kArrowDownMargin = 12.;
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesBegan:touches withEvent:event]; [super touchesBegan:touches withEvent:event];
CGPoint location = [self locationFromTouches:touches]; CGPoint location = [self locationFromTouches:touches];
[self.inkView startTouchBeganAnimationAtPoint:location completion:nil]; [self.rippleView beginRippleTouchDownAtPoint:location
animated:YES
completion:nil];
} }
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesEnded:touches withEvent:event]; [super touchesEnded:touches withEvent:event];
CGPoint location = [self locationFromTouches:touches]; [self.rippleView beginRippleTouchUpAnimated:YES completion:nil];
[self.inkView startTouchEndedAnimationAtPoint:location completion:nil];
} }
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesCancelled:touches withEvent:event]; [super touchesCancelled:touches withEvent:event];
CGPoint location = [self locationFromTouches:touches]; [self.rippleView beginRippleTouchUpAnimated:YES completion:nil];
[self.inkView startTouchEndedAnimationAtPoint:location completion:nil];
} }
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment