{"id":20492578,"url":"https://github.com/redmadrobot/itemsadapter","last_synced_at":"2025-08-19T19:18:52.519Z","repository":{"id":57728262,"uuid":"313060571","full_name":"RedMadRobot/itemsadapter","owner":"RedMadRobot","description":"The simple adapter to render static data in RecyclerView","archived":false,"fork":false,"pushed_at":"2021-07-18T09:44:16.000Z","size":130,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T17:04:40.565Z","etag":null,"topics":["adapter","android","library","recyclerview","recyclerview-adapter"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RedMadRobot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-15T15:24:20.000Z","updated_at":"2024-07-22T22:49:15.000Z","dependencies_parsed_at":"2022-09-01T10:10:20.793Z","dependency_job_id":null,"html_url":"https://github.com/RedMadRobot/itemsadapter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedMadRobot%2Fitemsadapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedMadRobot%2Fitemsadapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedMadRobot%2Fitemsadapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RedMadRobot%2Fitemsadapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RedMadRobot","download_url":"https://codeload.github.com/RedMadRobot/itemsadapter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750075,"owners_count":21155685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","android","library","recyclerview","recyclerview-adapter"],"created_at":"2024-11-15T17:29:41.960Z","updated_at":"2025-04-13T17:05:06.608Z","avatar_url":"https://github.com/RedMadRobot.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ItemsAdapter \u003cGitHub path=\"RedMadRobot/itemsadapter\"/\u003e\n[![Version](https://img.shields.io/maven-central/v/com.redmadrobot.itemsadapter/itemsadapter?style=flat-square)][mavenCentral] [![Build Status](https://img.shields.io/github/workflow/status/RedMadRobot/itemsadapter/CI/main?style=flat-square)][ci] [![License](https://img.shields.io/github/license/RedMadRobot/itemsadapter?style=flat-square)][license]\n\nThe simple adapter to render static data in `RecyclerView`.\n\n---\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Installation](#installation)\n- [Rationale](#rationale)\n    - [When should I not use `ItemsAdapter`?](#when-should-i-not-use-itemsadapter)\n- [Usage](#usage)\n  - [`ViewBinding` support](#viewbinding-support)\n  - [Features](#features)\n    - [Context](#context)\n    - [Looping mode](#looping-mode)\n- [Contributing](#contributing)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Installation\n\nAdd the dependency:\n```groovy\nrepositories {\n    mavenCentral()\n    google()\n}\n\ndependencies {\n    implementation(\"com.redmadrobot.itemsadapter:itemsadapter:1.1\")\n    // or if you use viewbinding\n    implementation(\"com.redmadrobot.itemsadapter:itemsadapter-viewbinding:1.1\")\n}\n```\n\n## Rationale\n\nThere are cases when you just need to render a simple list of static data without the hassle.\nYou don't want to use complex solutions like [Epoxy] or [Groupie] for this purpose.\nThis task is `ItemsAdapter` was created for.\n`ItemsAdapter` offers you simple DSL to create adapters.\n\n#### When should I not use `ItemsAdapter`?\n\n- **When** you need to update and re-draw data in adapter\n- **When** you need to render elements with complex logic\n\n## Usage\n\nThe simplest case of usage is:\n```kotlin\nrecyclerView.adapter = itemsAdapter(regions) { region -\u003e\n    bind(R.layout.view_region) { // this: View\n        view_region_title.text = region.title\n        view_region_description.text = region.description\n    }\n}\n```\n\nIf you have more than one view type, you can use operator `when`:\n```kotlin\nrecyclerView.adapter = itemsAdapter(contactsItems) { item -\u003e\n    when (item) {\n        is ContactsItem.Header -\u003e bind(R.layout.view_contacts_header) {\n            view_contacts_header_letter.text = item.letter\n        }\n\n        is ContactsItem.Entry -\u003e bind(R.layout.view_contacts_entry) {\n            view_contacts_entry_name.text = item.name\n            view_contacts_entry_phone.text = item.phone\n        }\n    }\n}\n```\n\n\u003e :exclamation: Note that kotlin synthetics are deprecated since Kotlin 1.4.20, so it is better to use ViewBinding or `findViewById`.\n\n### `ViewBinding` support\n\nIf you use `ViewBinding`, use `itemsadapter-viewbinding` in place of `itemsadapter`.  \nThen you can use method `bind` with `ViewBinding`:\n```kotlin\nrecyclerView.adapter = itemsAdapter(regions) { region -\u003e\n    bind\u003cViewRegionBinding\u003e(R.layout.view_region) { // this: ViewRegionBinding\n        title.text = region.title\n        description.text = region.description\n    }\n}\n```\n\n### Features\n\n#### Context\n\nWithin `itemsAdapter` block you can use contextual data:\n\n| Field        | Description               |\n|--------------|---------------------------|\n| `index: Int` | Index of the current item |\n\n#### Looping mode\n\nSet parameter `isLooping` to `true` to use `ItemsAdapter` in looping mode.\nIt will only work if you have more than one element in data list.\n\n## Contributing\nMerge requests are welcome.\nFor major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\n[MIT][license]\n\n[mavenCentral]: https://search.maven.org/search?q=g:com.redmadrobot.itemsadapter\n[ci]: https://github.com/RedMadRobot/itemsadapter/actions\n[license]: LICENSE\n\n[epoxy]: https://github.com/airbnb/epoxy/\n[groupie]: https://github.com/lisawray/groupie/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredmadrobot%2Fitemsadapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredmadrobot%2Fitemsadapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredmadrobot%2Fitemsadapter/lists"}