class PowerSpinnerView : AppCompatTextView, LifecycleObserver
A lightweight dropdown spinner, fully customizable with arrow and animations.
Builder |
Builder class for creating PowerSpinnerView. class Builder |
<init> |
PowerSpinnerView(context: Context) PowerSpinnerView(context: Context, attributeSet: AttributeSet) PowerSpinnerView(context: Context, attributeSet: AttributeSet, defStyle: Int) |
arrowAnimate |
The arrow will be animated or not when show and dismiss the spinner. var arrowAnimate: Boolean |
arrowAnimationDuration |
A duration of the arrow animation when show and dismiss. var arrowAnimationDuration: Long |
arrowDrawable |
A drawable of the arrow. var arrowDrawable: Drawable? |
arrowGravity |
A gravity of the arrow. var arrowGravity: SpinnerGravity |
arrowPadding |
A padding of the arrow. var arrowPadding: Int |
arrowResource |
A drawable resource of the arrow. var arrowResource: Int |
arrowTint |
A tint color of the arrow. var arrowTint: Int |
debounceDuration |
A duration of the debounce for showOrDismiss. var debounceDuration: Long |
dismissWhenNotifiedItemSelected |
The spinner popup will be dismissed when got notified an item is selected. var dismissWhenNotifiedItemSelected: Boolean |
dividerColor |
A color of the divider. var dividerColor: Int |
dividerSize |
A width size of the divider. var dividerSize: Int |
isShowing |
Spinner is showing or not. var isShowing: Boolean |
lifecycleOwner |
A lifecycle owner for observing the lifecycle owner's lifecycle. It is recommended that this field be should be set for avoiding memory leak of the popup window. Avoid Memory leak var lifecycleOwner: LifecycleOwner? |
preferenceName |
A preferences name of the spinner. var preferenceName: String? |
selectedIndex |
An index of the selected item. var selectedIndex: Int |
showArrow |
The arrow will be shown or not on the popup. var showArrow: Boolean |
showDivider |
A divider between items will be shown or not. var showDivider: Boolean |
spinnerOutsideTouchListener |
Interface definition for a callback to be invoked when touched on outside of the spinner popup. var spinnerOutsideTouchListener: OnSpinnerOutsideTouchListener? |
spinnerPopupAnimation |
A collection of the spinner popup animation when show and dismiss. var spinnerPopupAnimation: SpinnerAnimation |
spinnerPopupAnimationStyle |
A style resource for the popup animation when show and dismiss. var spinnerPopupAnimationStyle: Int |
spinnerPopupBackgroundColor |
A background color of the spinner popup. var spinnerPopupBackgroundColor: Int |
spinnerPopupElevation |
A elevation of the spinner popup. var spinnerPopupElevation: Int |
spinnerPopupHeight |
A height size of the spinner popup. var spinnerPopupHeight: Int |
spinnerPopupWidth |
A width size of the spinner popup. var spinnerPopupWidth: Int |
clearSelectedItem |
clears a selected item. fun clearSelectedItem(): Unit |
dismiss |
dismiss the spinner popup menu. fun dismiss(): Unit |
getSpinnerAdapter |
gets an adapter of the PowerSpinnerView. fun <T> getSpinnerAdapter(): PowerSpinnerInterface<T> |
getSpinnerRecyclerView |
gets the spinner popup's recyclerView. fun getSpinnerRecyclerView(): RecyclerView |
notifyItemSelected |
notifies to PowerSpinnerView of changed information from PowerSpinnerInterface. fun notifyItemSelected(index: Int, changedText: CharSequence): Unit |
onDestroy |
dismiss automatically when lifecycle owner is destroyed. fun onDestroy(): Unit |
onFinishInflate |
fun onFinishInflate(): Unit |
selectItemByIndex |
select an item by index. fun selectItemByIndex(index: Int): Unit |
setItems |
sets an item list for setting items of the adapter. fun <T> setItems(itemList: List<T>): Unit
sets a string array resource for setting items of the adapter. This function only works for the DefaultSpinnerAdapter. fun setItems(resource: Int): Unit |
setOnSpinnerItemSelectedListener |
sets a OnSpinnerItemSelectedListener to the default adapter. fun <T> setOnSpinnerItemSelectedListener(onSpinnerItemSelectedListener: OnSpinnerItemSelectedListener<T>): Unit
sets a OnSpinnerItemSelectedListener to the popup using lambda. fun <T> setOnSpinnerItemSelectedListener(block: (position: Int, item: T) -> Unit): Unit |
setOnSpinnerOutsideTouchListener |
sets a OnSpinnerOutsideTouchListener to the popup using lambda. fun setOnSpinnerOutsideTouchListener(unit: (View, MotionEvent) -> Unit): Unit |
setSpinnerAdapter |
sets an adapter of the PowerSpinnerView. fun <T> setSpinnerAdapter(powerSpinnerInterface: PowerSpinnerInterface<T>): Unit |
show |
shows the spinner popup menu to the center. fun show(): Unit |
showOrDismiss |
If the popup is not showing, shows the spinner popup menu to the center. If the popup is already showing, dismiss the spinner popup menu. fun showOrDismiss(): Unit |