HeaderFooterRcvAdapter

RecyclerView.Adapter with header, content, and footer section support.

header, content, footer 섹션을 지원하는 RecyclerView.Adapter입니다.

Features:
주요 기능:

  • Header and footer CRUD with precise notify calls.

  • header와 footer CRUD를 정확한 notify 호출과 함께 처리합니다.

  • Resolve adapter position into section type and section position.

  • adapter 위치를 섹션 타입과 섹션 위치로 해석합니다.

  • Map click callbacks from adapter position to content position.

  • 클릭 콜백을 adapter 위치에서 content 위치로 매핑합니다.

  • Per-section bind hooks for header, content, and footer.

  • header, content, footer별 바인딩 훅을 제공합니다.

  • Per-section view type hooks for header, content, and footer.

  • header, content, footer별 viewType 훅을 제공합니다.

Data store:
데이터 저장소:

  • Backed by HeaderFooterAdapterData.

  • HeaderFooterAdapterData가 section 데이터를 관리합니다.

Parameters

ITEM

Item type shared across all sections.

모든 섹션에서 공통으로 사용하는 아이템 타입입니다.

VH

ViewHolder type used by this adapter.

이 어댑터가 사용하는 ViewHolder 타입입니다.

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val itemCount: Int

Functions

Link copied to clipboard
fun addFooterItem(item: ITEM, onResult: (NormalAdapterResult) -> Unit? = null)

Appends a single footer item.

footer 아이템 1개를 추가합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard
fun addFooterItemAt(position: Int, item: ITEM, onResult: (NormalAdapterResult) -> Unit? = null)

Inserts a footer item at a specific footer position.

지정한 footer 위치에 footer 아이템을 삽입합니다.

Link copied to clipboard
fun addFooterItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit? = null)

Appends multiple footer items.

여러 footer 아이템을 추가합니다.

Link copied to clipboard
fun addHeaderItem(item: ITEM, onResult: (NormalAdapterResult) -> Unit? = null)

Appends a single header item.

header 아이템 1개를 추가합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard
fun addHeaderItemAt(position: Int, item: ITEM, onResult: (NormalAdapterResult) -> Unit? = null)

Inserts a header item at a specific position.

지정한 위치에 header 아이템을 삽입합니다.

Link copied to clipboard
fun addHeaderItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit? = null)

Appends multiple header items.

여러 header 아이템을 추가합니다.

Link copied to clipboard
open override fun addItem(item: ITEM, onResult: (NormalAdapterResult) -> Unit?)

Appends a single content item immediately.

content 아이템 1개를 즉시 추가합니다.

Link copied to clipboard
open override fun addItemAt(position: Int, item: ITEM, onResult: (NormalAdapterResult) -> Unit?)

Inserts a content item at a position immediately.

지정한 위치에 content 아이템을 즉시 삽입합니다.

Link copied to clipboard
open override fun addItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit?)

Appends multiple content items immediately.

여러 content 아이템을 즉시 추가합니다.

Link copied to clipboard
open override fun addItemsAt(position: Int, items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit?)

Inserts multiple content items at a position immediately.

지정한 위치에 여러 content 아이템을 즉시 삽입합니다.

Link copied to clipboard
fun bindViewHolder(@NonNull holder: VH & Any, position: Int)
Link copied to clipboard

Clears all footer items.

모든 footer 아이템을 제거합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard

Clears all header items.

모든 header 아이템을 제거합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard
fun createViewHolder(@NonNull parent: ViewGroup, viewType: Int): VH & Any
Link copied to clipboard

Returns immutable snapshot of all sections combined.

header + content + footer 전체 섹션의 불변 스냅샷을 반환합니다.

Link copied to clipboard

Returns immutable snapshot of current footer items.

현재 footer 아이템의 불변 스냅샷을 반환합니다.

Link copied to clipboard

Returns immutable snapshot of current header items.

현재 header 아이템의 불변 스냅샷을 반환합니다.

Link copied to clipboard
fun getItem(position: Int): ITEM

Returns content item at position or throws when invalid.

position의 content 아이템을 반환하고 유효하지 않으면 예외를 발생시킵니다.

Link copied to clipboard
open override fun getItemCount(): Int

Returns total adapter item count.

전체 adapter 아이템 수를 반환합니다.

Link copied to clipboard
open fun getItemId(position: Int): Long
Link copied to clipboard
open override fun getItemOrNull(position: Int): ITEM?

Returns content item at position safely, or null.

position의 content 아이템을 안전하게 조회하고 없으면 null을 반환합니다.

Link copied to clipboard
open override fun getItemPosition(item: ITEM): Int

Returns index of target content item, or -1 when not found.

대상 content 아이템의 인덱스를 반환하고 없으면 -1을 반환합니다.

Link copied to clipboard
open override fun getItems(): List<ITEM>

Returns immutable snapshot of current content items.

현재 content 아이템의 불변 스냅샷을 반환합니다.

Link copied to clipboard
open override fun getItemViewType(position: Int): Int

Returns the view type for the given adapter position by section.

주어진 adapter position을 섹션 기준으로 해석해 viewType을 반환합니다.

Link copied to clipboard

Returns mutable copy of current content items.

현재 content 아이템의 가변 복사본을 반환합니다.
Warning: This is a snapshot copy. Mutations do NOT affect the adapter state.

경고: 이 리스트는 스냅샷 복사본이므로 변경해도 adapter 상태에 반영되지 않습니다.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun moveItem(fromPosition: Int, toPosition: Int, onResult: (NormalAdapterResult) -> Unit?)

Moves a content item from one position to another immediately.

content 아이템을 한 위치에서 다른 위치로 즉시 이동합니다.

Link copied to clipboard
Link copied to clipboard
fun notifyItemChanged(position: Int)
fun notifyItemChanged(position: Int, @Nullable payload: Any?)
Link copied to clipboard
fun notifyItemInserted(position: Int)
Link copied to clipboard
fun notifyItemMoved(fromPosition: Int, toPosition: Int)
Link copied to clipboard
fun notifyItemRangeChanged(positionStart: Int, itemCount: Int)
fun notifyItemRangeChanged(positionStart: Int, itemCount: Int, @Nullable payload: Any?)
Link copied to clipboard
fun notifyItemRangeInserted(positionStart: Int, itemCount: Int)
Link copied to clipboard
fun notifyItemRangeRemoved(positionStart: Int, itemCount: Int)
Link copied to clipboard
fun notifyItemRemoved(position: Int)
Link copied to clipboard
Link copied to clipboard
open override fun onBindViewHolder(holder: VH, position: Int)

Binds holder without payloads.

payload 없이 holder를 바인딩합니다.

open override fun onBindViewHolder(holder: VH, position: Int, payloads: MutableList<Any>)

Binds holder with payloads when provided.

payload가 제공되면 holder를 payload 기반으로 바인딩합니다.

Link copied to clipboard
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH

ViewHolder를 생성하고 클릭 리스너를 1회만 연결합니다.

Link copied to clipboard
Link copied to clipboard
open fun onFailedToRecycleView(@NonNull holder: VH & Any): Boolean
Link copied to clipboard
open fun onViewAttachedToWindow(@NonNull holder: VH & Any)
Link copied to clipboard
open fun onViewDetachedFromWindow(@NonNull holder: VH & Any)
Link copied to clipboard
open override fun onViewRecycled(holder: VH)

holder가 재활용될 때 캐시된 child view를 정리합니다.

Link copied to clipboard
open override fun removeAll(onResult: (NormalAdapterResult) -> Unit?)

Clears all content items immediately. Always returns true.

모든 content 아이템을 즉시 제거합니다. 항상 true를 반환합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard
open override fun removeAt(position: Int, onResult: (NormalAdapterResult) -> Unit?)

Removes content item at position immediately.

지정한 위치의 content 아이템을 즉시 제거합니다.

Link copied to clipboard
open override fun removeItem(item: ITEM, onResult: (NormalAdapterResult) -> Unit?)

Removes the first matching content item immediately.

첫 번째로 일치하는 content 아이템을 즉시 제거합니다.

Link copied to clipboard
open override fun removeItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit?)

Removes matching content items with best-effort semantics.

best-effort 방식으로 일치하는 content 아이템들을 제거합니다.

Link copied to clipboard
open override fun removeRange(start: Int, count: Int, onResult: (NormalAdapterResult) -> Unit?)

Removes a contiguous content range by start index and count.

시작 인덱스와 개수 기준으로 연속된 content 구간을 제거합니다.

Link copied to clipboard
open override fun replaceItemAt(position: Int, item: ITEM, onResult: (NormalAdapterResult) -> Unit?)

Replaces content item at position immediately.

지정한 위치의 content 아이템을 즉시 교체합니다.

Link copied to clipboard
fun setFooterItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit? = null)

Replaces all footer items immediately.

전체 footer 아이템을 즉시 교체합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard
open fun setHasStableIds(hasStableIds: Boolean)
Link copied to clipboard
fun setHeaderItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit? = null)

Replaces all header items immediately.

전체 header 아이템을 즉시 교체합니다.
Always reports NormalAdapterResult.Applied.

항상 NormalAdapterResult.Applied를 전달합니다.

Link copied to clipboard
open override fun setItems(items: List<ITEM>, onResult: (NormalAdapterResult) -> Unit?)

Replaces all content items immediately.

전체 content 아이템을 즉시 교체합니다.

Link copied to clipboard
open override fun setOnItemClickListener(listener: (Int, ITEM, View) -> Unit)

Sets item click listener.

아이템 클릭 리스너를 설정합니다.

Link copied to clipboard
open override fun setOnItemLongClickListener(listener: (Int, ITEM, View) -> Unit)

Sets item long-click listener.

아이템 롱클릭 리스너를 설정합니다.