Class RoundedDrawable
- java.lang.Object
-
- android.graphics.drawable.Drawable
-
- com.batch.android.messaging.view.roundimage.RoundedDrawable
-
public class RoundedDrawable extends android.graphics.drawable.Drawable
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BORDER_COLOR
-
Constructor Summary
Constructors Constructor Description RoundedDrawable(android.graphics.Bitmap bitmap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddraw(android.graphics.Canvas canvas)static android.graphics.BitmapdrawableToBitmap(android.graphics.drawable.Drawable drawable)static RoundedDrawablefromBitmap(android.graphics.Bitmap bitmap)static android.graphics.drawable.DrawablefromDrawable(android.graphics.drawable.Drawable drawable)intgetAlpha()intgetBorderColor()android.content.res.ColorStateListgetBorderColors()floatgetBorderWidth()android.graphics.ColorFiltergetColorFilter()floatgetCornerRadius()floatgetCornerRadius(int corner)intgetIntrinsicHeight()intgetIntrinsicWidth()intgetOpacity()android.widget.ImageView.ScaleTypegetScaleType()android.graphics.BitmapgetSourceBitmap()android.graphics.Shader.TileModegetTileModeX()android.graphics.Shader.TileModegetTileModeY()booleanisOval()booleanisStateful()protected voidonBoundsChange(android.graphics.Rect bounds)protected booleanonStateChange(int[] state)voidsetAlpha(int alpha)RoundedDrawablesetBorderColor(int color)RoundedDrawablesetBorderColor(android.content.res.ColorStateList colors)RoundedDrawablesetBorderWidth(float width)voidsetColorFilter(android.graphics.ColorFilter cf)RoundedDrawablesetCornerRadius(float radius)Sets all corners to the specified radius.RoundedDrawablesetCornerRadius(float topLeft, float topRight, float bottomRight, float bottomLeft)Sets the corner radii of all the corners.RoundedDrawablesetCornerRadius(int corner, float radius)Sets the corner radius of one specific corner.voidsetDither(boolean dither)voidsetFilterBitmap(boolean filter)RoundedDrawablesetOval(boolean oval)RoundedDrawablesetScaleType(android.widget.ImageView.ScaleType scaleType)RoundedDrawablesetTileModeX(android.graphics.Shader.TileMode tileModeX)RoundedDrawablesetTileModeY(android.graphics.Shader.TileMode tileModeY)android.graphics.BitmaptoBitmap()-
Methods inherited from class android.graphics.drawable.Drawable
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOpticalInsets, getOutline, getPadding, getState, getTransparentRegion, hasFocusStateSpecified, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isProjected, isVisible, jumpToCurrentState, mutate, onLayoutDirectionChanged, onLevelChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintBlendMode, setTintList, setTintMode, setVisible, unscheduleSelf
-
-
-
-
Field Detail
-
DEFAULT_BORDER_COLOR
public static final int DEFAULT_BORDER_COLOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
fromBitmap
public static RoundedDrawable fromBitmap(android.graphics.Bitmap bitmap)
-
fromDrawable
public static android.graphics.drawable.Drawable fromDrawable(android.graphics.drawable.Drawable drawable)
-
drawableToBitmap
public static android.graphics.Bitmap drawableToBitmap(android.graphics.drawable.Drawable drawable)
-
getSourceBitmap
public android.graphics.Bitmap getSourceBitmap()
-
isStateful
public boolean isStateful()
- Overrides:
isStatefulin classandroid.graphics.drawable.Drawable
-
onStateChange
protected boolean onStateChange(int[] state)
- Overrides:
onStateChangein classandroid.graphics.drawable.Drawable
-
onBoundsChange
protected void onBoundsChange(@NonNull android.graphics.Rect bounds)- Overrides:
onBoundsChangein classandroid.graphics.drawable.Drawable
-
draw
public void draw(@NonNull android.graphics.Canvas canvas)- Specified by:
drawin classandroid.graphics.drawable.Drawable
-
getOpacity
public int getOpacity()
- Specified by:
getOpacityin classandroid.graphics.drawable.Drawable
-
getAlpha
public int getAlpha()
- Overrides:
getAlphain classandroid.graphics.drawable.Drawable
-
setAlpha
public void setAlpha(int alpha)
- Specified by:
setAlphain classandroid.graphics.drawable.Drawable
-
getColorFilter
public android.graphics.ColorFilter getColorFilter()
- Overrides:
getColorFilterin classandroid.graphics.drawable.Drawable
-
setColorFilter
public void setColorFilter(android.graphics.ColorFilter cf)
- Specified by:
setColorFilterin classandroid.graphics.drawable.Drawable
-
setDither
public void setDither(boolean dither)
- Overrides:
setDitherin classandroid.graphics.drawable.Drawable
-
setFilterBitmap
public void setFilterBitmap(boolean filter)
- Overrides:
setFilterBitmapin classandroid.graphics.drawable.Drawable
-
getIntrinsicWidth
public int getIntrinsicWidth()
- Overrides:
getIntrinsicWidthin classandroid.graphics.drawable.Drawable
-
getIntrinsicHeight
public int getIntrinsicHeight()
- Overrides:
getIntrinsicHeightin classandroid.graphics.drawable.Drawable
-
getCornerRadius
public float getCornerRadius()
- Returns:
- the corner radius.
-
getCornerRadius
public float getCornerRadius(int corner)
- Parameters:
corner- the specific corner to get radius of.- Returns:
- the corner radius of the specified corner.
-
setCornerRadius
public RoundedDrawable setCornerRadius(float radius)
Sets all corners to the specified radius.- Parameters:
radius- the radius.- Returns:
- the
RoundedDrawablefor chaining.
-
setCornerRadius
public RoundedDrawable setCornerRadius(int corner, float radius)
Sets the corner radius of one specific corner.- Parameters:
corner- the corner.radius- the radius.- Returns:
- the
RoundedDrawablefor chaining.
-
setCornerRadius
public RoundedDrawable setCornerRadius(float topLeft, float topRight, float bottomRight, float bottomLeft)
Sets the corner radii of all the corners.- Parameters:
topLeft- top left corner radius.topRight- top right corner radiusbottomRight- bototm right corner radius.bottomLeft- bottom left corner radius.- Returns:
- the
RoundedDrawablefor chaining.
-
getBorderWidth
public float getBorderWidth()
-
setBorderWidth
public RoundedDrawable setBorderWidth(float width)
-
getBorderColor
public int getBorderColor()
-
setBorderColor
public RoundedDrawable setBorderColor(int color)
-
getBorderColors
public android.content.res.ColorStateList getBorderColors()
-
setBorderColor
public RoundedDrawable setBorderColor(android.content.res.ColorStateList colors)
-
isOval
public boolean isOval()
-
setOval
public RoundedDrawable setOval(boolean oval)
-
getScaleType
public android.widget.ImageView.ScaleType getScaleType()
-
setScaleType
public RoundedDrawable setScaleType(android.widget.ImageView.ScaleType scaleType)
-
getTileModeX
public android.graphics.Shader.TileMode getTileModeX()
-
setTileModeX
public RoundedDrawable setTileModeX(android.graphics.Shader.TileMode tileModeX)
-
getTileModeY
public android.graphics.Shader.TileMode getTileModeY()
-
setTileModeY
public RoundedDrawable setTileModeY(android.graphics.Shader.TileMode tileModeY)
-
toBitmap
public android.graphics.Bitmap toBitmap()
-
-