Class RectanglePromptFocal
- java.lang.Object
-
- uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal
-
- uk.co.samuelwall.materialtaptargetprompt.extras.focals.RectanglePromptFocal
-
public class RectanglePromptFocal extends PromptFocal
Prompt focal implementation to draw the focal as a rectangle.
-
-
Field Summary
-
Fields inherited from class uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal
mBaseRippleAlpha, mDrawRipple
-
-
Constructor Summary
Constructors Constructor Description RectanglePromptFocal()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(float x, float y)voiddraw(android.graphics.Canvas canvas)android.graphics.RectFgetBounds()Get the focal bounds at scale 1.android.graphics.PathgetPath()Get the focal path to be drawn.voidprepare(PromptOptions options, float targetX, float targetY)Setup the focal ready for rendering when targeting a point on the screen, called prior to first render.voidprepare(PromptOptions options, android.view.View target, int[] promptViewPosition)Setup the focal ready for rendering when targeting a view, called prior to first render.voidsetColour(int colour)Set the focal colour.RectanglePromptFocalsetCornerRadius(float rx, float ry)Set the radius for the rectangle corners.RectanglePromptFocalsetSize(android.graphics.PointF size)Sets the focal to a fixed size.RectanglePromptFocalsetTargetPadding(float padding)Set the padding between the target bounds and the rectangle edge.voidupdate(PromptOptions options, float revealModifier, float alphaModifier)voidupdateRipple(float revealModifier, float alphaModifier)Update the ripple around the focal.-
Methods inherited from class uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal
calculateAngleEdgePoint, setDrawRipple, setRippleAlpha
-
-
-
-
Method Detail
-
setCornerRadius
@NonNull public RectanglePromptFocal setCornerRadius(float rx, float ry)
Set the radius for the rectangle corners.- Parameters:
rx- The x-radius of the oval used to round the cornersry- The y-radius of the oval used to round the corners- Returns:
- This prompt focal
-
setTargetPadding
@NonNull public RectanglePromptFocal setTargetPadding(@Dimension float padding)
Set the padding between the target bounds and the rectangle edge.- Parameters:
padding- The distance from the target edge to the rectangle edge.- Returns:
- This prompt focal.
-
setSize
@NonNull public RectanglePromptFocal setSize(@Nullable android.graphics.PointF size)
Sets the focal to a fixed size. Set as null to change it back to dynamic.- Parameters:
size- The fixed focal size or null to change back to the default dynamic size.- Returns:
- This prompt focal
-
getBounds
@NonNull public android.graphics.RectF getBounds()
Description copied from class:PromptFocalGet the focal bounds at scale 1.- Specified by:
getBoundsin classPromptFocal- Returns:
- The screen area that the focal is drawn in at scale 1.
-
getPath
@NonNull public android.graphics.Path getPath()
Description copied from class:PromptFocalGet the focal path to be drawn. Override this to support a transparent focal colour.- Overrides:
getPathin classPromptFocal- Returns:
- The path used to draw the focal
-
setColour
public void setColour(int colour)
Description copied from class:PromptFocalSet the focal colour.- Specified by:
setColourin classPromptFocal- Parameters:
colour- Int colour.
-
prepare
public void prepare(@NonNull PromptOptions options, @NonNull android.view.View target, int[] promptViewPosition)Description copied from class:PromptFocalSetup the focal ready for rendering when targeting a view, called prior to first render.- Specified by:
preparein classPromptFocal- Parameters:
options- The option that the prompt was built from.target- The prompt target view.promptViewPosition- The prompt views screen position.
-
prepare
public void prepare(@NonNull PromptOptions options, float targetX, float targetY)Description copied from class:PromptFocalSetup the focal ready for rendering when targeting a point on the screen, called prior to first render.- Specified by:
preparein classPromptFocal- Parameters:
options- The option that the prompt was built from.targetX- The target screen x position.targetY- The target screen y position.
-
update
public void update(@NonNull PromptOptions options, float revealModifier, float alphaModifier)
-
updateRipple
public void updateRipple(float revealModifier, float alphaModifier)Description copied from class:PromptFocalUpdate the ripple around the focal.- Specified by:
updateRipplein classPromptFocal- Parameters:
revealModifier- The amount to scale the ripple by where a 1 value is the same size as the focal.alphaModifier- The amount to modify the ripple alpha by.
-
draw
public void draw(@NonNull android.graphics.Canvas canvas)
-
contains
public boolean contains(float x, float y)
-
-