Create fast, dynamic recycler views. No adapter, no view holders
Switch branches/tags
Nothing to show
Clone or download
Latest commit de5db9f Aug 8, 2018
Permalink
Failed to load latest commit information.
.idea init commit Jun 29, 2018
app added diff utils implementation Jul 4, 2018
fast-list added diff utils implementation Jul 4, 2018
gradle/wrapper init commit Jun 29, 2018
.gitignore init commit Jun 29, 2018
LICENSE license Jun 29, 2018
README.md Update README.md Aug 8, 2018
build.gradle init commit Jun 29, 2018
gradle.properties init commit Jun 29, 2018
logo.png logoh Jun 29, 2018
settings.gradle init commit Jun 29, 2018

README.md

logo

Create dynamic, fast and easy recycler view lists. No adapters, no view holders.

Download Twitter URL

Usage

FastList supports 2 types of lists- single layout lists and dynamic lists.

  • Here's how to create a simple single layout list:
        val list = listOf(Item("fast", 1), Item("recycler", 2), Item("view", 1))

        recycler_view.bind(list, R.layout.item) { it : Item ->
            item_text.text = it.value
        }

That's it! The first parameter is the list you want to show, the second is the ID of the layout and the third one is a function for binding each element. It uses Kotlin Extensions, so you can directly address the XML views and set them up.

  • The second type is dynamic lists with multiple layouts:
        val list = listOf(Item("fast", 1), Item("recycler", 2), Item("view", 1))

        recycler_view.bind(list)
                .map(layout = R.layout.item, predicate = { it.type == 1}) {
                    item_text.text = it.value
                }
                .map(layout = R.layout.item_second, predicate = { it.type == 2}) {
                    item_second_text.text = it.value
                }
                .layoutManager(LinearLayoutManager(this))

The map function accepts 3 parameters. The first is the ID of the layout for the type. The second is the predicate function by which you want to sort your items. The last one is the "view holder" binding function for each element. It uses Kotlin Extensions, so you can directly address the XML views and set them up.

You can also update a list in a shown recycler view with this DiffUtils update function:

        ...
        val list2 = listOf(Item("fast", 1))

        recycler_view.update(list2)

Download

Manually

You can also manually download the library class and use it in your application.

Important: For the manual download you need Kotlin extensions to be enabled. To turn them on, simply place "apply plugin: 'kotlin-android-extensions'" inside of your app build.gradle

Gradle

dependencies {
  implementation 'bg.devlabs.fastlist:fast-list:$latest_version'

}

Maven

<dependency>
  <groupId>bg.devlabs.fastlist</groupId>
  <artifactId>fast-list</artifactId>
  <version>latest_version</version>
  <type>pom</type>
</dependency>

Compatibility

Minimum Android SDK: API level 19


Author

Radoslav Yankov @Radoslav_Y


Getting help

If you spot a problem you can open an issue on the Github page, or alternatively, you can tweet us at @devlabsbg


License

FastList is released under the MIT License.