Class BuiltinIconDrawable
setTintList(ColorStateList)
, icons may be auto mirrored in
RTL (right-to-left) layout direction via setAutoMirrored(boolean)
.- Since:
- 3.12
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.modernui.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final float
-
Constructor Summary
ConstructorsConstructorDescriptionBuiltinIconDrawable
(Resources res, int iconType) BuiltinIconDrawable
(Resources res, int iconType, float sizeInDp) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).int
getAlpha()
Gets the current alpha value for the drawable.int
Returns the drawable's intrinsic height.int
Returns the drawable's intrinsic width.boolean
Indicates whether this drawable has at least one state spec explicitly specifying state_focused.boolean
Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left.boolean
Indicates whether this drawable will change its appearance based on state.protected boolean
onStateChange
(int[] stateSet) Override this in your subclass to change appearance if you recognize the specified state.void
setAlpha
(int alpha) Specify an alpha value for the drawable.void
setAutoMirrored
(boolean mirrored) Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left).void
setTintList
(ColorStateList tint) Specifies tint color for this drawable as a color state list.Methods inherited from class icyllis.modernui.graphics.drawable.Drawable
applyTheme, canApplyTheme, clearMutated, copyBounds, copyBounds, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, invalidateSelf, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLayoutDirectionChanged, onLevelChange, scaleFromDensity, scaleFromDensity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintBlendMode, setVisible, unscheduleSelf
-
Field Details
-
KEYBOARD_ARROW_RIGHT
public static final int KEYBOARD_ARROW_RIGHT- See Also:
-
CHEVRON_RIGHT
public static final int CHEVRON_RIGHT- See Also:
-
KEYBOARD_ARROW_LEFT
public static final int KEYBOARD_ARROW_LEFT- See Also:
-
CHEVRON_LEFT
public static final int CHEVRON_LEFT- See Also:
-
KEYBOARD_ARROW_DOWN
public static final int KEYBOARD_ARROW_DOWN- See Also:
-
KEYBOARD_ARROW_UP
public static final int KEYBOARD_ARROW_UP- See Also:
-
CHECK
public static final int CHECK- See Also:
-
CHECK_SMALL
public static final int CHECK_SMALL- See Also:
-
CHECK_INDETERMINATE_SMALL
public static final int CHECK_INDETERMINATE_SMALL- See Also:
-
RADIO_SMALL
public static final int RADIO_SMALL- See Also:
-
SIZE
public static final float SIZE- See Also:
-
-
Constructor Details
-
BuiltinIconDrawable
-
BuiltinIconDrawable
-
-
Method Details
-
draw
Description copied from class:Drawable
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha). -
setTintList
Description copied from class:Drawable
Specifies tint color for this drawable as a color state list.A Drawable's drawing content will be blended together with its tint before it is drawn to the screen.
Note: Setting a color filter via
Drawable.setColorFilter(ColorFilter)
overrides tint.- Overrides:
setTintList
in classDrawable
- Parameters:
tint
- Color state list to use for tinting this drawable, ornull
to clear the tint- See Also:
-
onStateChange
Description copied from class:Drawable
Override this in your subclass to change appearance if you recognize the specified state.- Overrides:
onStateChange
in classDrawable
- Returns:
- Returns true if the state change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last state.
-
isStateful
public boolean isStateful()Description copied from class:Drawable
Indicates whether this drawable will change its appearance based on state. Clients can use this to determine whether it is necessary to calculate their state and call setState.- Overrides:
isStateful
in classDrawable
- Returns:
- True if this drawable changes its appearance based on state, false otherwise.
- See Also:
-
hasFocusStateSpecified
public boolean hasFocusStateSpecified()Description copied from class:Drawable
Indicates whether this drawable has at least one state spec explicitly specifying state_focused.Note: A View uses a
Drawable
instance as its background and it changes its appearance based on a state. On keyboard devices, it should specify its state_focused to make sure the user knows which view is holding the focus.- Overrides:
hasFocusStateSpecified
in classDrawable
- Returns:
true
if state_focused is specified for this drawable.
-
setAlpha
public void setAlpha(int alpha) Description copied from class:Drawable
Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque. -
getAlpha
public int getAlpha()Description copied from class:Drawable
Gets the current alpha value for the drawable. 0 means fully transparent, 255 means fully opaque. This method is implemented by Drawable subclasses and the value returned is specific to how that class treats alpha. The default return value is 255 if the class does not override this method to return a value specific to its use of alpha. -
setAutoMirrored
public void setAutoMirrored(boolean mirrored) Description copied from class:Drawable
Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left). SeeLayoutDirection
.- Overrides:
setAutoMirrored
in classDrawable
- Parameters:
mirrored
- Set to true if the Drawable should be mirrored, false if not.
-
isAutoMirrored
public boolean isAutoMirrored()Description copied from class:Drawable
Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left. SeeLayoutDirection
.- Overrides:
isAutoMirrored
in classDrawable
- Returns:
- boolean Returns true if this Drawable will be automatically mirrored.
-
getIntrinsicWidth
public int getIntrinsicWidth()Description copied from class:Drawable
Returns the drawable's intrinsic width.Intrinsic width is the width at which the drawable would like to be laid out, including any inherent padding. If the drawable has no intrinsic width, such as a solid color, this method returns -1.
- Overrides:
getIntrinsicWidth
in classDrawable
- Returns:
- the intrinsic width, or -1 if no intrinsic width
-
getIntrinsicHeight
public int getIntrinsicHeight()Description copied from class:Drawable
Returns the drawable's intrinsic height.Intrinsic height is the height at which the drawable would like to be laid out, including any inherent padding. If the drawable has no intrinsic height, such as a solid color, this method returns -1.
- Overrides:
getIntrinsicHeight
in classDrawable
- Returns:
- the intrinsic height, or -1 if no intrinsic height
-