inboxrecyclerview / me.saket.inboxrecyclerview / InboxRecyclerView

InboxRecyclerView

class InboxRecyclerView : ScrollSuppressibleRecyclerView, InternalPageCallbacks

A RecyclerView where items can expand and collapse to and from an ExpandablePageLayout.

Types

ExpandedItem

data class ExpandedItem : Parcelable

Details of the currently expanded item.

Constructors

<init>

InboxRecyclerView(context: Context, attrs: AttributeSet)

A RecyclerView where items can expand and collapse to and from an ExpandablePageLayout.

Properties

expandedItem

var expandedItem: ExpandedItem

Details about the currently expanded item.

itemExpandAnimator

var itemExpandAnimator: ItemExpandAnimator

Controls how InboxRecyclerView items are animated when the page is moving.

page

lateinit var page: ExpandablePageLayout

tintPainter

var tintPainter: TintPainter

Controls how items are dimmed when the page is expanding/collapsing.

Functions

canScrollProgrammatically

fun canScrollProgrammatically(): Boolean

collapse

fun collapse(): Unit

dispatchTouchEvent

fun dispatchTouchEvent(ev: MotionEvent?): Boolean

draw

fun draw(canvas: Canvas): Unit

expandFromTop

fun expandFromTop(immediate: Boolean = false): Unit

Expand from the top, pushing all items out of the window towards the bottom.

expandItem

fun expandItem(itemId: Long, immediate: Boolean = false): Unit

onDetachedFromWindow

fun onDetachedFromWindow(): Unit

onPageAboutToCollapse

fun onPageAboutToCollapse(): Unit

onPageAboutToExpand

fun onPageAboutToExpand(): Unit

onPageCollapsed

fun onPageCollapsed(): Unit

Page is no longer visible at this point.

onPageFullyCovered

fun onPageFullyCovered(): Unit

Called when this page has fully covered the list. This can happen in two situations:

onPagePull

fun onPagePull(deltaY: Float): Unit

Page is being pulled. Sync the scroll with the list.

onPageRelease

fun onPageRelease(collapseEligible: Boolean): Unit

Called when this page was released after being pulled.

onRestoreInstanceState

fun onRestoreInstanceState(state: Parcelable): Unit

onSaveInstanceState

fun onSaveInstanceState(): Parcelable

onSizeChanged

fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int): Unit

optimizeActivityBackgroundOverdraw

fun optimizeActivityBackgroundOverdraw(activity: Activity): Unit

Experimental: Reduce overdraw by 1 level by removing the Activity Window's background when the ExpandablePageLayout is expanded. No point in drawing it when it's not visible to the user.

setAdapter

fun setAdapter(adapter: Adapter<*>?): Unit

setExpandablePage

fun setExpandablePage(page: ExpandablePageLayout): Unit

Set the ExpandablePageLayout to be used with this list. The pull-to-collapse threshold is set to 85% of the standard toolbar height.

fun setExpandablePage(page: ExpandablePageLayout, collapseDistanceThreshold: Int): Unit

Set the ExpandablePageLayout to be used with this list.

swapAdapter

fun swapAdapter(adapter: Adapter<*>?, removeAndRecycleExistingViews: Boolean): Unit

Inherited Functions

scrollBy

open fun scrollBy(x: Int, y: Int): Unit

scrollTo

open fun scrollTo(x: Int, y: Int): Unit

scrollToPosition

open fun scrollToPosition(position: Int): Unit

smoothScrollBy

open fun smoothScrollBy(dx: Int, dy: Int): Unit

smoothScrollToPosition

open fun smoothScrollToPosition(position: Int): Unit

Extension Functions

executeOnMeasure

fun View.executeOnMeasure(listener: () -> Unit): Unit

Execute a runnable when a view's dimensions get measured and is laid out on the screen.

executeOnNextLayout

fun View.executeOnNextLayout(listener: () -> Unit): Unit

Execute a runnable when the next global layout happens for a View. Example usage includes waiting for a list to draw its children just after you have updated its adapter's data-set.

globalVisibleRect

fun View.globalVisibleRect(): RectF