Anko-ExpandableTextView

An expandable Android TextView written in Kotlin

View the Project on GitHub

expandable-textview / tm.charlie.expandabletextview / ExpandableTextView

ExpandableTextView

open class ExpandableTextView : AppCompatTextView

Types

SavedState class SavedState : BaseSavedState
Protected class that is being used to save and restore ExpandableTextView’s state on configuration change.
State enum class State
Enum representing current state of the ExpandableTextView.

Constructors

<init> ExpandableTextView(context: Context)
ExpandableTextView(context: Context, attrs: AttributeSet?)
ExpandableTextView(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Properties

animationDuration var animationDuration: Int
Duration of expand/collapse animation in milliseconds. 300 by default.
collapseInterpolator var collapseInterpolator: TimeInterpolator
Interpolator applied to collapse animation. AccelerateDecelerateInterpolator by default
collapsedHeight var collapsedHeight: Int
collapsedLines var collapsedLines: Int
Maximum number of lines in collapsed state. Integer.MAX_VALUE by default.
expandInterpolator var expandInterpolator: TimeInterpolator
Interpolator applied to expand animation. AccelerateDecelerateInterpolator by default.
expandedHeight var expandedHeight: Int
expandedLines var expandedLines: Int
Maximum number of lines in the expanded state. Integer.MAX_VALUE by default.
layoutHeight var layoutHeight: Int
onStateChangeListener var onStateChangeListener: ExpandableTextView.(oldState: State, newState: State) -> Unit
Protected listener that is being called when this ExpandableTextView changes its state. Use public onStateChange to set the listener.
state var state: State
Current State of this ExpandableTextView. Read-only property. Static by default.

Functions

collapse fun collapse(withAnimation: Boolean = true, forceCollapse: Boolean = false): Boolean
Collapses this ExpandableTextView if its state is Expanded.
expand fun expand(withAnimation: Boolean = true, forceExpand: Boolean = false): Boolean
Expands this ExpandableTextView if its state is Collapsed.
initAttrs fun initAttrs(attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0): Unit
onRestoreInstanceState open fun onRestoreInstanceState(state: Parcelable): Unit
onSaveInstanceState open fun onSaveInstanceState(): Parcelable
onSizeChanged open fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int): Unit
onStateChange fun onStateChange(func: ExpandableTextView.(oldState: State, newState: State) -> Unit): Unit
Listener which is being called when ExpandableTextView changes its state.
onTextChanged open fun onTextChanged(text: CharSequence?, start: Int, lengthBefore: Int, lengthAfter: Int): Unit
setEllipsize open fun ~~setEllipsize~~(where: TruncateAt?): Unit
setMaxLines open fun ~~setMaxLines~~(maxLines: Int): Unit
toggle fun toggle(withAnimation: Boolean = true): Boolean
Expands this ExpandableTextView if the state is Collapsed, collapses if the state is Expanded and does nothing otherwise.
updateState fun updateState(): Unit