public class IconicsDrawable
extends android.graphics.drawable.Drawable
Drawable which can display icons from icon fonts.| Modifier and Type | Field and Description |
|---|---|
static int |
TOOLBAR_ICON_PADDING
Size of
Toolbar icon padding in dp |
static int |
TOOLBAR_ICON_SIZE
Size of
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(int backgroundColor)
set background color
|
IconicsDrawable |
backgroundColorRes(int backgroundColorRes)
set background color from res
|
IconicsDrawable |
backgroundContourColor(int backgroundContourColor)
Set background contour color for the.
|
IconicsDrawable |
backgroundContourColorRes(int backgroundContourColorRes)
Set background contour color from color res.
|
IconicsDrawable |
backgroundContourWidthDp(int backgroundContourWidthDp)
Set background contour width from dp for the icon
|
IconicsDrawable |
backgroundContourWidthPx(int backgroundContourWidth)
Set background contour width for the icon.
|
IconicsDrawable |
backgroundContourWidthRes(int backgroundContourWidthRes)
Set background contour width from an dimen res for the icon
|
void |
clearColorFilter() |
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 colorRes)
Set the color of the drawable.
|
IconicsDrawable |
colorRes(int colorRes)
Set the color of the drawable.
|
IconicsDrawable |
contourColor(int contourColor)
Set contour color for the.
|
IconicsDrawable |
contourColorRes(int contourColorRes)
Set contour color from color res.
|
IconicsDrawable |
contourWidthDp(int contourWidthDp)
Set contour width from dp for the icon
|
IconicsDrawable |
contourWidthPx(int contourWidth)
Set contour width for the icon.
|
IconicsDrawable |
contourWidthRes(int contourWidthRes)
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() |
int |
getBackgroundContourColor() |
int |
getColor() |
android.content.res.ColorStateList |
getColorList() |
int |
getCompatAlpha()
just a helper method to get the alpha value
|
int |
getContourColor() |
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 iconOffsetXDp)
set the icon offset for X as dp
|
IconicsDrawable |
iconOffsetXPx(int iconOffsetX)
set the icon offset for X
|
IconicsDrawable |
iconOffsetXRes(int iconOffsetXRes)
set the icon offset for X from resource
|
IconicsDrawable |
iconOffsetYDp(int iconOffsetYDp)
set the icon offset for Y as dp
|
IconicsDrawable |
iconOffsetYPx(int iconOffsetY)
set the icon offset for Y
|
IconicsDrawable |
iconOffsetYRes(int iconOffsetYRes)
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 iconPadding)
Set the padding in dp for the drawable
|
IconicsDrawable |
paddingPx(int iconPadding)
Set a padding for the.
|
IconicsDrawable |
paddingRes(int dimenRes)
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 roundedCornerDp)
set rounded corner from dp
|
IconicsDrawable |
roundedCornersPx(int roundedCornerPx)
set rounded corner from px
|
IconicsDrawable |
roundedCornersRes(int roundedCornerRes)
set rounded corner from res
|
IconicsDrawable |
roundedCornersRxDp(int roundedCornerRxDp)
set rounded corner from dp
|
IconicsDrawable |
roundedCornersRxPx(int roundedCornerRxPx)
set rounded corner from px
|
IconicsDrawable |
roundedCornersRxRes(int roundedCornerRxRes)
set rounded corner from res
|
IconicsDrawable |
roundedCornersRyDp(int roundedCornerRyDp)
set rounded corner from dp
|
IconicsDrawable |
roundedCornersRyPx(int roundedCornerRyPx)
set rounded corner from px
|
IconicsDrawable |
roundedCornersRyRes(int roundedCornerRyRes)
set rounded corner from res
|
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter cf) |
boolean |
setState(int[] stateSet) |
void |
setTint(int tintColor) |
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 colorRes)
Sets the shadow for the icon
This requires shadow support to be enabled on the view holding this `IconicsDrawable`
|
IconicsDrawable |
sizeDp(int size)
Set the size of the drawable.
|
IconicsDrawable |
sizeDpX(int sizeX)
Set the size of the drawable.
|
IconicsDrawable |
sizeDpY(int sizeY)
Set the size of the drawable.
|
IconicsDrawable |
sizePx(int size)
Set the size of the drawable.
|
IconicsDrawable |
sizePxX(int sizeX)
Set the size of the drawable.
|
IconicsDrawable |
sizePxY(int sizeY)
Set the size of the drawable.
|
IconicsDrawable |
sizeRes(int dimenRes)
Set the size of the drawable.
|
IconicsDrawable |
sizeResX(int dimenResX)
Set the size of the drawable.
|
IconicsDrawable |
sizeResY(int dimenResY)
Set the size of the drawable.
|
IconicsDrawable |
style(android.graphics.Paint.Style style)
Sets the style
|
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, setVisible, unscheduleSelf@Dimension(unit=0) public static final int TOOLBAR_ICON_SIZE
Toolbar icon in dp@Dimension(unit=0) public static final int TOOLBAR_ICON_PADDING
Toolbar icon padding in dppublic 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 int getBackgroundColor()
public int getBackgroundContourColor()
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 IconicsDrawable icon(java.lang.String icon)
icon - public IconicsDrawable icon(java.lang.Character icon)
icon - public IconicsDrawable icon(java.lang.Character icon, @Nullable android.graphics.Typeface typeface)
icon - typeface - public IconicsDrawable iconText(java.lang.String icon)
icon - public IconicsDrawable iconText(java.lang.String icon, @Nullable android.graphics.Typeface typeface)
icon - typeface - public IconicsDrawable icon(IIcon icon)
icon - protected IconicsDrawable icon(ITypeface typeface, IIcon icon)
icon - typeface - 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(@ColorRes int colorRes)
colorRes - The color resource, from your R file.public IconicsDrawable colorListRes(@ColorRes int colorRes)
colorRes - 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(@DimenRes int iconOffsetXRes)
iconOffsetXRes - public IconicsDrawable iconOffsetXDp(@Dimension(unit=0) int iconOffsetXDp)
iconOffsetXDp - public IconicsDrawable iconOffsetXPx(@Dimension(unit=1) int iconOffsetX)
iconOffsetX - public IconicsDrawable iconOffsetYRes(@DimenRes int iconOffsetYRes)
iconOffsetYRes - public IconicsDrawable iconOffsetYDp(@Dimension(unit=0) int iconOffsetYDp)
iconOffsetYDp - public IconicsDrawable iconOffsetYPx(@Dimension(unit=1) int iconOffsetY)
iconOffsetY - public IconicsDrawable paddingRes(@DimenRes int dimenRes)
dimenRes - public IconicsDrawable paddingDp(@Dimension(unit=0) int iconPadding)
iconPadding - public IconicsDrawable paddingPx(@Dimension(unit=1) int iconPadding)
iconPadding - public IconicsDrawable actionBar()
public IconicsDrawable sizeRes(@DimenRes int dimenRes)
dimenRes - The dimension resource.public IconicsDrawable sizeDp(@Dimension(unit=0) int size)
size - The size in density-independent pixels (dp).public IconicsDrawable sizePx(@Dimension(unit=1) int size)
size - The size in pixels (px).public IconicsDrawable sizeResX(@DimenRes int dimenResX)
dimenResX - The dimension resource.public IconicsDrawable sizeDpX(@Dimension(unit=0) int sizeX)
sizeX - The size in density-independent pixels (dp).public IconicsDrawable sizePxX(@Dimension(unit=1) int sizeX)
sizeX - The size in pixels (px).public IconicsDrawable sizeResY(@DimenRes int dimenResY)
dimenResY - The dimension resource.public IconicsDrawable sizeDpY(@Dimension(unit=0) int sizeY)
sizeY - The size in density-independent pixels (dp).public IconicsDrawable sizePxY(@Dimension(unit=1) int sizeY)
sizeY - The size in pixels (px).public IconicsDrawable backgroundContourColorRes(@ColorRes int backgroundContourColorRes)
backgroundContourColorRes - public IconicsDrawable backgroundContourColor(int backgroundContourColor)
backgroundContourColor - public IconicsDrawable contourColorRes(@ColorRes int contourColorRes)
contourColorRes - public IconicsDrawable contourColor(int contourColor)
contourColor - public IconicsDrawable backgroundColorRes(@ColorRes int backgroundColorRes)
backgroundColorRes - public IconicsDrawable backgroundColor(int backgroundColor)
backgroundColor - public IconicsDrawable roundedCornersRxRes(@DimenRes int roundedCornerRxRes)
roundedCornerRxRes - public IconicsDrawable roundedCornersRxDp(@Dimension(unit=0) int roundedCornerRxDp)
roundedCornerRxDp - public IconicsDrawable roundedCornersRxPx(@Dimension(unit=1) int roundedCornerRxPx)
roundedCornerRxPx - public IconicsDrawable roundedCornersRyRes(@DimenRes int roundedCornerRyRes)
roundedCornerRyRes - public IconicsDrawable roundedCornersRyDp(@Dimension(unit=0) int roundedCornerRyDp)
roundedCornerRyDp - public IconicsDrawable roundedCornersRyPx(@Dimension(unit=1) int roundedCornerRyPx)
roundedCornerRyPx - public IconicsDrawable roundedCornersRes(@DimenRes int roundedCornerRes)
roundedCornerRes - public IconicsDrawable roundedCornersDp(@Dimension(unit=0) int roundedCornerDp)
roundedCornerDp - public IconicsDrawable roundedCornersPx(@Dimension(unit=1) int roundedCornerPx)
roundedCornerPx - public IconicsDrawable contourWidthRes(@DimenRes int contourWidthRes)
contourWidthRes - public IconicsDrawable contourWidthDp(@Dimension(unit=0) int contourWidthDp)
contourWidthDp - public IconicsDrawable contourWidthPx(@Dimension(unit=1) int contourWidth)
contourWidth - public IconicsDrawable enableShadowSupport(android.view.View view)
view - the view holding this `IconicsDrawable`View.setLayerType(int, Paint)public IconicsDrawable shadowRes(@DimenRes int radiusRes, @DimenRes int dxRes, @DimenRes int dyRes, @ColorRes int colorRes)
Paint.setShadowLayer(float, float, float, int),
enableShadowSupport(View)public IconicsDrawable shadowDp(@Dimension(unit=0) float radiusDp, @Dimension(unit=0) float dxDp, @Dimension(unit=0) float dyDp, int color)
Paint.setShadowLayer(float, float, float, int),
enableShadowSupport(View)public IconicsDrawable shadowPx(@Dimension(unit=1) float radius, @Dimension(unit=1) float dx, @Dimension(unit=1) float dy, int color)
Paint.setShadowLayer(float, float, float, int),
enableShadowSupport(View)public IconicsDrawable backgroundContourWidthRes(@DimenRes int backgroundContourWidthRes)
backgroundContourWidthRes - public IconicsDrawable backgroundContourWidthDp(@Dimension(unit=0) int backgroundContourWidthDp)
backgroundContourWidthDp - public IconicsDrawable backgroundContourWidthPx(@Dimension(unit=1) int backgroundContourWidth)
backgroundContourWidth - public IconicsDrawable drawContour(boolean drawContour)
drawContour - public IconicsDrawable drawBackgroundContour(boolean drawBackgroundContour)
drawBackgroundContour - public IconicsDrawable colorFilter(android.graphics.ColorFilter cf)
cf - public IconicsDrawable alpha(int alpha)
alpha - public IconicsDrawable style(android.graphics.Paint.Style style)
style - public IconicsDrawable typeface(android.graphics.Typeface typeface)
typeface - public void draw(@NonNull
android.graphics.Canvas canvas)
draw in class android.graphics.drawable.Drawablepublic void setTint(int tintColor)
setTint in class android.graphics.drawable.Drawablepublic void setTintList(android.content.res.ColorStateList tint)
setTintList in class android.graphics.drawable.Drawablepublic void setTintMode(@NonNull
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(@NonNull
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