{"id":22951875,"url":"https://github.com/fueled/reclaim","last_synced_at":"2025-10-20T11:10:50.163Z","repository":{"id":37752471,"uuid":"59611502","full_name":"Fueled/reclaim","owner":"Fueled","description":"Change the way you use RecyclerView.","archived":false,"fork":false,"pushed_at":"2020-04-08T13:56:05.000Z","size":233,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":13,"default_branch":"master","last_synced_at":"2023-05-15T06:50:18.341Z","etag":null,"topics":["android","android-library","recyclerview"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fueled.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-24T21:58:02.000Z","updated_at":"2022-09-30T01:32:52.000Z","dependencies_parsed_at":"2022-09-01T04:12:47.437Z","dependency_job_id":null,"html_url":"https://github.com/Fueled/reclaim","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fueled%2Freclaim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fueled%2Freclaim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fueled%2Freclaim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fueled%2Freclaim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fueled","download_url":"https://codeload.github.com/Fueled/reclaim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229718753,"owners_count":18113571,"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":["android","android-library","recyclerview"],"created_at":"2024-12-14T15:19:15.887Z","updated_at":"2025-10-20T11:10:45.112Z","avatar_url":"https://github.com/Fueled.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reclaim [![](https://jitpack.io/v/Fueled/reclaim.svg)](https://jitpack.io/#Fueled/reclaim)\n\nReduce the boilerplate code that comes with using RecyclerView, decouple the code between the adapter and the item.\n\n# How to\n## Install\nAdd it in your root build.gradle at the end of repositories:\n```groovy\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nThen add the dependency to the application module:\n```groovy\ndependencies {\n    compile 'com.github.fueled:reclaim:2.x.x'\n}\n```\n\n### 1. Setup the adapter\nHave your RecyclerView use the adapter [ItemViewAdapter](reclaim/src/main/kotlin/com/fueled/reclaim/ItemsViewAdapter.kt).\n\n```kotlin\nval manager = LinearLayoutManager(this)\nrecyclerView.setLayoutManager(manager)\nadapter = ItemsViewAdapter()\nrecyclerView.setAdapter(adapter)\n```\n\n### 2. Create an adapter item\nThe design, implementation and interaction with items of your RecyclerView are all handled through the [AdapterItem](reclaim/src/main/kotlin/com/fueled/reclaim/AdapterItem.kt).\n\n\n```kotlin\nclass PlanetItem(private val planetName: String) : AdapterItem\u003cPlanetViewHolder\u003e {\n\n    override val layoutId: Int = android.R.layout.simple_list_item_1\n    \n    override fun onCreateViewHolder(view: View) = PlanetViewHolder(view)\n\n    override fun updateItemViews(viewHolder: PlanetViewHolder) {\n        viewHolder.text.setText(planetName)\n    }\n}\n\nclass PlanetViewHolder(view: View) : BaseViewHolder(view) {\n    val text: TextView = view.findViewById(android.R.id.text1)\n}\n\n```\n\n### 3. Add an adapter item to your adapter\nSimply add instances of your adapter item to your adapter by calling [ItemViewAdapter.addItem(item: AdapterItem)](reclaim/src/main/kotlin/com/fueled/reclaim/ItemsViewAdapter.kt#L113) or [ItemViewAdapter.addItemsList(items: List\u003cAdapterItem\u003c*\u003e)](reclaim/src/main/kotlin/com/fueled/reclaim/ItemsViewAdapter.kt#L45)\n\n```kotlin\nadapter = ItemsViewAdapter()\nrecyclerView.setAdapter(adapter)\nfor (planet in planets) {\n    adapter.addItem(PlanetItem(planet))\n}\n```\n\n## Using multiple item types\nAdding multiple item types is very simple in Reclaim, all you need to do is create your different adapter items then add them your view adapter as shown in the example below.\n\nCreate you desired adapter items:\n\n```kotlin\nclass HeaderItem(private val header: String) : AdapterItem\u003cHeaderItemViewHolder\u003e {\n    ...\n}\n```\n```kotlin\nclass FooterItem(private val footer: String) : AdapterItem\u003cFooterItemViewHolder\u003e {\n    ...\n}\n```\n```kotlin\nclass PlanetItem(private val planet: String) : AdapterItem\u003cPlanetItemViewHolder\u003e {\n    ...\n}\n```\n\nThen add them to your view adapter:\n```kotlin\nadapter = ItemsViewAdapter()\nrecyclerView.setAdapter(adapter)\n\nadapter.addItem(HeaderItem(\"Header YEAH!\"))\n\nfor (planet in planets) {\n    adapter.addItem(PlanetItem(planet))\n}\n\nadapter.addItem(new FooterItem(\"Footer OOOOOH\"))\n```\n\n## Interaction between an adapter item and other components\nIf you want to handle click actions that occur inside you item adapter view in your activity or fragment, you can simply pass your adapter item a handler which would be notified when a click action has occurred as shown in the example below.\n\n```kotlin\nclass PlanetItem(\n    private val planetName: String, \n    private val planetClickAction: (planet) -\u003e Unit\n) : AdapterItem\u003cPlanetViewHolder\u003e {\n\n    override val layoutId: Int = android.R.layout.simple_list_item_1\n    \n    override fun onCreateViewHolder(view: View) = PlanetViewHolder(view)\n\n    override fun updateItemViews(viewHolder: PlanetViewHolder) {\n        viewHolder.text.setText(planetName)\n        \n        viewHolder.itemView.setOnClickListener { planetClickAction(planetName) }\n    }\n}\n\nclass PlanetViewHolder(view: View) : BaseViewHolder(view) {\n    val text: TextView = view.findViewById(android.R.id.text1)\n}\n```\nin your activity:\n\n```kotlin\nadapter = ItemsViewAdapter()\nrecyclerView.setAdapter(adapter)\n\nval handler = { planet: String -\u003e displayPlanet(planet) }\nfor (planet in planets) {\n    adapter.addItem(PlanetItem(planet, handler))\n}\n```\n\n# License\n\n    Copyright 2019 Fueled\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffueled%2Freclaim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffueled%2Freclaim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffueled%2Freclaim/lists"}