MaskableFrameLayout

public class MaskableFrameLayout implements Shapeable


A FrameLayout than is able to mask itself and all children.

Summary

Public constructors

MaskableFrameLayout(Context context)
MaskableFrameLayout(Context context, AttributeSet attrs)
MaskableFrameLayout(
    Context context,
    AttributeSet attrs,
    int defStyleAttr
)

Public methods

void
RectF

Gets a RectF that this View is masked itself by.

float

This method is deprecated.

This is no longer used as CarouselLayoutManager calculates its own mask percentages.

ShapeAppearanceModel

Returns the ShapeAppearanceModel used for the shape definition.

boolean
onHoverEvent(MotionEvent event)
void
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
boolean
onInterceptTouchEvent(MotionEvent event)
boolean
onTouchEvent(MotionEvent event)
void
setMaskRectF(RectF maskRect)

Sets the RectF that this View will be masked by.

abstract void
setMaskXPercentage(float percentage)

This method is deprecated.

CarouselLayoutManager calculates its own mask percentages.

void
setMaskXPercentage(float percentage)

This method is deprecated.

This is no longer used as CarouselLayoutManager calculates its own mask percentages.

void
setOnHoverListener(OnHoverListener l)
void

Sets an OnMaskChangedListener.

void

Sets the ShapeAppearanceModel that defines the shape.

Protected methods

void
dispatchDraw(Canvas canvas)
void
void
void
onSizeChanged(int w, int h, int oldw, int oldh)

Public fields

maskXPercentage

public float maskXPercentage

shapeAppearanceModel

public ShapeAppearanceModel shapeAppearanceModel

Public constructors

MaskableFrameLayout

public MaskableFrameLayout(Context context)

MaskableFrameLayout

public MaskableFrameLayout(Context context, AttributeSet attrs)

MaskableFrameLayout

public MaskableFrameLayout(
    Context context,
    AttributeSet attrs,
    int defStyleAttr
)

Public methods

getFocusedRect

public void getFocusedRect(Rect r)

getMaskRectF

public RectF getMaskRectF()

Gets a RectF that this View is masked itself by.

getMaskXPercentage

public float getMaskXPercentage()

Gets the percentage by which this View is masked by along the x axis.

Returns
float

a float between 0 and 1 where 0 is fully unmasked and 1 is fully masked.

getShapeAppearanceModel

public ShapeAppearanceModel getShapeAppearanceModel()

Returns the ShapeAppearanceModel used for the shape definition.

This ShapeAppearanceModel can be modified to change the shape.

onHoverEvent

public boolean onHoverEvent(MotionEvent event)

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)

onInterceptTouchEvent

public boolean onInterceptTouchEvent(MotionEvent event)

onTouchEvent

public boolean onTouchEvent(MotionEvent event)

setMaskRectF

public void setMaskRectF(RectF maskRect)

Sets the RectF that this View will be masked by.

Parameters
RectF maskRect

a rect in the view's coordinates to mask by

setMaskXPercentage

public abstract void setMaskXPercentage(float percentage)

Set the percentage by which this View should mask itself along the x axis.

This method serves the same purpose as setMaskRectF but requires the implementing view to calculate the correct rect given the mask percentage.

Parameters
float percentage

0 when this view is fully unmasked. 1 when this view is fully masked.

setMaskXPercentage

public void setMaskXPercentage(float percentage)

Sets the percentage by which this View masks by along the x axis.

Parameters
float percentage

0 when this view is fully unmasked. 1 when this view is fully masked.

setOnHoverListener

public void setOnHoverListener(OnHoverListener l)

setOnMaskChangedListener

public void setOnMaskChangedListener(OnMaskChangedListener onMaskChangedListener)

Sets an OnMaskChangedListener.

Parameters
OnMaskChangedListener onMaskChangedListener

a listener to receive callbacks for changes in the mask or null to clear the listener.

setShapeAppearanceModel

public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel)

Sets the ShapeAppearanceModel that defines the shape.

Protected methods

dispatchDraw

protected void dispatchDraw(Canvas canvas)

onAttachedToWindow

protected void onAttachedToWindow()

onDetachedFromWindow

protected void onDetachedFromWindow()

onSizeChanged

protected void onSizeChanged(int w, int h, int oldw, int oldh)