BadgeView

class BadgeView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.Default_BadgeView_Style, @StyleRes defStyleRes: Int = R.style.BaseBadgeView) : View

Badge View.

Since

0.5.3

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.Default_BadgeView_Style, @StyleRes defStyleRes: Int = R.style.BaseBadgeView)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private val mBadgePaint: Paint
Link copied to clipboard
Link copied to clipboard
private val mBezierPaint: Paint
Link copied to clipboard
private val mBezierPath: Path
Link copied to clipboard
private var mBmpIndex: Int
Link copied to clipboard
private val mControlPoint: PointF
Link copied to clipboard
Link copied to clipboard
private var mExplosionBmp: List<Bitmap>
Link copied to clipboard
private val mExplosionRect: Rect
Link copied to clipboard
private val mFixedPoint: PointF
Link copied to clipboard
private var mFixedRadius: Float
Link copied to clipboard
private val mMinimumRadius: Float
Link copied to clipboard

When the coordinate of first touch is smaller than mMoveRadius + MIN_OFFSET_DISTANCE, it means you touched the starting red dot.

Link copied to clipboard
private var mMovePoint: PointF
Link copied to clipboard
Link copied to clipboard
private val mPointA: PointF
Link copied to clipboard
private val mPointB: PointF
Link copied to clipboard
private val mPointC: PointF
Link copied to clipboard
private val mPointD: PointF
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private val mTextPaint: Paint
Link copied to clipboard

Functions

Link copied to clipboard
private fun Canvas.drawBezier()

Draw a Bezier curve connecting circles centered at mMovePoint and mFixedPoint.

Link copied to clipboard

Get number string of mTextNumber.

Link copied to clipboard

Get minimum radius of the bubble.

Link copied to clipboard
private fun getTextBaseline(): Float

Get text baseline.

Link copied to clipboard
fun hideDot()

Hide dot. The setting will only take effect when the mode is BadgeMode.DOT.

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
open override fun onTouchEvent(event: MotionEvent): Boolean
Link copied to clipboard
open override fun performClick(): Boolean
Link copied to clipboard
private fun resetAnimation()
Link copied to clipboard
private fun resetPoint()
Link copied to clipboard
fun setBubbleRadius(@FloatRange(from = 0.0) bubbleRadius: Float)

The setting will only take effect when the mode is BadgeMode.BUBBLE.NUMBER or BadgeMode.BUBBLE.TEXT.

Link copied to clipboard

Set the text to be displayed in bubble.

Link copied to clipboard
fun setBubbleTextColor(colorInt: Int)

Set the color-int of text.

Link copied to clipboard
fun setBubbleTextMaxNum(@IntRange(from = 0) maxNumber: Int)

Set the max number to be displayed in bubble.

Link copied to clipboard
fun setBubbleTextNum(@IntRange(from = 0) number: Int)

Set the number to be displayed in bubble.

Link copied to clipboard

Set the text size of bubble in pixels.

Link copied to clipboard
fun setColor(@ColorInt colorInt: Int)

Set the color-int of the badge by colorInt.

Link copied to clipboard
fun setDotRadius(dotRadius: Float)

The setting will only take effect when the mode is BadgeMode.DOT.

Link copied to clipboard
fun setMode(mode: BadgeMode)

Set badge mode. Only useful when the current value of mBadgeMode is BadgeMode.UNSPECIFIED

Link copied to clipboard
fun showDot()

Show dot. The setting will only take effect when the mode is BadgeMode.DOT.

Link copied to clipboard
private fun startExplosionAnim()