public class IconicsDrawable
extends android.graphics.drawable.Drawable
Drawable which can display icons from icon fonts.| Modifier and Type | Field and Description |
|---|---|
protected IconicsBrush<android.graphics.Paint> |
mBackgroundBrush |
protected IconicsBrush<android.graphics.Paint> |
mBackgroundContourBrush |
protected android.content.Context |
mContext |
protected IconicsBrush<android.graphics.Paint> |
mContourBrush |
protected IconicsBrush<android.text.TextPaint> |
mIconBrush |
static int |
TOOLBAR_ICON_PADDING
Size of
androidx.appcompat.widget.Toolbar icon padding in dp |
static int |
TOOLBAR_ICON_SIZE
Size of
androidx.appcompat.widget.Toolbar icon in dp |
| Modifier | Constructor and Description |
|---|---|
|
IconicsDrawable(android.content.Context context) |
|
IconicsDrawable(android.content.Context context,
java.lang.Character icon) |
|
IconicsDrawable(android.content.Context context,
IIcon icon) |
protected |
IconicsDrawable(android.content.Context context,
ITypeface typeface,
IIcon icon) |
|
IconicsDrawable(android.content.Context context,
java.lang.String icon) |
| Modifier and Type | Method and Description |
|---|---|
IconicsDrawable |
actionBar()
Sets the size and the Padding to the correct values to be used for the actionBar / toolBar
|
IconicsDrawable |
alpha(int alpha)
Sets the opacity
**NOTE** if you define a color (or as part of a colorStateList) with alpha
the alpha value of that color will ALWAYS WIN!
|
IconicsDrawable |
backgroundColor(android.content.res.ColorStateList colors)
Set background contour colors.
|
IconicsDrawable |
backgroundColor(int color)
Set background color.
|
IconicsDrawable |
backgroundColorListRes(int colorResId)
Set background contour colors from color res.
|
IconicsDrawable |
backgroundColorRes(int colorResId)
Set background color from res.
|
IconicsDrawable |
backgroundContourColor(android.content.res.ColorStateList colors)
Set background contour colors.
|
IconicsDrawable |
backgroundContourColor(int color)
Set background contour color.
|
IconicsDrawable |
backgroundContourColorListRes(int colorResId)
Set background contour colors from color res.
|
IconicsDrawable |
backgroundContourColorRes(int colorResId)
Set background contour color from color res.
|
IconicsDrawable |
backgroundContourWidthDp(int sizeDp)
Set background contour width from dp for the icon
|
IconicsDrawable |
backgroundContourWidthPx(int sizePx)
Set background contour width for the icon.
|
IconicsDrawable |
backgroundContourWidthRes(int sizeResId)
Set background contour width from an dimen res for the icon
|
void |
clearColorFilter() |
IconicsDrawable |
clearShadow()
Clear the shadow for the icon
|
IconicsDrawable |
clone()
clones the icon
|
IconicsDrawable |
color(android.content.res.ColorStateList colors)
Set the color of the drawable.
|
IconicsDrawable |
color(int color)
Set the color of the drawable.
|
IconicsDrawable |
colorFilter(android.graphics.ColorFilter cf)
Set the colorFilter
|
IconicsDrawable |
colorListRes(int colorResId)
Set the color of the drawable.
|
IconicsDrawable |
colorRes(int colorResId)
Set the color of the drawable.
|
IconicsDrawable |
contourColor(android.content.res.ColorStateList colors)
Set contour colors.
|
IconicsDrawable |
contourColor(int color)
Set contour color.
|
IconicsDrawable |
contourColorListRes(int colorResId)
Set contour colors from color res.
|
IconicsDrawable |
contourColorRes(int colorResId)
Set contour color from color res.
|
IconicsDrawable |
contourWidthDp(int sizeDp)
Set contour width from dp for the icon
|
IconicsDrawable |
contourWidthPx(int sizePx)
Set contour width for the icon.
|
IconicsDrawable |
contourWidthRes(int sizeResId)
Set contour width from an dimen res for the icon
|
void |
draw(android.graphics.Canvas canvas) |
IconicsDrawable |
drawBackgroundContour(boolean drawBackgroundContour)
Enable/disable background contour drawing.
|
IconicsDrawable |
drawContour(boolean drawContour)
Enable/disable contour drawing.
|
IconicsDrawable |
enableShadowSupport(android.view.View view)
Enables the `LAYER_TYPE_SOFTWARE` for the view holding this icon,
to enable correct shadowLayer drawing
|
int |
getAlpha() |
int |
getBackgroundColor() |
android.content.res.ColorStateList |
getBackgroundColorList() |
int |
getBackgroundContourColor() |
android.content.res.ColorStateList |
getBackgroundContourColorList() |
int |
getColor() |
android.content.res.ColorStateList |
getColorList() |
int |
getCompatAlpha()
just a helper method to get the alpha value
|
int |
getContourColor() |
android.content.res.ColorStateList |
getContourColorList() |
IIcon |
getIcon() |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getOpacity() |
java.lang.String |
getPlainIcon() |
IconicsDrawable |
icon(java.lang.Character icon)
Loads and draws given.
|
IconicsDrawable |
icon(java.lang.Character icon,
android.graphics.Typeface typeface)
Loads and draws given.
|
IconicsDrawable |
icon(IIcon icon)
Loads and draws given.
|
protected IconicsDrawable |
icon(ITypeface typeface,
IIcon icon)
Loads and draws given.
|
IconicsDrawable |
icon(java.lang.String icon)
Loads and draws given text
|
IconicsDrawable |
iconOffsetXDp(int sizeDp)
set the icon offset for X as dp
|
IconicsDrawable |
iconOffsetXPx(int sizePx)
set the icon offset for X
|
IconicsDrawable |
iconOffsetXRes(int sizeResId)
set the icon offset for X from resource
|
IconicsDrawable |
iconOffsetYDp(int sizeDp)
set the icon offset for Y as dp
|
IconicsDrawable |
iconOffsetYPx(int sizePx)
set the icon offset for Y
|
IconicsDrawable |
iconOffsetYRes(int sizeResId)
set the icon offset for Y from resource
|
IconicsDrawable |
iconText(java.lang.String icon)
Loads and draws given text
|
IconicsDrawable |
iconText(java.lang.String icon,
android.graphics.Typeface typeface)
Loads and draws given text
|
boolean |
isStateful() |
protected void |
onBoundsChange(android.graphics.Rect bounds) |
protected boolean |
onStateChange(int[] stateSet) |
IconicsDrawable |
paddingDp(int sizeDp)
Set the padding in dp for the drawable
|
IconicsDrawable |
paddingPx(int sizePx)
Set a padding for the.
|
IconicsDrawable |
paddingRes(int sizeResId)
Set the padding of the drawable from res
|
IconicsDrawable |
respectFontBounds(boolean respectBounds)
Set if it should respect the original bounds of the icon.
|
IconicsDrawable |
roundedCornersDp(int sizeDp)
Set rounded corner from dp
|
IconicsDrawable |
roundedCornersPx(int sizePx)
Set rounded corner from px
|
IconicsDrawable |
roundedCornersRes(int sizeResId)
Set rounded corner from res
|
IconicsDrawable |
roundedCornersRxDp(int sizeDp)
Set rounded corner from dp
|
IconicsDrawable |
roundedCornersRxPx(int sizePx)
Set rounded corner from px
|
IconicsDrawable |
roundedCornersRxRes(int sizeResId)
Set rounded corner from res
|
IconicsDrawable |
roundedCornersRyDp(int sizeDp)
Set rounded corner from dp
|
IconicsDrawable |
roundedCornersRyPx(int sizePx)
Set rounded corner from px
|
IconicsDrawable |
roundedCornersRyRes(int sizeResId)
Set rounded corner from res
|
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter cf) |
boolean |
setState(int[] stateSet) |
void |
setTintList(android.content.res.ColorStateList tint) |
void |
setTintMode(android.graphics.PorterDuff.Mode tintMode) |
IconicsDrawable |
shadowDp(float radiusDp,
float dxDp,
float dyDp,
int color)
Sets the shadow for the icon
This requires shadow support to be enabled on the view holding this `IconicsDrawable`
|
IconicsDrawable |
shadowPx(float radius,
float dx,
float dy,
int color)
Sets the shadow for the icon
This requires shadow support to be enabled on the view holding this `IconicsDrawable`
|
IconicsDrawable |
shadowRes(int radiusRes,
int dxRes,
int dyRes,
int colorResId)
Sets the shadow for the icon
This requires shadow support to be enabled on the view holding this `IconicsDrawable`
|
IconicsDrawable |
sizeDp(int sizeDp)
Set the size of the drawable.
|
IconicsDrawable |
sizeDpX(int sizeDp)
Set the size of the drawable.
|
IconicsDrawable |
sizeDpY(int sizeDp)
Set the size of the drawable.
|
IconicsDrawable |
sizePx(int sizePx)
Set the size of the drawable.
|
IconicsDrawable |
sizePxX(int sizePx)
Set the size of the drawable.
|
IconicsDrawable |
sizePxY(int sizePx)
Set the size of the drawable.
|
IconicsDrawable |
sizeRes(int sizeResId)
Set the size of the drawable.
|
IconicsDrawable |
sizeResX(int sizeResId)
Set the size of the drawable.
|
IconicsDrawable |
sizeResY(int sizeResId)
Set the size of the drawable.
|
IconicsDrawable |
style(android.graphics.Paint.Style style)
Sets the style
|
IconicsAnimatedDrawable |
toAnimatedDrawable()
Transform the icon to an animated icon
|
android.graphics.Bitmap |
toBitmap()
Creates a BitMap to use in Widgets or anywhere else
|
IconicsDrawable |
typeface(android.graphics.Typeface typeface)
sets the typeface of the drawable
NOTE THIS WILL OVERWRITE THE ICONFONT!
|
applyTheme, canApplyTheme, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isVisible, jumpToCurrentState, mutate, onLayoutDirectionChanged, onLevelChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setTint, setVisible, unscheduleSelfpublic static final int TOOLBAR_ICON_SIZE
androidx.appcompat.widget.Toolbar icon in dppublic static final int TOOLBAR_ICON_PADDING
androidx.appcompat.widget.Toolbar icon padding in dpprotected android.content.Context mContext
protected final IconicsBrush<android.text.TextPaint> mIconBrush
protected final IconicsBrush<android.graphics.Paint> mBackgroundBrush
protected final IconicsBrush<android.graphics.Paint> mContourBrush
protected final IconicsBrush<android.graphics.Paint> mBackgroundContourBrush
public IconicsDrawable(android.content.Context context)
public IconicsDrawable(android.content.Context context,
java.lang.Character icon)
public IconicsDrawable(android.content.Context context,
java.lang.String icon)
public IconicsDrawable(android.content.Context context,
IIcon icon)
public int getColor()
public android.content.res.ColorStateList getColorList()
public int getContourColor()
public android.content.res.ColorStateList getContourColorList()
public int getBackgroundColor()
public android.content.res.ColorStateList getBackgroundColorList()
public int getBackgroundContourColor()
public android.content.res.ColorStateList getBackgroundContourColorList()
public IIcon getIcon()
public java.lang.String getPlainIcon()
public int getCompatAlpha()
public android.graphics.Bitmap toBitmap()
public IconicsDrawable clone()
clone in class java.lang.Objectpublic IconicsAnimatedDrawable toAnimatedDrawable()
public IconicsDrawable icon(java.lang.String icon)
public IconicsDrawable icon(java.lang.Character icon)
public IconicsDrawable icon(java.lang.Character icon, android.graphics.Typeface typeface)
public IconicsDrawable iconText(java.lang.String icon)
public IconicsDrawable iconText(java.lang.String icon, android.graphics.Typeface typeface)
public IconicsDrawable icon(IIcon icon)
protected IconicsDrawable icon(ITypeface typeface, IIcon icon)
public IconicsDrawable respectFontBounds(boolean respectBounds)
respectBounds - set to true if it should respect the original boundspublic IconicsDrawable color(int color)
color - The color, usually from android.graphics.Color or 0xFF012345.public IconicsDrawable colorRes(int colorResId)
colorResId - The color resource, from your R file.public IconicsDrawable colorListRes(int colorResId)
colorResId - The color resource, from your R file.public IconicsDrawable color(android.content.res.ColorStateList colors)
colors - The color, usually from android.graphics.Color or 0xFF012345.public IconicsDrawable iconOffsetXRes(int sizeResId)
public IconicsDrawable iconOffsetXDp(int sizeDp)
public IconicsDrawable iconOffsetXPx(int sizePx)
public IconicsDrawable iconOffsetYRes(int sizeResId)
public IconicsDrawable iconOffsetYDp(int sizeDp)
public IconicsDrawable iconOffsetYPx(int sizePx)
public IconicsDrawable paddingRes(int sizeResId)
public IconicsDrawable paddingDp(int sizeDp)
public IconicsDrawable paddingPx(int sizePx)
public IconicsDrawable actionBar()
public IconicsDrawable sizeRes(int sizeResId)
sizeResId - The dimension resource.public IconicsDrawable sizeDp(int sizeDp)
sizeDp - The size in density-independent pixels (dp).public IconicsDrawable sizePx(int sizePx)
sizePx - The size in pixels (px).public IconicsDrawable sizeResX(int sizeResId)
sizeResId - The dimension resource.public IconicsDrawable sizeDpX(int sizeDp)
sizeDp - The size in density-independent pixels (dp).public IconicsDrawable sizePxX(int sizePx)
sizePx - The size in pixels (px).public IconicsDrawable sizeResY(int sizeResId)
sizeResId - The dimension resource.public IconicsDrawable sizeDpY(int sizeDp)
sizeDp - The size in density-independent pixels (dp).public IconicsDrawable sizePxY(int sizePx)
sizePx - The size in pixels (px).public IconicsDrawable backgroundContourColorRes(int colorResId)
public IconicsDrawable backgroundContourColor(int color)
public IconicsDrawable backgroundContourColorListRes(int colorResId)
public IconicsDrawable backgroundContourColor(android.content.res.ColorStateList colors)
public IconicsDrawable contourColorRes(int colorResId)
public IconicsDrawable contourColor(int color)
public IconicsDrawable contourColorListRes(int colorResId)
public IconicsDrawable contourColor(android.content.res.ColorStateList colors)
public IconicsDrawable backgroundColorRes(int colorResId)
public IconicsDrawable backgroundColor(int color)
public IconicsDrawable backgroundColorListRes(int colorResId)
public IconicsDrawable backgroundColor(android.content.res.ColorStateList colors)
public IconicsDrawable roundedCornersRxRes(int sizeResId)
public IconicsDrawable roundedCornersRxDp(int sizeDp)
public IconicsDrawable roundedCornersRxPx(int sizePx)
public IconicsDrawable roundedCornersRyRes(int sizeResId)
public IconicsDrawable roundedCornersRyDp(int sizeDp)
public IconicsDrawable roundedCornersRyPx(int sizePx)
public IconicsDrawable roundedCornersRes(int sizeResId)
public IconicsDrawable roundedCornersDp(int sizeDp)
public IconicsDrawable roundedCornersPx(int sizePx)
public IconicsDrawable contourWidthRes(int sizeResId)
public IconicsDrawable contourWidthDp(int sizeDp)
public IconicsDrawable contourWidthPx(int sizePx)
public IconicsDrawable enableShadowSupport(android.view.View view)
view - the view holding this `IconicsDrawable`View.setLayerType(int, Paint)public IconicsDrawable shadowRes(int radiusRes, int dxRes, int dyRes, int colorResId)
Paint.setShadowLayer(float, float, float, int),
enableShadowSupport(View)public IconicsDrawable shadowDp(float radiusDp, float dxDp, float dyDp, int color)
Paint.setShadowLayer(float, float, float, int),
enableShadowSupport(View)public IconicsDrawable shadowPx(float radius, float dx, float dy, int color)
Paint.setShadowLayer(float, float, float, int),
enableShadowSupport(View)public IconicsDrawable clearShadow()
Paint.clearShadowLayer(),
enableShadowSupport(View),
shadowPx(float, float, float, int),
shadowDp(float, float, float, int),
shadowRes(int, int, int, int)public IconicsDrawable backgroundContourWidthRes(int sizeResId)
public IconicsDrawable backgroundContourWidthDp(int sizeDp)
public IconicsDrawable backgroundContourWidthPx(int sizePx)
public IconicsDrawable drawContour(boolean drawContour)
public IconicsDrawable drawBackgroundContour(boolean drawBackgroundContour)
public IconicsDrawable colorFilter(android.graphics.ColorFilter cf)
public IconicsDrawable alpha(int alpha)
public IconicsDrawable style(android.graphics.Paint.Style style)
public IconicsDrawable typeface(android.graphics.Typeface typeface)
public void draw(android.graphics.Canvas canvas)
draw in class android.graphics.drawable.Drawablepublic void setTintList(android.content.res.ColorStateList tint)
setTintList in class android.graphics.drawable.Drawablepublic void setTintMode(android.graphics.PorterDuff.Mode tintMode)
setTintMode in class android.graphics.drawable.Drawableprotected void onBoundsChange(android.graphics.Rect bounds)
onBoundsChange in class android.graphics.drawable.Drawablepublic boolean isStateful()
isStateful in class android.graphics.drawable.Drawablepublic boolean setState(int[] stateSet)
setState in class android.graphics.drawable.Drawablepublic int getOpacity()
getOpacity in class android.graphics.drawable.Drawableprotected boolean onStateChange(int[] stateSet)
onStateChange in class android.graphics.drawable.Drawablepublic int getIntrinsicWidth()
getIntrinsicWidth in class android.graphics.drawable.Drawablepublic int getIntrinsicHeight()
getIntrinsicHeight in class android.graphics.drawable.Drawablepublic void setAlpha(int alpha)
setAlpha in class android.graphics.drawable.Drawablepublic int getAlpha()
getAlpha in class android.graphics.drawable.Drawablepublic void setColorFilter(android.graphics.ColorFilter cf)
setColorFilter in class android.graphics.drawable.Drawablepublic void clearColorFilter()
clearColorFilter in class android.graphics.drawable.Drawable