Description
RecyclerView adapter for kids.
A kotlin dsl mechanism to simplify and reduce boilerplate logic of a RecyclerView.Adapter
KidAdapter alternatives and similar packages
Based on the "Recyclerview Widget" category.
Alternatively, view KidAdapter alternatives based on common mentions on social networks and blogs.
-
recyclerview-animators
An Android Animation library which easily add itemanimator to RecyclerView items. -
UltimateRecyclerView
A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features. -
XRecyclerView
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView -
android-advancedrecyclerview
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting) -
sticky-headers-recyclerview
[UNMAINTAINED] Sticky Headers decorator for Android's RecyclerView -
RecyclerView-FlexibleDivider
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView -
ScrollablePanel
A flexible view for providing a limited rect window into a large data set,just like a two-dimensional RecyclerView. It different from RecyclerView is that it's two-dimensional(just like a Panel) and it pin the itemView of first row and first column in their original location. -
RecyclerViewHeader
Super fast and easy way to create header for Android RecyclerView -
RecyclerViewEnhanced
Android Library to provide swipe, click and other functionality to RecyclerView -
header-decor
A couple of sticky header decorations for android's recycler view. -
SectionedRecyclerView
An adapter to create Android RecyclerViews with sections, providing headers and footers. -
LastAdapter
Don't write a RecyclerView adapter again. Not even a ViewHolder! -
Dividers
Dividers is a simple Android library to create easy separators for your RecyclerViews -
RecyclerView-MultipleViewTypesAdapter
Android library defining adapter classes of RecyclerView to manage multiple view types -
RecyclerViewSwipeDismiss
A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView. -
RecyclerItemDecoration
ItemDecoration for RecyclerView using LinearLayoutManager for Android -
DynamicRecyclerView
Set of plugable extenstions for Android RecyclerView -
PowerfulRecyclerViewAdapter
A Common RecyclerView.Adapter implementation which supports all kind of items and has useful data operating APIs such as remove,add,etc. -
recyclerview-binder
Android library for RecyclerView to manage order of items and multiple view types. -
CircularLayoutManager
Custom Layout Manager for Recycler View -
InfiniteRecyclerView
A RecyclerView Adapter which allows you to have an Infinite scrolling list in your apps -
VsRecyclerView
The library that removes all boilerplate code allowing you to display lists with few lines of code. -
android RecyclerView support Header Footer and Empty list
android RecyclerView support Header Footer and Empty list -
RollerTrack
A navigational roller track companion for RecyclerView lists -
Infinite scroll functionality for recycler views
Infinite scroll functionality for recycler views
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of KidAdapter or a related project?
README
KidAdapter
RecyclerView adapter for kids.
A kotlin dsl mechanism to simplify and reduce boilerplate logic of a RecyclerView.Adapter
.
With KidAdapter you can use all power of kotlin dsl to avoid wired standard implementation of RecyclerView.Adapter
view types. You can easily maintain, update, move, swap, remove or add new view types using dsl code blocks.
Bonus: Almost all logic by default works with DiffUtil
Gradle
Gradle:
// only for androidx projects
implementation 'com.link184:kid-adapter:1.3.7'
// for projects with android.support.*
implementation 'com.link184:kid-adapter:1.2.2'
Samples
Simple adapter without view types:
val adapter = recyclerView.setUp<MyObject> { //an extension on RecyclerView which return a instance of adapter
// optional, set layout manager or leave to use default linear vertical
withLayoutManager(GridLayoutManager(context, 3))
// set layout res id for each adapter item
withLayoutResId(R.layout.item_text)
// set adapter items
withItems(mutableListOf(MyObject(name = "one"), MyObject("two"), MyObject("three")))
// set bind action
bind { item -> // this - adapter view holder itemView, item - current item
this.setBackgroundColor(getRandomColor())
stringName.text = item.name //string view is a synthetic inflated view from bind function context
setOnClickListener { ... } //click listener on ViewHolder.itemView
}
// if you need adapter position use this method instead of "bind"
bindIndexed { item, index -> // item - current item, index - adapterPosition
...
}
}
//runtime adapter update
adapter + MyObject("four")
adapter += mutableListOf(MyObject("1"), MyObject("2"))
adapter[2] = MyObject("two")
adapter - MyObject("four")
adapter + MyObject("five") + MyObject("six") - MyObject("one")
Adapter with view types:
val adapter = recyclerView.setUp {
// declare a viewtype
withViewType("FIRST_STRING_TAG") { // tag is optional but is useful for future updates when you have multiple view typs with the same item types
// optional, set layout manager or leave to use default linear vertical
withLayoutManager { GridLayoutManager(context, 3) }
// set layout res id to current view type
withLayoutResId(R.layout.item_text)
// set items to currect view type
withItems(mutableListOf("one", "two", "three", "four", "five", "six", "seven"))
// optional, a callback from DiffUtils, by default it compare items with equals() method, set it if you need a custom behavior
withContentComparator<String> { oldItem, newItem ->
oldItem.length > newItem.length
}
// optional, a callback from DiffUtils, by default it compare items with equals() method, set it if you need a custom behavior
withItemsComparator<Int> { oldItem, newItem ->
oldItem.hashCode() == newItem.hashCode()
}
// set bind action
bind<String> { // this - is adapter view hoder itemView, item - current item
stringName.text = it
setOnClickListener { ... } //click listener on ViewHolder.itemView
}
// if you need adapter position use this method instead of "bind"
bindIndexed { item, index -> // item - current item, index - adapterPosition
...
}
}
withViewType {
withLayoutResId(R.layout.item_int)
withItems(mutableListOf(1, 2, 3, 4, 5, 6))
bind<Int> {
intName.text = it.toString()
}
}
withViewType("SECOND_STRING_TAG") {
withLayoutResId(R.layout.item_text)
withItems(mutableListOf("eight", "nine", "ten", "eleven", "twelve"))
bind<String> {
stringName.text = it
}
}
//Update adapter as needed
adapter update { ... }
}
Update multiple view type adapter.
adapter update {
insertBottom(mutableListOf("thirteen", "fourteen"), SECOND_STRING_TAG)
insertTop(mutableListOf("asd", "asd")) // there are no tag, library automatically detect and insert items on first list of strings
insert(2, mutableListOf(4, 5, 6, 7)) // no tag, items will be inserted in first list of integers
removeItems(mutableListOf(1,3,6))
removeItems(mutableListOf("one", "thirteen"))
removeAll()
}
adapter restructure {
insert(2, "tag") {
withItems(items)
withLayoutResId(android.R.layout.list_content)
bind<Int> {
println("We are here $it")
}
}
insertTop("top1Tag") { ... }
insert(3, "insertAt3Tag") { ... }
insertBottom("bottom1Tag") { ... }
replace("top1Tag") { ... }
swap(0, 3)
removeAll()
insertTop("top1Tag") { ... }
}
Proguard
Don't worry about that.
License
See the LICENSE file for details.
*Note that all licence references and agreements mentioned in the KidAdapter README section above
are relevant to that project's source code only.