{"id":13610980,"url":"https://github.com/naverz/Antonio","last_synced_at":"2025-04-13T01:33:50.908Z","repository":{"id":42073402,"uuid":"399680847","full_name":"naverz/Antonio","owner":"naverz","description":"Android library for the adapter view (RecyclerView, ViewPager, ViewPager2)","archived":false,"fork":false,"pushed_at":"2024-07-30T08:54:35.000Z","size":295,"stargazers_count":118,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-01T19:56:13.179Z","etag":null,"topics":["android-library","recyclerview","viewpager","viewpager2"],"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/naverz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-25T03:44:51.000Z","updated_at":"2024-07-30T08:54:39.000Z","dependencies_parsed_at":"2023-11-13T05:27:16.893Z","dependency_job_id":"468591a1-7d52-4c09-8d8f-20f951476e86","html_url":"https://github.com/naverz/Antonio","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naverz%2FAntonio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naverz%2FAntonio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naverz%2FAntonio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naverz%2FAntonio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naverz","download_url":"https://codeload.github.com/naverz/Antonio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223558449,"owners_count":17165133,"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-library","recyclerview","viewpager","viewpager2"],"created_at":"2024-08-01T19:01:50.255Z","updated_at":"2024-11-07T17:31:01.257Z","avatar_url":"https://github.com/naverz.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"\n# Antonio\nAndroid library for the adapter view (RecyclerView, ViewPager, ViewPager2)\n\n* Free from implementation of the adapter's boilerplate code!\n* Free from implementation of the view holder with data-binding (Two-way binding OK)!\n* ViewPager, ViewPager2, Paging2, Paging3 supported!\n* Manage the recycler view state on your view model!\n* There is no things to learn, if you already know about adapter views (RecyclerView, ViewPager, ViewPager2)!\n     \n# Install\n## Without data binding\n```groovy\ndependencies {\n    def antonioVersion = '1.0.9-alpha'\n  \n    implementation \"io.github.naverz:antonio:$antonioVersion\"\n\n    //For paging2\n    implementation \"io.github.naverz:antonio-paging2:$antonioVersion\"\n\n    //For paging3\n    implementation \"io.github.naverz:antonio-paging3:$antonioVersion\"\n  \n    // You can implement additional dependencies as bellow, if you want to use AntonioAnnotation.\n    def antonioAnnotationVersion = '0.0.8-alpha'\n    implementation \"io.github.naverz:antonio-annotation:$antonioAnnotationVersion\"\n    //For java (You must select only one of kapt, ksp and annotationProcessor)\n    annotationProcessor \"io.github.naverz:antonio-compiler:$antonioAnnotationVersion\"\n    //For kotlin kapt (You must select only one of kapt, ksp and annotationProcessor)\n    kapt \"io.github.naverz:antonio-compiler:$antonioAnnotationVersion\"\n    //For kotlin ksp (You must select only one of kapt, ksp and annotationProcessor)\n    ksp \"io.github.naverz:antonio-compiler:$antonioAnnotationVersion\"\n}\n```\n## With data binding\n```groovy\ndependencies {\n    def antonioVersion = '1.0.9-alpha'\n  \n    implementation \"io.github.naverz:antonio-databinding:$antonioVersion\"\n\n    //For paging2\n    implementation \"io.github.naverz:antonio-databinding-paging2:$antonioVersion\"\n\n    //For paging3\n    implementation \"io.github.naverz:antonio-databinding-paging3:$antonioVersion\"\n}\n```\n# Basic Usage\n- Implement `AntonioBindingModel` to bind model on your **view holder layout xml**. \n\u003cp align=\"center\"\u003e\n  \u003cimg src =\"https://user-images.githubusercontent.com/15243641/134372911-2c71d7b8-9abb-4757-8991-46b6a3057763.png\" width =\"90\"\u003e\n\u003c/p\u003e\n\n```kotlin\ndata class ContentSmallModel(\n    val id: String,\n    @DrawableRes val iconRes: Int,\n    val price: Int,\n    val onClick: (id: String) -\u003e Unit,\n    val onLongClick: (id: String) -\u003e Boolean,\n    val selectedIds: LiveData\u003cSet\u003cString\u003e\u003e\n) : AntonioBindingModel {\n    // Layout id to be inflated\n    override fun layoutId(): Int = R.layout.view_holder_content_small\n    // Variable id in XML to be bind on bind view holder\n    // (e.g., onBindViewHolder in ViewHolder, onViewCreated in Fragment).\n    override fun bindingVariableId(): Int = BR.model\n}\n```\n- Create your view holder layout xml with the AntonioBindingModel you implemented.\n`view_holder_content_small.xml`\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003clayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    \u003e\n    \u003cdata\u003e\n        \u003cvariable\n            name=\"model\"\n            type=\"io.github.naverz.antonio.sample.ContentSmallModel\"\n        /\u003e\n    \u003c/data\u003e\n\n    \u003cLinearLayout\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center_horizontal\"\n        android:onClick=\"@{()-\u003emodel.onClick.invoke(model.id)}\"\n        android:onLongClick=\"@{(view)-\u003emodel.onLongClick.invoke(model.id)}\"\n        android:orientation=\"vertical\"\n        android:padding=\"5dp\"\n        \u003e\n        \u003c!-- ... --\u003e\n    \u003c/LinearLayout\u003e\n\u003c/layout\u003e\n```\n- Declare `AntonioAdapter` (or `AntonioListAdapter`) and Set adapter with your data to RecyclerView.\n```kotlin\n   private fun initAdapter(){\n       // You also can specify the type of Antonio model for the adapter, if you don't need various view types.\n       // e.g., AntonioAdapter\u003cContentSmallModel\u003e()\n        binding.recyclerView.adapter =\n            AntonioAdapter\u003cAntonioModel\u003e().apply { currentList = viewModel.antonioModels }\n        // Don't forget to set the layout manager to your recycler view :)\n        binding.recyclerView.layoutManager = GridLayoutManager(context,4)    \n        viewModel.onDataSetChanged.observe(this) {\n            binding.recyclerView.adapter?.notifyDataSetChanged()\n        }\n   }\n  \n```\n\u003cp align=\"center\"\u003e\n  \u003cimg src =\"https://user-images.githubusercontent.com/15243641/134373020-e7b1f23d-1b10-406c-b180-63acdcb27215.png\" width =\"200\"\u003e\n\u003c/p\u003e\n\n## LifecycleOwner will be injected automatically!\nLifecycleOwner, which is nearest from the view, will be automatically injected on All of XML inflated from `AutoBindingModel` in order to use LiveData for two-way binding.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/15243641/134387612-8217d441-6a1e-4e41-98f4-5368ca987890.png\" width=\"300\"\u003e\n\u003c/p\u003e\n\n# Awesome wiki! \n- [Additional tips for Data binding](https://github.com/naverz/Antonio/wiki/Additional-tips-for-Data-binding)\n    - [With Data Binding](https://github.com/naverz/Antonio/wiki/Additional-tips-for-Data-binding#with-data-binding)\n    - [How to inject data when the view is created (e.g, onCreateViewHolder).](https://github.com/naverz/Antonio/wiki/Additional-tips-for-Data-binding#with-data-binding)\n    - [LifecycleOwner](https://github.com/naverz/Antonio/wiki/Additional-tips-for-Data-binding#lifecycleowner)\n- [Usage without data binding](https://github.com/naverz/Antonio/wiki/Usage-without-data-binding)\n- [Additional component for Antonio](https://github.com/naverz/Antonio/wiki/Additional-component-for-antonio)\n    - [For RecyclerView](https://github.com/naverz/Antonio/wiki/Additional-component-for-antonio#for-recyclerview)\n    - [For ViewPager](https://github.com/naverz/Antonio/wiki/Additional-component-for-antonio#for-viewpager)\n    - [For ViewPager2](https://github.com/naverz/Antonio/wiki/Additional-component-for-antonio#for-viewpager2)\n    - [For Adapter](https://github.com/naverz/Antonio/wiki/Additional-component-for-antonio#for-adapter)\n- [Plug-in](https://github.com/naverz/Antonio/wiki/Plug-in)\n    - [ViewPager](https://github.com/naverz/Antonio/wiki/Plug-in#viewpager)\n    - [ViewPager2](https://github.com/naverz/Antonio/wiki/Plug-in#viewpager2)\n    - [Paging 2](https://github.com/naverz/Antonio/wiki/Plug-in#paging2)\n    - [Paging-3](https://github.com/naverz/Antonio/wiki/Plug-in#paging3)\n- [AdapterView state (RecyclerView, ViewPager)](https://github.com/naverz/Antonio/wiki/AdapterView-state-(RecyclerView,-ViewPager))\n    -  [How to use](https://github.com/naverz/Antonio/wiki/AdapterView-state-(RecyclerView,-ViewPager)#how-to-use)\n    -  [Why AdapterView cannot be expressed as a state in your view model.](https://github.com/naverz/Antonio/wiki/AdapterView-state-(RecyclerView,-ViewPager)#why-adapterview-cannot-be-expressed-as-a-state-in-your-view-model)\n    -  [Dependency injection](https://github.com/naverz/Antonio/wiki/AdapterView-state-(RecyclerView,-ViewPager)#dependency-injection)\n    -  [For test code](https://github.com/naverz/Antonio/wiki/AdapterView-state-(RecyclerView,-ViewPager)#for-test-code)\n\n# Sample\n[The sample module](./sample) is available!\n\n\u003cimg src=\"https://user-images.githubusercontent.com/15243641/134202280-4fb1787d-78a6-4316-9b9f-5778fcc68679.gif\" width=\"270\" /\u003e\n\n# License\n```\nAntonio\nCopyright (c) 2021-present NAVER Z Corp.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaverz%2FAntonio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaverz%2FAntonio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaverz%2FAntonio/lists"}