Class ScaleDrawable
java.lang.Object
icyllis.modernui.graphics.drawable.Drawable
icyllis.modernui.graphics.drawable.DrawableWrapper
icyllis.modernui.graphics.drawable.ScaleDrawable
- All Implemented Interfaces:
Drawable.Callback
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.modernui.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionScaleDrawable(Drawable drawable, int gravity, float scaleWidth, float scaleHeight) Creates a new scale drawable with the specified gravity and scale properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidDraw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).protected voidonBoundsChange(Rect bounds) Override this in your subclass to change appearance if you vary based on the bounds.protected booleanonLevelChange(int level) Override this in your subclass to change appearance if you vary based on level.voidsetGravity(int gravity) voidsetScaleHeight(float scaleHeight) voidsetScaleWidth(float scaleWidth) Methods inherited from class icyllis.modernui.graphics.drawable.DrawableWrapper
clearMutated, getAlpha, getConstantState, getDrawable, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getOutline, getPadding, hasFocusStateSpecified, invalidateDrawable, isStateful, jumpToCurrentState, mutate, onLayoutDirectionChanged, onStateChange, scheduleDrawable, setAlpha, setDrawable, setHotspot, setHotspotBounds, setTintBlendMode, setTintList, setVisible, unscheduleDrawableMethods inherited from class icyllis.modernui.graphics.drawable.Drawable
applyTheme, canApplyTheme, copyBounds, copyBounds, getBounds, getCallback, getChangingConfigurations, getColorFilter, getCurrent, getDirtyBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getState, invalidateSelf, isAutoMirrored, isVisible, scaleFromDensity, scaleFromDensity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setLayoutDirection, setLevel, setState, setTint, unscheduleSelf
-
Constructor Details
-
ScaleDrawable
Creates a new scale drawable with the specified gravity and scale properties.- Parameters:
drawable- the drawable to scalegravity- gravity constant (seeGravityused to position the scaled drawable within the parent containerscaleWidth- width scaling factor [0...1] to use then the level is at the maximum value, or -1 to not scale widthscaleHeight- height scaling factor [0...1] to use then the level is at the maximum value, or -1 to not scale height
-
-
Method Details
-
setGravity
public void setGravity(int gravity) -
setScaleWidth
public void setScaleWidth(float scaleWidth) -
setScaleHeight
public void setScaleHeight(float scaleHeight) -
draw
Description copied from class:DrawableDraw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).- Overrides:
drawin classDrawableWrapper- Parameters:
canvas- The canvas to draw into
-
onLevelChange
protected boolean onLevelChange(int level) Description copied from class:DrawableOverride this in your subclass to change appearance if you vary based on level.- Overrides:
onLevelChangein classDrawableWrapper- Returns:
- Returns true if the level 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 level.
-
onBoundsChange
Description copied from class:DrawableOverride this in your subclass to change appearance if you vary based on the bounds.- Overrides:
onBoundsChangein classDrawableWrapper
-