API Reference
This page provides a detailed reference for the public API of the PulsatorLayout
class.
Class: pl.bclogic.pulsator4droid.library.PulsatorLayout
Extends android.widget.RelativeLayout
.
Public Constants
Constants used for setting the interpolator type with setInterpolator()
.
Constant | Value | Description |
---|---|---|
INFINITE |
0 | Value for setRepeat() to indicate infinite repetitions. |
INTERP_LINEAR |
0 | Linear interpolator (constant speed). |
INTERP_ACCELERATE |
1 | Accelerate interpolator (starts slow, then speeds up). |
INTERP_DECELERATE |
2 | Decelerate interpolator (starts fast, then slows down). |
INTERP_ACCELERATE_DECELERATE |
3 | Accelerate/Decelerate interpolator (starts and ends slow, but accelerates in the middle). |
Constructors
public PulsatorLayout(Context context)
public PulsatorLayout(Context context, AttributeSet attrs)
public PulsatorLayout(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
Animation Control
public synchronized void start()
Starts the pulse animation.
public synchronized void stop()
Stops the pulse animation.
public synchronized boolean isStarted()
Returns true
if the animation is currently running, false
otherwise.
Configuration
public int getCount()
Returns the current number of pulse waves.
public void setCount(int count)
Sets the number of pulse waves. Throws IllegalArgumentException
if count
is negative. This will reset the animation.
public int getDuration()
Returns the duration of a single pulse wave in milliseconds.
public void setDuration(int millis)
Sets the duration of a single pulse wave. Throws IllegalArgumentException
if millis
is negative. This will reset the animation.
public void setRepeat(int repeat)
Sets the number of times the animation should repeat. Use PulsatorLayout.INFINITE
for infinite repeats. This will reset the animation.
public int getColor()
Returns the current color of the pulse waves.
public void setColor(int color)
Sets the color of the pulse waves (e.g., Color.RED
or ContextCompat.getColor(context, R.color.my_color)
). This will reset the animation.
public int getInterpolator()
Returns the current interpolator type.
public void setInterpolator(int type)
Sets the interpolator type for the animation using one of the INTERP_*
constants. This will reset the animation.