ArcLayout.Widget

Added in 1.2.0

interface ArcLayout.Widget

Known direct subclasses
CurvedTextView

CurvedTextView is a component allowing developers to easily write curved text following the curvature of the largest circle that can be inscribed in the view.


Interface for a widget which knows it is being rendered inside an arc, and will draw itself accordingly. Any widget implementing this interface will receive the full-sized canvas, pre-rotated, in its draw call.

Summary

Public functions

Unit

Check whether the widget contains invalid attributes as a child of ArcLayout, throwing a Exception if something is wrong.

@FloatRange(from = 0.0, to = 360.0, toInclusive = true) Float

Returns the sweep angle that this widget is drawn with.

@Px Int

Returns the thickness of this widget inside the arc.

Boolean

Return true when the given point is in the clickable area of the child widget.

Unit
setSweepAngleDegrees(
    sweepAngleDegrees: @FloatRange(from = 0.0, to = 360.0, toInclusive = true) Float
)

Set the sweep angle that this widget is drawn with.

Public functions

checkInvalidAttributeAsChild

Added in 1.2.0
fun checkInvalidAttributeAsChild(): Unit

Check whether the widget contains invalid attributes as a child of ArcLayout, throwing a Exception if something is wrong. This is important for widgets that can be both standalone or used inside an ArcLayout, some parameters used when the widget is standalone doesn't make sense when the widget is inside an ArcLayout.

getSweepAngleDegrees

Added in 1.2.0
fun getSweepAngleDegrees(): @FloatRange(from = 0.0, to = 360.0, toInclusive = true) Float

Returns the sweep angle that this widget is drawn with.

getThickness

Added in 1.2.0
fun getThickness(): @Px Int

Returns the thickness of this widget inside the arc.

isPointInsideClickArea

Added in 1.2.0
fun isPointInsideClickArea(x: Float, y: Float): Boolean

Return true when the given point is in the clickable area of the child widget. In particular, the coordinates should be considered as if the child was drawn centered at the default angle (12 o clock).

setSweepAngleDegrees

Added in 1.3.0
fun setSweepAngleDegrees(
    sweepAngleDegrees: @FloatRange(from = 0.0, to = 360.0, toInclusive = true) Float
): Unit

Set the sweep angle that this widget is drawn with. This is only called during layout, and only if the mWeight is non-zero. Note your widget will need to handle alignment.