DrawerArrowDrawable

class DrawerArrowDrawable : Drawable


A drawable that can draw a "Drawer hamburger" menu or an arrow and animate between them.

The progress between the two states is controlled via setProgress.

Summary

Constants

const Int

Direction to make the arrow point to the end.

const Int

Direction to make the arrow point towards the left.

const Int

Direction to make the arrow point towards the right.

const Int

Direction to make the arrow point towards the start.

Public constructors

Public functions

Unit
draw(canvas: Canvas)
Float

Returns the length of the arrow head (from tip to edge, perpendicular to the shaft), in pixels.

Float

Returns the arrow shaft length in pixels.

Float

The length of the bars when they are parallel to each other.

Float

Returns the thickness (stroke width) of the bars.

@ColorInt Int

Returns the color of the drawable.

Int

Returns the arrow direction.

Float

Returns the max gap between the bars when they are parallel to each other.

Int
Int
Int

This function is deprecated.

Paint!

Returns the paint instance used for all drawing.

@FloatRange(from = 0.0, to = 1.0) Float

Returns the current progress of the arrow.

Boolean

Returns whether the bars should rotate or not during the transition.

Unit
setAlpha(alpha: Int)
Unit

Sets the length of the arrow head (from tip to edge, perpendicular to the shaft).

Unit

Sets the arrow shaft length.

Unit

Sets the length of the bars when they are parallel to each other.

Unit

Sets the thickness (stroke size) for the bars.

Unit

Sets the color of the drawable.

Unit
setColorFilter(colorFilter: ColorFilter!)
Unit
setDirection(direction: Int)

Set the arrow direction.

Unit

Sets the max gap between the bars when they are parallel to each other.

Unit
setProgress(progress: @FloatRange(from = 0.0, to = 1.0) Float)

Set the progress of the arrow.

Unit

Returns whether the bars should rotate or not during the transition.

Unit
setVerticalMirror(verticalMirror: Boolean)

If set, canvas is flipped when progress reached to end and going back to start.

Inherited functions

From android.graphics.drawable.Drawable
Unit
Boolean
Unit
Rect!
Unit
copyBounds(bounds: Rect!)
java-static Drawable!
createFromPath(pathName: String!)
java-static Drawable!
createFromResourceStream(
    res: Resources!,
    value: TypedValue!,
    is: InputStream!,
    srcName: String!
)
java-static Drawable!
createFromStream(is: InputStream!, srcName: String!)
java-static Drawable!
java-static Drawable!
createFromXmlInner(
    r: Resources!,
    parser: XmlPullParser!,
    attrs: AttributeSet!
)
Int
Rect!
Drawable.Callback!
Int
ColorFilter!
Drawable.ConstantState!
Drawable!
Rect!
Unit
Int
Int
Int
Int
Insets!
Unit
getOutline(outline: Outline!)
Boolean
getPadding(padding: Rect!)
IntArray<Int>!
Region!
Boolean
Unit
inflate(r: Resources!, parser: XmlPullParser!, attrs: AttributeSet!)
Unit
Boolean
Boolean
Boolean
Boolean
Boolean
Unit
Drawable!
Unit
onBoundsChange(bounds: Rect!)
Boolean
onLayoutDirectionChanged(layoutDirection: Int)
Boolean
Boolean
java-static Int
resolveOpacity(op1: Int, op2: Int)
Unit
scheduleSelf(what: Runnable!, when: Long)
Unit
Unit
setBounds(left: Int, top: Int, right: Int, bottom: Int)
Unit
Unit
Unit
setDither(dither: Boolean)

This function is deprecated.

Unit
Unit
Unit
setHotspotBounds(left: Int, top: Int, right: Int, bottom: Int)
Boolean
setLayoutDirection(layoutDirection: Int)
Boolean
setLevel(level: Int)
Boolean
setState(stateSet: IntArray!)
Unit
setTint(tintColor: Int)
Unit
Unit
Unit
Boolean
setVisible(visible: Boolean, restart: Boolean)
Unit

Constants

ARROW_DIRECTION_END

Added in 1.1.0
const val ARROW_DIRECTION_END = 3: Int

Direction to make the arrow point to the end.

When used in a view with a RTL layout direction, this is the same as ARROW_DIRECTION_LEFT, otherwise it is the same as ARROW_DIRECTION_RIGHT.

ARROW_DIRECTION_LEFT

Added in 1.1.0
const val ARROW_DIRECTION_LEFT = 0: Int

Direction to make the arrow point towards the left.

ARROW_DIRECTION_RIGHT

Added in 1.1.0
const val ARROW_DIRECTION_RIGHT = 1: Int

Direction to make the arrow point towards the right.

ARROW_DIRECTION_START

Added in 1.1.0
const val ARROW_DIRECTION_START = 2: Int

Direction to make the arrow point towards the start.

When used in a view with a RTL layout direction, this is the same as ARROW_DIRECTION_RIGHT, otherwise it is the same as ARROW_DIRECTION_LEFT.

Public constructors

DrawerArrowDrawable

Added in 1.1.0
DrawerArrowDrawable(context: Context!)
Parameters
context: Context!

used to get the configuration for the drawable from

Public functions

draw

Added in 1.1.0
fun draw(canvas: Canvas): Unit

getArrowHeadLength

Added in 1.1.0
fun getArrowHeadLength(): Float

Returns the length of the arrow head (from tip to edge, perpendicular to the shaft), in pixels.

getArrowShaftLength

Added in 1.1.0
fun getArrowShaftLength(): Float

Returns the arrow shaft length in pixels.

getBarLength

Added in 1.1.0
fun getBarLength(): Float

The length of the bars when they are parallel to each other.

getBarThickness

Added in 1.1.0
fun getBarThickness(): Float

Returns the thickness (stroke width) of the bars.

getColor

Added in 1.1.0
fun getColor(): @ColorInt Int

Returns the color of the drawable.

getDirection

Added in 1.1.0
fun getDirection(): Int

Returns the arrow direction.

getGapSize

Added in 1.1.0
fun getGapSize(): Float

Returns the max gap between the bars when they are parallel to each other.

See also
getGapSize

getIntrinsicHeight

fun getIntrinsicHeight(): Int

getIntrinsicWidth

fun getIntrinsicWidth(): Int

getOpacity

Added in 1.1.0
fun getOpacity(): Int

getPaint

Added in 1.1.0
fun getPaint(): Paint!

Returns the paint instance used for all drawing.

getProgress

Added in 1.1.0
fun getProgress(): @FloatRange(from = 0.0, to = 1.0) Float

Returns the current progress of the arrow.

isSpinEnabled

Added in 1.1.0
fun isSpinEnabled(): Boolean

Returns whether the bars should rotate or not during the transition.

See also
setSpinEnabled

setAlpha

Added in 1.1.0
fun setAlpha(alpha: Int): Unit

setArrowHeadLength

Added in 1.1.0
fun setArrowHeadLength(length: Float): Unit

Sets the length of the arrow head (from tip to edge, perpendicular to the shaft).

Parameters
length: Float

the length in pixels

setArrowShaftLength

Added in 1.1.0
fun setArrowShaftLength(length: Float): Unit

Sets the arrow shaft length.

Parameters
length: Float

the length in pixels

setBarLength

Added in 1.1.0
fun setBarLength(length: Float): Unit

Sets the length of the bars when they are parallel to each other.

Parameters
length: Float

the length in pixels

setBarThickness

Added in 1.1.0
fun setBarThickness(width: Float): Unit

Sets the thickness (stroke size) for the bars.

Parameters
width: Float

stroke width in pixels

setColor

Added in 1.1.0
fun setColor(color: @ColorInt Int): Unit

Sets the color of the drawable.

setColorFilter

Added in 1.1.0
fun setColorFilter(colorFilter: ColorFilter!): Unit

setDirection

Added in 1.1.0
fun setDirection(direction: Int): Unit

Set the arrow direction.

setGapSize

Added in 1.1.0
fun setGapSize(gap: Float): Unit

Sets the max gap between the bars when they are parallel to each other.

Parameters
gap: Float

the gap in pixels

See also
getGapSize

setProgress

Added in 1.1.0
fun setProgress(progress: @FloatRange(from = 0.0, to = 1.0) Float): Unit

Set the progress of the arrow.

A value of 0.0 indicates that the arrow should be drawn in its starting position. A value of 1.0 indicates that the arrow should be drawn in its ending position.

setSpinEnabled

Added in 1.1.0
fun setSpinEnabled(enabled: Boolean): Unit

Returns whether the bars should rotate or not during the transition.

Parameters
enabled: Boolean

true if the bars should rotate.

See also
isSpinEnabled

setVerticalMirror

Added in 1.1.0
fun setVerticalMirror(verticalMirror: Boolean): Unit

If set, canvas is flipped when progress reached to end and going back to start.