public class Inset extends AbstractSpecLayerGroup<Inset>
Modifier and Type | Class and Description |
---|---|
static class |
Inset.Factory
|
static interface |
Inset.Mode
Type definition for inset group type
|
Modifier and Type | Field and Description |
---|---|
protected int |
mBottom |
protected int |
mHeight |
protected android.graphics.Rect |
mInsetRect |
protected boolean |
mIsBottomPercent |
protected boolean |
mIsBottomSet |
protected boolean |
mIsHeightPercent |
protected boolean |
mIsHeightSet |
protected boolean |
mIsLeftPercent |
protected boolean |
mIsLeftSet |
protected boolean |
mIsRightPercent |
protected boolean |
mIsRightSet |
protected boolean |
mIsTopPercent |
protected boolean |
mIsTopSet |
protected boolean |
mIsWidthPercent |
protected boolean |
mIsWidthSet |
protected int |
mLeft |
protected int |
mMode |
static int |
MODE_CLIP_ONLY
Clip the group according to inset rect but keep the coordinates.
|
static int |
MODE_DEFAULT
Inset the bounds and clip the overlay.
|
static int |
MODE_NO_CLIP
Inset the bounds but don't clip drawing to the overlay.
|
protected int |
mRight |
protected int |
mTop |
protected int |
mWidth |
static boolean |
UNITS_PERCENT
Dimension specified in percent of container
|
static boolean |
UNITS_PX
Dimension specified in pixels
|
ESTIMATED_AVG_LAYERS, mLayers
Constructor and Description |
---|
Inset()
Create a layer group that clips and/or insets its child layers
|
Inset(int initialCapacity)
Create a layer group that clips and/or insets its child layers
|
Modifier and Type | Method and Description |
---|---|
void |
draw(android.graphics.Canvas canvas,
android.graphics.Rect drawableBounds)
Draw itself to the provided canvas within provided bounds according to internal configuration (if any)
|
protected void |
recalculateInsetRect(android.graphics.Rect outerBounds)
Update the inset bounds based on provided outer bounds and this layer's state
|
Inset |
setBottom(int value,
boolean isPercent)
Set bottom inset
|
Inset |
setHeight(int value,
boolean isPercent)
Set height.
|
Inset |
setLeft(int value,
boolean isPercent)
Set left inset
|
Inset |
setMode(int mode)
Set inset mode — whether the group should also clip the children, translate the coordinates, or both
|
Inset |
setRight(int value,
boolean isPercent)
Set right inset
|
Inset |
setTop(int value,
boolean isPercent)
Set top inset
|
Inset |
setWidth(int value,
boolean isPercent)
Set width.
|
addLayer, size
public static final int MODE_DEFAULT
public static final int MODE_NO_CLIP
public static final int MODE_CLIP_ONLY
public static final boolean UNITS_PX
public static final boolean UNITS_PERCENT
protected int mMode
protected boolean mIsLeftPercent
protected boolean mIsTopPercent
protected boolean mIsRightPercent
protected boolean mIsBottomPercent
protected int mLeft
protected int mTop
protected int mRight
protected int mBottom
protected boolean mIsWidthPercent
protected boolean mIsHeightPercent
protected int mWidth
protected int mHeight
protected boolean mIsLeftSet
protected boolean mIsRightSet
protected boolean mIsTopSet
protected boolean mIsBottomSet
protected boolean mIsWidthSet
protected boolean mIsHeightSet
protected android.graphics.Rect mInsetRect
public Inset()
public Inset(int initialCapacity)
initialCapacity
- anticipated number of child layerspublic Inset setMode(int mode)
mode
- one of MODE_NO_CLIP
, MODE_CLIP_ONLY
, or MODE_DEFAULT
MODE_DEFAULT
,
MODE_NO_CLIP
,
MODE_CLIP_ONLY
public Inset setTop(int value, boolean isPercent)
value
- pixels or percentisPercent
- true
if value is in percent, false
if in pixelspublic Inset setBottom(int value, boolean isPercent)
value
- pixels or percentisPercent
- true
if value is in percent, false
if in pixelspublic Inset setLeft(int value, boolean isPercent)
value
- pixels or percentisPercent
- true
if value is in percent, false
if in pixelspublic Inset setRight(int value, boolean isPercent)
value
- pixels or percentisPercent
- true
if value is in percent, false
if in pixelspublic Inset setWidth(int value, boolean isPercent)
value
- pixels or percentisPercent
- true
if value is in percent, false
if in pixelspublic Inset setHeight(int value, boolean isPercent)
value
- pixels or percentisPercent
- true
if value is in percent, false
if in pixelspublic void draw(android.graphics.Canvas canvas, android.graphics.Rect drawableBounds)
RhythmSpecLayer
draw
in interface RhythmSpecLayer
draw
in class AbstractSpecLayerGroup<Inset>
canvas
- Canvas for the layer to draw itself todrawableBounds
- Bounds where this layer should draw itself. Since these are the bounds of a RhythmDrawable
connected to the view, they are usually the same as the view’s bounds, so
you can use this parameter to get the view’s dimensions should you need them.protected void recalculateInsetRect(android.graphics.Rect outerBounds)
outerBounds
- Outer bounds provided to this inset layer to modify