GithubHelp home page GithubHelp logo

matrixy / krecyclerdsl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tgirard12/krecyclerdsl

0.0 1.0 0.0 149 KB

Kotlin Dsl for Android RecyclerView

License: Apache License 2.0

Java 10.48% Kotlin 89.52%

krecyclerdsl's Introduction

KRecyclerDsl

download

Kotlin Dsl for Android RecyclerView

Exemple

recyclerView.adapter = dataClassAdapter<MyView, MyDataClass>(R.layout.my_view, myItems) {
    onBindViewHolder { view, dataClass ->
        view.name.text = dataClass.name
        view.description.text = dataClass.description
    }
    onItemClickListener { view, dataClass ->
        startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(dataClass.html_url)))
    }
}

Extensions functions

This library provide some useful (or not) extensions functions :

// Call the function when scroll down on the last visible item
recyclerView.addInfiniteScrollListener { search() }

// Add separation between each line.
recyclerView.addDividerItemDecorationVertical()

// Add separation between each column.
recyclerView.addDividerItemDecorationHorizontal()

Dependency

KRecyclerDsl has no dependency, you must add your RecyclerView library version.
This library generate a JAR, not an AAR, so you can use it with any compile version option.

compile "com.tgirard12.krecyclerdsl:krecyclerdsl:$LATEST_VERSION"

// Required
compile "com.android.support:recyclerview-v7:$your_version"

krecyclerdsl's People

Contributors

tgirard12 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.