java.lang.Object
uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal
uk.co.samuelwall.materialtaptargetprompt.extras.focals.CirclePromptFocal

public class CirclePromptFocal
extends PromptFocal
Prompt focal implementation to draw the focal as a circle.
  • Field Summary

    Fields inherited from class uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal

    mBaseRippleAlpha, mDrawRipple
  • Constructor Summary

    Constructors
    Constructor Description
    CirclePromptFocal()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    android.graphics.PointF calculateAngleEdgePoint​(float angle, float padding)
    Calculate the point on the focal edge based on the angle.
    boolean contains​(float x, float y)  
    void draw​(android.graphics.Canvas canvas)  
    android.graphics.RectF getBounds()
    Get the focal bounds at scale 1.
    android.graphics.Path getPath()
    Get the focal path to be drawn.
    void prepare​(PromptOptions options, float targetX, float targetY)
    Setup the focal ready for rendering when targeting a point on the screen, called prior to first render.
    void prepare​(PromptOptions options, android.view.View target, int[] promptViewPosition)
    Setup the focal ready for rendering when targeting a view, called prior to first render.
    void setColour​(int colour)
    Set the focal colour.
    CirclePromptFocal setRadius​(float radius)
    Set the focal radius.
    void update​(PromptOptions options, float revealModifier, float alphaModifier)  
    void updateRipple​(float revealModifier, float alphaModifier)
    Update the ripple around the focal.

    Methods inherited from class uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal

    setDrawRipple, setRippleAlpha

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CirclePromptFocal

      public CirclePromptFocal()
      Constructor.
  • Method Details

    • setRadius

      @NonNull public CirclePromptFocal setRadius​(float radius)
      Set the focal radius.
      Parameters:
      radius - The radius for the circle to be drawn.
      Returns:
      This prompt focal
    • getBounds

      @NonNull public android.graphics.RectF getBounds()
      Description copied from class: PromptFocal
      Get the focal bounds at scale 1.
      Specified by:
      getBounds in class PromptFocal
      Returns:
      The screen area that the focal is drawn in at scale 1.
    • getPath

      @NonNull public android.graphics.Path getPath()
      Description copied from class: PromptFocal
      Get the focal path to be drawn. Override this to support a transparent focal colour.
      Overrides:
      getPath in class PromptFocal
      Returns:
      The path used to draw the focal
    • calculateAngleEdgePoint

      @NonNull public android.graphics.PointF calculateAngleEdgePoint​(float angle, float padding)
      Description copied from class: PromptFocal
      Calculate the point on the focal edge based on the angle. This is called after PromptFocal.prepare(PromptOptions, float, float) or PromptFocal.prepare(PromptOptions, View, int[]). Base implementation assumes that focal is a rectangle.
      Overrides:
      calculateAngleEdgePoint in class PromptFocal
      Parameters:
      angle - The angle with 0 based on the right.
      padding - The padding added to the focal bounds.
      Returns:
      The calculated point
    • setColour

      public void setColour​(int colour)
      Description copied from class: PromptFocal
      Set the focal colour.
      Specified by:
      setColour in class PromptFocal
      Parameters:
      colour - Int colour.
    • prepare

      public void prepare​(@NonNull PromptOptions options, @NonNull android.view.View target, int[] promptViewPosition)
      Description copied from class: PromptFocal
      Setup the focal ready for rendering when targeting a view, called prior to first render.
      Specified by:
      prepare in class PromptFocal
      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: PromptFocal
      Setup the focal ready for rendering when targeting a point on the screen, called prior to first render.
      Specified by:
      prepare in class PromptFocal
      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: PromptFocal
      Update the ripple around the focal.
      Specified by:
      updateRipple in class PromptFocal
      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)