MaterialShapeDrawable

public class MaterialShapeDrawable
extends Drawable implements TintAwareDrawable, Shapeable

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ com.google.android.material.shape.MaterialShapeDrawable


Base drawable class for Material Shapes that handles shadows, elevation, scale and color for a generated path.

Summary

Nested classes

@interface MaterialShapeDrawable.CompatibilityShadowMode

Determines when compatibility shadow is drawn vs. 

Constants

int SHADOW_COMPAT_MODE_ALWAYS

Always draw fake shadows, never draw native elevation shadows.

int SHADOW_COMPAT_MODE_DEFAULT

Try to draw native elevation shadows if possible, otherwise use fake shadows.

int SHADOW_COMPAT_MODE_NEVER

Never draw fake shadows.

Public constructors

MaterialShapeDrawable()
MaterialShapeDrawable(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
MaterialShapeDrawable(ShapePathModel shapePathModel)
MaterialShapeDrawable(ShapeAppearanceModel shapeAppearanceModel)

Public methods

static MaterialShapeDrawable createWithElevationOverlay(Context context, float elevation)

Returns a MaterialShapeDrawable with the elevation overlay functionality initialized, a fill color of colorSurface, and an elevation of elevation.

static MaterialShapeDrawable createWithElevationOverlay(Context context)

Returns a MaterialShapeDrawable with the elevation overlay functionality initialized, a fill color of colorSurface, and an elevation of 0.

static MaterialShapeDrawable createWithElevationOverlay(Context context, float elevation, ColorStateList backgroundTint)

Returns a MaterialShapeDrawable with the elevation overlay functionality initialized, a fill color of backgroundTint, and an elevation of elevation.

void draw(Canvas canvas)
int getAlpha()
float getBottomLeftCornerResolvedSize()

Returns the actual size of the bottom left corner for the current bounds.

float getBottomRightCornerResolvedSize()

Returns the actual size of the bottom right corner for the current bounds.

Drawable.ConstantState getConstantState()
float getElevation()

Returns the elevation used to render both fake shadows when requiresCompatShadow() is true and elevation overlays.

ColorStateList getFillColor()

Get the color used for the fill.

float getInterpolation()

Get the interpolation of the path, between 0 and 1.

int getOpacity()
void getOutline(Outline outline)
boolean getPadding(Rect padding)
Paint.Style getPaintStyle()

Get the current style used by the shape's paint.

float getParentAbsoluteElevation()

Returns the parent absolute elevation.

void getPathForSize(int width, int height, Path path)

This method is deprecated. see ShapeAppearancePathProvider

int getResolvedTintColor()

Get the tint color factoring in any other runtime modifications such as elevation overlays.

float getScale()

Get the scale of the rendered path.

int getShadowCompatRotation()

Returns the rotation offset applied to the fake shadow which is drawn when requiresCompatShadow() is true.

int getShadowCompatibilityMode()
int getShadowElevation()

This method is deprecated. use getElevation() instead.

int getShadowOffsetX()

Returns the X offset of the shadow from the bounds of the shape.

int getShadowOffsetY()

Returns the Y offset of the shadow from the bounds of the shape.

int getShadowRadius()

Get the shadow radius rendered by the path in pixels.

ShapeAppearanceModel getShapeAppearanceModel()

Get the ShapeAppearanceModel containing the path that will be rendered in this drawable.

ShapePathModel getShapedViewModel()

This method is deprecated. Use getShapeAppearanceModel() instead.

ColorStateList getStrokeColor()

Get the color used for the stroke.

ColorStateList getStrokeTintList()

Get the stroke's current ColorStateList.

float getStrokeWidth()

Get the stroke width used by the shape's paint.

ColorStateList getTintList()

Get the tint list used by the shape's paint.

float getTopLeftCornerResolvedSize()

Returns the actual size of the top left corner for the current bounds.

float getTopRightCornerResolvedSize()

Returns the actual size of the top right corner for the current bounds.

float getTranslationZ()

Returns the translationZ used to render both fake shadows when requiresCompatShadow() is true and elevation overlays.

Region getTransparentRegion()
float getZ()

Returns the visual z position of this drawable, in pixels.

void initializeElevationOverlay(Context context)

Initializes the elevation overlay functionality for this drawable.

void invalidateSelf()
boolean isElevationOverlayEnabled()

Returns whether the elevation overlay functionality is initialized and enabled in this drawable's theme context.

boolean isElevationOverlayInitialized()

Returns whether the elevation overlay functionality has been initialized for this drawable.

boolean isPointInTransparentRegion(int x, int y)

Determines whether a point is contained within the transparent region of the Drawable.

boolean isShadowEnabled()

This method is deprecated. use getShadowCompatibilityMode() instead

boolean isStateful()
Drawable mutate()
boolean requiresCompatShadow()

Returns true if fake shadows should be drawn.

void setAlpha(int alpha)
void setColorFilter(ColorFilter colorFilter)
void setCornerSize(float cornerSize)

Updates the corners for the given CornerSize.

void setCornerSize(CornerSize cornerSize)

Updates the corners for the given CornerSize.

void setEdgeIntersectionCheckEnable(boolean enable)
void setElevation(float elevation)

Sets the elevation used to render both fake shadows when requiresCompatShadow() is true and elevation overlays.

void setFillColor(ColorStateList fillColor)

Set the color used for the fill.

void setInterpolation(float interpolation)

Set the interpolation of the path, between 0 and 1.

void setPadding(int left, int top, int right, int bottom)

Configure the padding of the shape

void setPaintStyle(Paint.Style paintStyle)

Set the style used by the shape's paint.

void setParentAbsoluteElevation(float parentAbsoluteElevation)

Sets the parent absolute elevation, which is used to render elevation overlays.

void setScale(float scale)

Set the scale of the rendered path.

void setShadowBitmapDrawingEnable(boolean enable)
void setShadowColor(int shadowColor)

Set the color of fake shadow rendered behind the shape.

void setShadowCompatRotation(int shadowRotation)

Set the rotation offset applied to the fake shadow which is drawn when requiresCompatShadow() is true.

void setShadowCompatibilityMode(int mode)

Set the shadow compatibility mode.

void setShadowElevation(int shadowElevation)

This method is deprecated. use setElevation(float) instead.

void setShadowEnabled(boolean shadowEnabled)

This method is deprecated. use setShadowCompatibilityMode(int) instead.

void setShadowRadius(int shadowRadius)

This method is deprecated. use setElevation(float) instead.

void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel)

Set the ShapeAppearanceModel containing the path that will be rendered in this drawable.

void setShapedViewModel(ShapePathModel shapedViewModel)

This method is deprecated. Use setShapeAppearanceModel(ShapeAppearanceModel) instead.

void setStroke(float strokeWidth, ColorStateList strokeColor)

Set the shape's stroke width and stroke color using a ColorStateList.

void setStroke(float strokeWidth, int strokeColor)

Set the shape's stroke width and stroke color.

void setStrokeColor(ColorStateList strokeColor)

Set the color used for the stroke.

void setStrokeTint(ColorStateList tintList)

Set the shape's stroke ColorStateList

void setStrokeTint(int tintColor)

Set the shape's stroke color.

void setStrokeWidth(float strokeWidth)

Set the stroke width used by the shape's paint.

void setTint(int tintColor)
void setTintList(ColorStateList tintList)
void setTintMode(PorterDuff.Mode tintMode)
void setTranslationZ(float translationZ)

Sets the translationZ used to render both fake shadows when requiresCompatShadow() is true and elevation overlays.

void setUseTintColorForShadow(boolean useTintColorForShadow)

Set whether fake shadow color should match next set tint color.

void setZ(float z)

Sets the visual z position of this view, in pixels.

Protected methods

int compositeElevationOverlayIfNeeded(int backgroundColor)
RectF getBoundsAsRectF()
void onBoundsChange(Rect bounds)
boolean onStateChange(int[] state)

Inherited methods

Constants

SHADOW_COMPAT_MODE_ALWAYS

public static final int SHADOW_COMPAT_MODE_ALWAYS

Always draw fake shadows, never draw native elevation shadows. If a path could be concave, this will prevent the shadow from suddenly being rendered natively.

Constant Value: 2 (0x00000002)

SHADOW_COMPAT_MODE_DEFAULT

public static final int SHADOW_COMPAT_MODE_DEFAULT

Try to draw native elevation shadows if possible, otherwise use fake shadows. This is best for paths which will always be convex. If the path might change to be concave, you should consider using SHADOW_COMPAT_MODE_ALWAYS otherwise the shadows could suddenly switch from native to fake in the middle of an animation.

Constant Value: 0 (0x00000000)

SHADOW_COMPAT_MODE_NEVER

public static final int SHADOW_COMPAT_MODE_NEVER

Never draw fake shadows. You may want to enable this if backwards compatibility for shadows isn't as important as performance. Native shadow elevation shadows will still be drawn if possible.

Constant Value: 1 (0x00000001)

Public constructors

MaterialShapeDrawable

public MaterialShapeDrawable ()

MaterialShapeDrawable

public MaterialShapeDrawable (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

MaterialShapeDrawable

public MaterialShapeDrawable (ShapePathModel shapePathModel)

Parameters
shapePathModel ShapePathModel

MaterialShapeDrawable

public MaterialShapeDrawable (ShapeAppearanceModel shapeAppearanceModel)

Parameters
shapeAppearanceModel ShapeAppearanceModel

Public methods

createWithElevationOverlay

public static MaterialShapeDrawable createWithElevationOverlay (Context context, 
                float elevation)

Returns a MaterialShapeDrawable with the elevation overlay functionality initialized, a fill color of colorSurface, and an elevation of elevation.

See ElevationOverlayProvider.compositeOverlayIfNeeded(int, float) for information on when the overlay will be active.

Parameters
context Context

elevation float

Returns
MaterialShapeDrawable

createWithElevationOverlay

public static MaterialShapeDrawable createWithElevationOverlay (Context context)

Returns a MaterialShapeDrawable with the elevation overlay functionality initialized, a fill color of colorSurface, and an elevation of 0.

See ElevationOverlayProvider.compositeOverlayIfNeeded(int, float) for information on when the overlay will be active.

Parameters
context Context

Returns
MaterialShapeDrawable

createWithElevationOverlay

public static MaterialShapeDrawable createWithElevationOverlay (Context context, 
                float elevation, 
                ColorStateList backgroundTint)

Returns a MaterialShapeDrawable with the elevation overlay functionality initialized, a fill color of backgroundTint, and an elevation of elevation. When backgroundTint is null, colorSurface will be used as default.

See ElevationOverlayProvider.compositeOverlayIfNeeded(int, float) for information on when the overlay will be active.

Parameters
context Context

elevation float

backgroundTint ColorStateList

Returns
MaterialShapeDrawable

draw

public void draw (Canvas canvas)

Parameters
canvas Canvas

getAlpha

public int getAlpha ()

Returns
int

getBottomLeftCornerResolvedSize

public float getBottomLeftCornerResolvedSize ()

Returns the actual size of the bottom left corner for the current bounds.

Returns
float

getBottomRightCornerResolvedSize

public float getBottomRightCornerResolvedSize ()

Returns the actual size of the bottom right corner for the current bounds.

Returns
float

getConstantState

public Drawable.ConstantState getConstantState ()

Returns
Drawable.ConstantState

getElevation

public float getElevation ()

Returns the elevation used to render both fake shadows when requiresCompatShadow() is true and elevation overlays. This value is the same as the native elevation that would be used to render shadows on API 21 and up.

Returns
float

getFillColor

public ColorStateList getFillColor ()

Get the color used for the fill.

Returns
ColorStateList the color set on the Paint object responsible for the fill.

getInterpolation

public float getInterpolation ()

Get the interpolation of the path, between 0 and 1. Ranges between 0 (none) and 1 (fully) interpolated.

Returns
float the interpolation of the path.

getOpacity

public int getOpacity ()

Returns
int

getOutline

public void getOutline (Outline outline)

Parameters
outline Outline

getPadding

public boolean getPadding (Rect padding)

Parameters
padding Rect

Returns
boolean

getPaintStyle

public Paint.Style getPaintStyle ()

Get the current style used by the shape's paint.

Returns
Paint.Style current used paint style.

getParentAbsoluteElevation

public float getParentAbsoluteElevation ()

Returns the parent absolute elevation.

Returns
float

getPathForSize

public void getPathForSize (int width, 
                int height, 
                Path path)

This method is deprecated.
see ShapeAppearancePathProvider

Parameters
width int

height int

path Path

getResolvedTintColor

public int getResolvedTintColor ()

Get the tint color factoring in any other runtime modifications such as elevation overlays.

Returns
int

getScale

public float getScale ()

Get the scale of the rendered path. A value of 1 renders it at 100% size.

Returns
float the scale of the path.

getShadowCompatRotation

public int getShadowCompatRotation ()

Returns the rotation offset applied to the fake shadow which is drawn when requiresCompatShadow() is true.

Returns
int

getShadowCompatibilityMode

public int getShadowCompatibilityMode ()

Returns
int

getShadowElevation

public int getShadowElevation ()

This method is deprecated.
use getElevation() instead.

Get the shadow elevation rendered by the path.

Returns
int

getShadowOffsetX

public int getShadowOffsetX ()

Returns the X offset of the shadow from the bounds of the shape.

Returns
int

getShadowOffsetY

public int getShadowOffsetY ()

Returns the Y offset of the shadow from the bounds of the shape.

Returns
int

getShadowRadius

public int getShadowRadius ()

Get the shadow radius rendered by the path in pixels. This method should be used only when the actual size of the shadow is required. Usually getElevation() should be used instead to get the actual elevation of this view as it might be different.

Returns
int

getShapeAppearanceModel

public ShapeAppearanceModel getShapeAppearanceModel ()

Get the ShapeAppearanceModel containing the path that will be rendered in this drawable.

Returns
ShapeAppearanceModel the current model.

getShapedViewModel

public ShapePathModel getShapedViewModel ()

This method is deprecated.
Use getShapeAppearanceModel() instead.

Get the ShapePathModel containing the path that will be rendered in this drawable.

Returns
ShapePathModel the current model.

getStrokeColor

public ColorStateList getStrokeColor ()

Get the color used for the stroke.

Returns
ColorStateList the color set on the Paint object responsible for the stroke.

getStrokeTintList

public ColorStateList getStrokeTintList ()

Get the stroke's current ColorStateList.

Returns
ColorStateList the stroke's current ColorStateList.

getStrokeWidth

public float getStrokeWidth ()

Get the stroke width used by the shape's paint.

Returns
float the stroke's current width.

getTintList

public ColorStateList getTintList ()

Get the tint list used by the shape's paint.

Returns
ColorStateList

getTopLeftCornerResolvedSize

public float getTopLeftCornerResolvedSize ()

Returns the actual size of the top left corner for the current bounds.

Returns
float

getTopRightCornerResolvedSize

public float getTopRightCornerResolvedSize ()

Returns the actual size of the top right corner for the current bounds.

Returns
float

getTranslationZ

public float getTranslationZ ()

Returns the translationZ used to render both fake shadows when requiresCompatShadow() is true and elevation overlays. This value is the same as the native translationZ that would be used to render shadows on API 21 and up.

Returns
float

getTransparentRegion

public Region getTransparentRegion ()

Returns
Region

getZ

public float getZ ()

Returns the visual z position of this drawable, in pixels. This is equivalent to the translationZ property plus the current elevation property.

Returns
float

initializeElevationOverlay

public void initializeElevationOverlay (Context context)

Initializes the elevation overlay functionality for this drawable.

See ElevationOverlayProvider.compositeOverlayIfNeeded(int, float) for information on when the overlay will be active.

Parameters
context Context

invalidateSelf

public void invalidateSelf ()

isElevationOverlayEnabled

public boolean isElevationOverlayEnabled ()

Returns whether the elevation overlay functionality is initialized and enabled in this drawable's theme context.

Returns
boolean

isElevationOverlayInitialized

public boolean isElevationOverlayInitialized ()

Returns whether the elevation overlay functionality has been initialized for this drawable.

Returns
boolean

isPointInTransparentRegion

public boolean isPointInTransparentRegion (int x, 
                int y)

Determines whether a point is contained within the transparent region of the Drawable. A return value of true generally suggests that the touched view should not process a touch event at that point.

Parameters
x int: The X coordinate of the point.

y int: The Y coordinate of the point.

Returns
boolean true iff the point is contained in the transparent region of the Drawable.

isShadowEnabled

public boolean isShadowEnabled ()

This method is deprecated.
use getShadowCompatibilityMode() instead

Get shadow rendering status for shadows when requiresCompatShadow() is true.

Returns
boolean true if fake shadows should be drawn, false otherwise.

isStateful

public boolean isStateful ()

Returns
boolean

mutate

public Drawable mutate ()

Returns
Drawable

requiresCompatShadow

public boolean requiresCompatShadow ()

Returns true if fake shadows should be drawn. Native elevation shadows can't be drawn on API < 21 or when the shape is concave.

Returns
boolean

setAlpha

public void setAlpha (int alpha)

Parameters
alpha int

setColorFilter

public void setColorFilter (ColorFilter colorFilter)

Parameters
colorFilter ColorFilter

setCornerSize

public void setCornerSize (float cornerSize)

Updates the corners for the given CornerSize.

Parameters
cornerSize float

setCornerSize

public void setCornerSize (CornerSize cornerSize)

Updates the corners for the given CornerSize.

Parameters
cornerSize CornerSize

setEdgeIntersectionCheckEnable

public void setEdgeIntersectionCheckEnable (boolean enable)

Parameters
enable boolean

setElevation

public void setElevation (float elevation)

Sets the elevation used to render both fake shadows when requiresCompatShadow() is true and elevation overlays. This value is the same as the native elevation that would be used to render shadows on API 21 and up.

Parameters
elevation float

setFillColor

public void setFillColor (ColorStateList fillColor)

Set the color used for the fill.

Parameters
fillColor ColorStateList: the color set on the Paint object responsible for the fill.

setInterpolation

public void setInterpolation (float interpolation)

Set the interpolation of the path, between 0 and 1. Ranges between 0 (none) and 1 (fully) interpolated. An interpolation of 1 generally indicates a fully rendered path, while an interpolation of 0 generally indicates a fully healed path, which is usually a rectangle.

Parameters
interpolation float: the desired interpolation.

setPadding

public void setPadding (int left, 
                int top, 
                int right, 
                int bottom)

Configure the padding of the shape

Parameters
left int: Left padding of the shape

top int: Top padding of the shape

right int: Right padding of the shape

bottom int: Bottom padding of the shape

setPaintStyle

public void setPaintStyle (Paint.Style paintStyle)

Set the style used by the shape's paint.

Parameters
paintStyle Paint.Style: the desired style.

setParentAbsoluteElevation

public void setParentAbsoluteElevation (float parentAbsoluteElevation)

Sets the parent absolute elevation, which is used to render elevation overlays.

Parameters
parentAbsoluteElevation float

setScale

public void setScale (float scale)

Set the scale of the rendered path. A value of 1 renders it at 100% size.

Parameters
scale float: the desired scale.

setShadowBitmapDrawingEnable

public void setShadowBitmapDrawingEnable (boolean enable)

Parameters
enable boolean

setShadowColor

public void setShadowColor (int shadowColor)

Set the color of fake shadow rendered behind the shape. This will only be drawn when requiresCompatShadow() is true, otherwise native elevation shadows will be drawn which don't support colored shadows.

Setting a shadow color will prevent the tint color from being used.

Parameters
shadowColor int: desired color.

setShadowCompatRotation

public void setShadowCompatRotation (int shadowRotation)

Set the rotation offset applied to the fake shadow which is drawn when requiresCompatShadow() is true. 0 degrees will draw the shadow below the shape.

This allows for the Drawable to be wrapped in a RotateDrawable, or rotated in a view while still having the fake shadow to appear to be drawn from the bottom.

Parameters
shadowRotation int

setShadowCompatibilityMode

public void setShadowCompatibilityMode (int mode)

Set the shadow compatibility mode. This allows control over when fake shadows should drawn instead of native elevation shadows.

Note: To prevent clipping of fake shadow for views on API levels above lollipop, the parent view must disable clipping of children by calling ViewGroup.setClipChildren(boolean), or by setting `android:clipChildren="false"` in xml. `clipToPadding` may also need to be false if there is any padding on the parent that could intersect the shadow.

Parameters
mode int

setShadowElevation

public void setShadowElevation (int shadowElevation)

This method is deprecated.
use setElevation(float) instead.

Set the shadow elevation rendered by the path.

Parameters
shadowElevation int: the desired elevation.

setShadowEnabled

public void setShadowEnabled (boolean shadowEnabled)

This method is deprecated.
use setShadowCompatibilityMode(int) instead.

Set shadow rendering to be enabled or disabled when requiresCompatShadow() is true. Setting this to false could provide some performance benefits on older devices if you don't mind no shadows being drawn.

Note: native elevation shadows will still be drawn on API 21 and up if the shape is convex and the view with this background has elevation.

Parameters
shadowEnabled boolean: true if fake shadows should be drawn; false if not.

setShadowRadius

public void setShadowRadius (int shadowRadius)

This method is deprecated.
use setElevation(float) instead.

Set the shadow radius rendered by the path.

Parameters
shadowRadius int: the desired shadow radius.

setShapeAppearanceModel

public void setShapeAppearanceModel (ShapeAppearanceModel shapeAppearanceModel)

Set the ShapeAppearanceModel containing the path that will be rendered in this drawable.

Parameters
shapeAppearanceModel ShapeAppearanceModel: the desired model.

setShapedViewModel

public void setShapedViewModel (ShapePathModel shapedViewModel)

This method is deprecated.
Use setShapeAppearanceModel(ShapeAppearanceModel) instead.

Set the ShapePathModel containing the path that will be rendered in this drawable.

Parameters
shapedViewModel ShapePathModel: the desired model.

setStroke

public void setStroke (float strokeWidth, 
                ColorStateList strokeColor)

Set the shape's stroke width and stroke color using a ColorStateList.

Parameters
strokeWidth float: a float for the width of the stroke.

strokeColor ColorStateList: the ColorStateList for the shape's stroke.

setStroke

public void setStroke (float strokeWidth, 
                int strokeColor)

Set the shape's stroke width and stroke color.

Parameters
strokeWidth float: a float for the width of the stroke.

strokeColor int: an int representing the Color to use for the shape's stroke.

setStrokeColor

public void setStrokeColor (ColorStateList strokeColor)

Set the color used for the stroke.

Parameters
strokeColor ColorStateList: the color set on the Paint object responsible for the stroke.

setStrokeTint

public void setStrokeTint (ColorStateList tintList)

Set the shape's stroke ColorStateList

Parameters
tintList ColorStateList: the ColorStateList for the shape's stroke.

setStrokeTint

public void setStrokeTint (int tintColor)

Set the shape's stroke color.

Parameters
tintColor int: an int representing the Color to use for the shape's stroke.

setStrokeWidth

public void setStrokeWidth (float strokeWidth)

Set the stroke width used by the shape's paint.

Parameters
strokeWidth float: desired stroke width.

setTint

public void setTint (int tintColor)

Parameters
tintColor int

setTintList

public void setTintList (ColorStateList tintList)

Parameters
tintList ColorStateList

setTintMode

public void setTintMode (PorterDuff.Mode tintMode)

Parameters
tintMode PorterDuff.Mode

setTranslationZ

public void setTranslationZ (float translationZ)

Sets the translationZ used to render both fake shadows when requiresCompatShadow() is true and elevation overlays. This value is the same as the native translationZ that would be used to render shadows on API 21 and up.

Parameters
translationZ float

setUseTintColorForShadow

public void setUseTintColorForShadow (boolean useTintColorForShadow)

Set whether fake shadow color should match next set tint color. This will only be drawn when requiresCompatShadow() is true, otherwise native elevation shadows will be drawn which don't support colored shadows.

Parameters
useTintColorForShadow boolean: true if color should match; false otherwise.

setZ

public void setZ (float z)

Sets the visual z position of this view, in pixels. This is equivalent to setting the translationZ property to be the difference between the z value passed in and the current elevation property.

Parameters
z float

Protected methods

compositeElevationOverlayIfNeeded

protected int compositeElevationOverlayIfNeeded (int backgroundColor)

Parameters
backgroundColor int

Returns
int

getBoundsAsRectF

protected RectF getBoundsAsRectF ()

Returns
RectF

onBoundsChange

protected void onBoundsChange (Rect bounds)

Parameters
bounds Rect

onStateChange

protected boolean onStateChange (int[] state)

Parameters
state int

Returns
boolean