{"id":13396130,"url":"https://github.com/yqritc/RecyclerView-FlexibleDivider","last_synced_at":"2025-03-13T22:31:44.667Z","repository":{"id":25862937,"uuid":"29302817","full_name":"yqritc/RecyclerView-FlexibleDivider","owner":"yqritc","description":"Android library providing simple way to control divider items (ItemDecoration) of RecyclerView","archived":false,"fork":false,"pushed_at":"2023-08-23T10:06:19.000Z","size":3797,"stargazers_count":2401,"open_issues_count":25,"forks_count":386,"subscribers_count":48,"default_branch":"master","last_synced_at":"2024-10-29T17:43:39.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/yqritc.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}},"created_at":"2015-01-15T15:09:34.000Z","updated_at":"2024-10-23T14:10:57.000Z","dependencies_parsed_at":"2022-09-16T11:31:55.603Z","dependency_job_id":"3d46dda3-9fef-4eb4-bd0d-580c802ffc73","html_url":"https://github.com/yqritc/RecyclerView-FlexibleDivider","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqritc%2FRecyclerView-FlexibleDivider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqritc%2FRecyclerView-FlexibleDivider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqritc%2FRecyclerView-FlexibleDivider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yqritc%2FRecyclerView-FlexibleDivider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yqritc","download_url":"https://codeload.github.com/yqritc/RecyclerView-FlexibleDivider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243493873,"owners_count":20299729,"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":"2024-07-30T18:00:40.960Z","updated_at":"2025-03-13T22:31:44.163Z","avatar_url":"https://github.com/yqritc.png","language":"Java","funding_links":[],"categories":["Index `(light-weight pages)`","Index","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"# RecyclerView-FlexibleDivider\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RecyclerView--FlexibleDivider-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1418)\n[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[![Download](https://api.bintray.com/packages/yqritc/maven/recyclerview-flexibledivider/images/download.svg)](https://bintray.com/yqritc/maven/recyclerview-flexibledivider/_latestVersion)\n\nAndroid library providing simple way to control divider items of RecyclerView\n\n ![Simple Divider](/sample/sample1.gif) ![Complex Divider](/sample/sample2.gif)\n\n# Release Note\n\n[Release Note] (https://github.com/yqritc/RecyclerView-FlexibleDivider/releases)\n\n# Gradle\n```groovy\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'com.yqritc:recyclerview-flexibledivider:1.4.0'\n}\n```\n\n# Usage\n\nThe following is the simplest usage.  \nDrawing a divider drawable retrieved from android.R.attr.listDivider between each cell.\n```java\nRecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);\nrecyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).build());\n```\n\n| ItemDecoration         | Usage |\n|:------------------|:----------|\n| HorizontalDividerItemDecoration         | For layout manager having vertical orientation to draw horizontal divider |\n| VerticalDividerItemDecoration         | For layout manager having horizontal orientation to draw vertical divider |\n_*Please note that you can only set one of above item decorations at a time._\n\nIf you want to set color, size and margin values, you can specify as the followings.\n```java\nRecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);\nrecyclerView.addItemDecoration(\n        new HorizontalDividerItemDecoration.Builder(this)\n                .color(Color.RED)\n                .sizeResId(R.dimen.divider)\n                .marginResId(R.dimen.leftmargin, R.dimen.rightmargin)\n                .build());\n```\n\n\nInstead of setting color and size, you can set paint object.\n```java\nPaint paint = new Paint();\npaint.setStrokeWidth(5);\npaint.setColor(Color.BLUE);\npaint.setAntiAlias(true);\npaint.setPathEffect(new DashPathEffect(new float[]{25.0f, 25.0f}, 0));\nrecyclerView.addItemDecoration(\n        new HorizontalDividerItemDecoration.Builder(this).paint(paint).build());\n```\n\nAlso 9patch drawable can be used for drawing divider.\n```java\nRecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);\nrecyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this)\n        .drawable(R.drawable.sample)\n        .size(15)\n        .build());\n```\n\nIf you want to customize divider depending on the position, implement the following interfaces.\n\n### List of provider\nThe following providers can be implemented and controllable for each divider drawn between cells.  \nPlease refer to ComplexAdapter class in the [sample](/sample/src/main/java/com/yqritc/recyclerviewflexibledivider/sample) for the usage of providers in detail.\n\n- ColorProvider\nProvide color for divider\n\n- PaintProvider\nProvide paint object for divider line to draw.\n\n- DrawableDivider\nProvide drawable object for divider line\n\n- SizeProvider\nProvide height for horizontal divider, width for vertical divider.\n\n- VisibilityProvider  \nEnables you to control the visibility of dividers.\n\n- MarginProvider for horizontal divider (vertical list)  \nEnables you to specify left and right margin of divider.\n\n- MarginProvider for vertical divider (horizontal list)  \nEnables you to specify top and bottom margin of divider.  \n\n**For GridLayoutManager**, the position parameter of above providers is group index of items.\nSo, control your divider based on [group index](http://developer.android.com/intl/ja/reference/android/support/v7/widget/GridLayoutManager.SpanSizeLookup.html#getSpanGroupIndex(int, int)) instead of the position of items.\n\n### Optional\n- Builder.showLastDivider  \nDraw divider line at the end of last item in RecyclerView.\nIf you enable this, the range of position parameter of providers listed above is 0 to itemCount-1.\nOtherwise, the range is 0 to itemCount-2.  \n\n- Builder.positionInsideItem  \nDraw divider inside items.  \nIf you want to follow [material design guideline](https://www.google.com/design/spec/components/dividers.html#dividers-specs), enable this feature.\n\n\n### Note\n- When neither of color, paint, drawable is set, default divider retrieved from android.R.attr.listDivider will be used.\n- When you set Paint, you must use setColor and setStrokeWidth methods of paint class.\n- If you want to use DashPathEffect, please note the following issue.\nhttps://code.google.com/p/android/issues/detail?id=29944\n\n##### _Looking for custom ItemDecoration to achieve equal column space for GridLayoutManager?_\nCheck out [https://gist.github.com/yqritc/ccca77dc42f2364777e1](https://gist.github.com/yqritc/ccca77dc42f2364777e1)\n\n# License\n```\nCopyright 2016 yqritc\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyqritc%2FRecyclerView-FlexibleDivider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyqritc%2FRecyclerView-FlexibleDivider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyqritc%2FRecyclerView-FlexibleDivider/lists"}