WaveProgressView

class WaveProgressView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.Default_WaveProgressView_Style, defStyleRes: Int = R.style.BaseWaveProgressView) : ProgressView

WaveProgressView

Since

0.2.0

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.Default_WaveProgressView_Style, defStyleRes: Int = R.style.BaseWaveProgressView)

Properties

Link copied to clipboard
private val mBackground: Bitmap

Background for saving graph calculations with waves.

Link copied to clipboard
private val mBackgroundPaint: Paint
Link copied to clipboard
private var mHalfWaveWidth: Float

A quarter of the mWaveWidth.

Link copied to clipboard
private var mHeight: Int
Link copied to clipboard
Link copied to clipboard
private val mIsAutoBack: Boolean

Used to determine whether a default background is required (the default is a circular background).

Link copied to clipboard
open override var mProgressBackgroundColor: Int

The wave background color.

Link copied to clipboard
open override var mProgressColor: Int

The wave color.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The space width.

Link copied to clipboard

The stroke color.

Link copied to clipboard
private var mStrokePaint: Paint
Link copied to clipboard

The stroke width.

Link copied to clipboard
open override var mTextColor: Int

The color of the text.

Link copied to clipboard
private var mTextPaint: Paint
Link copied to clipboard
open override var mTextSize: Float

Ths size of the mText.

Link copied to clipboard
private var mUpdateInterval: Long

Interval time between every frame in milliseconds.

Link copied to clipboard
private val mWaveBitmapPaint: Paint
Link copied to clipboard
private var mWaveCount: Int

The count number of waves.

Link copied to clipboard
private var mWaveHeight: Float

The height of each wave.

Link copied to clipboard

The wave offset distance.

Link copied to clipboard
private var mWavePaint: Paint
Link copied to clipboard
private val mWavePath: Path
Link copied to clipboard
private val mWaveRectF: RectF
Link copied to clipboard
private var mWaveSpeed: Float

Offset per frame. By default, the value is mWaveWidth / 70.

Link copied to clipboard
private var mWaveWidth: Float

The width of the each wave.

Link copied to clipboard
private var mWidth: Int
Link copied to clipboard

Functions

Link copied to clipboard
private fun autoCreateBitmap(radius: Int): Bitmap

Create a circular Bimap with radius radius and color mProgressBackgroundColor.

Link copied to clipboard
private fun calWaveCount(width: Int, waveWidth: Float): Int

Calculate the number of waves.

Link copied to clipboard
private fun createWaveBitmap(width: Int, height: Int): Bitmap

Draw a wave bitmap.

Link copied to clipboard
protected open override fun onDraw(canvas: Canvas)
Link copied to clipboard
protected open override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Link copied to clipboard
fun setImage(image: Drawable?)

Set mImage. Click link to see the example.

fun setImage(@DrawableRes resid: Int)

Set mImage. Click link to see the example. If the resource is not exists, the mImage will be set to null.

Link copied to clipboard
fun setSpeed(@FloatRange(from = 0.0) speed: Float)

Set the mWaveSpeed of the wave.

Link copied to clipboard
fun setUpdateInterval(@IntRange(from = -1) interval: Long)

Set update interval time between every frame in milliseconds.

Link copied to clipboard
fun setWave(@FloatRange(from = 0.0) waveWidth: Float, @FloatRange(from = 0.0) waveHeight: Float)

Set the width and height of the wave.