{"id":27966461,"url":"https://github.com/techery/celladapter","last_synced_at":"2025-05-07T20:18:55.593Z","repository":{"id":75020262,"uuid":"71697578","full_name":"techery/CellAdapter","owner":"techery","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-31T19:59:36.000Z","size":145,"stargazers_count":14,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T20:18:50.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techery.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,"governance":null}},"created_at":"2016-10-23T11:05:32.000Z","updated_at":"2022-06-01T20:17:52.000Z","dependencies_parsed_at":"2023-02-28T23:15:34.784Z","dependency_job_id":null,"html_url":"https://github.com/techery/CellAdapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techery%2FCellAdapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techery%2FCellAdapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techery%2FCellAdapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techery%2FCellAdapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techery","download_url":"https://codeload.github.com/techery/CellAdapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252949223,"owners_count":21830154,"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":[],"created_at":"2025-05-07T20:18:55.125Z","updated_at":"2025-05-07T20:18:55.561Z","avatar_url":"https://github.com/techery.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CellAdapter\n\nThis library simplifies RecyclerView with multiple view types.\nMain points:\n\n* Single adapter class for all project\n* Extend item types in RecyclerView - just register in adapter and extend Cell.class for mapping model with UI (below more details + [`sample`](https://github.com/techery/CellAdapter/tree/master/sample/src/main/java/io/techery/sample))\n* Add any UI listeners to each item type\n\nNo more code like this:\n```java\n@Override\npublic int getItemViewType(int position) {\n\t// Just as an example, return 0 or 2 depending on position\n\treturn position % 2 * 2;\n}\n\n@Override\npublic RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\tswitch (viewType) {\n\t\tcase 0: return new ViewHolder0(...);\n\t\tcase 2: return new ViewHolder2(...);\n\t\t...\n\t}\n}\n```\n\n## Usage\n\n```java\nCellAdapter adapter = new CellAdapter(context);\n//feel free to register multiple models and cells (model per cell, so your RecyclerView would represent multiple view types)\nadapter.registerCell(Model.class, YourCell.class, new YourCell.Listener(){}); \n\nList items = new ArrayList();\nitems.add(new Model());\nadapter.setItems(items);\nadapter.notifyDataSetChanged();\n```\nwhere\n`Model.class` is POJO and `YourCell.class` is\n```java\n@Layout(R.layout.your_cell_view)\npublic class YourCell extends Cell\u003cModel, YourCell.Listener\u003e {\n\n \t@Override\n\tprotected void syncUiWithItem() {\n\t\tgetItem() // is your Model object\n\t}\n\t\n\tprotected void prepareForReuse() {\n\t\t//optional\n\t}\n    \n\tprotected void clearResources() {\n\t\t//optional\n\t}\n\n\tpublic interface Listener extends Cell.Listener\u003cModel\u003e {\n\t\tvoid callbackSample(Model model);\n\t}\n}\n```\nAlso please find \n[`CellAdapter/sample/src/main/java/io/techery/sample/BaseCell.java`](https://github.com/techery/CellAdapter/blob/master/sample/src/main/java/io/techery/sample/BaseCell.java) \nthere is sample how to implement ButterKnife in Cells.\n\n## Download\n\nThe dependency is available via [jCenter](https://bintray.com/techery/android/celladapter). \njCenter is the default Maven repository used by Android Studio.\n\n#### Gradle\n```groovy\ndependencies {\n  compile 'io.techery:celladapter:1.0.1'\n}\n```\n\n#### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.techery\u003c/groupId\u003e\n  \u003cartifactId\u003ecelladapter\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.1\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## License\n\n    The MIT License (MIT)\n\n    Copyright (c) 2016 Techery (http://techery.io/)\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in\n    all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n    THE SOFTWARE.\n\n-------\n\n\u003cdiv\u003eIcons made by \u003ca href=\"http://www.freepik.com\" title=\"Freepik\"\u003eFreepik\u003c/a\u003e from \u003ca href=\"http://www.flaticon.com\" title=\"Flaticon\"\u003ewww.flaticon.com\u003c/a\u003e is licensed by \u003ca href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\" target=\"_blank\"\u003eCC 3.0 BY\u003c/a\u003e\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechery%2Fcelladapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechery%2Fcelladapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechery%2Fcelladapter/lists"}