{"id":13492981,"url":"https://github.com/BelooS/ChipsLayoutManager","last_synced_at":"2025-03-28T11:31:22.383Z","repository":{"id":39617174,"uuid":"64873196","full_name":"BelooS/ChipsLayoutManager","owner":"BelooS","description":"ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features","archived":false,"fork":false,"pushed_at":"2020-01-17T20:46:04.000Z","size":29436,"stargazers_count":3247,"open_issues_count":37,"forks_count":361,"subscribers_count":62,"default_branch":"master","last_synced_at":"2024-10-29T17:55:28.172Z","etag":null,"topics":["android","layoutmanager","recyclerview","recyclerview-adapter","span","ui"],"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/BelooS.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}},"created_at":"2016-08-03T19:23:43.000Z","updated_at":"2024-10-25T11:20:49.000Z","dependencies_parsed_at":"2022-09-15T01:24:28.639Z","dependency_job_id":null,"html_url":"https://github.com/BelooS/ChipsLayoutManager","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelooS%2FChipsLayoutManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelooS%2FChipsLayoutManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelooS%2FChipsLayoutManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BelooS%2FChipsLayoutManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BelooS","download_url":"https://codeload.github.com/BelooS/ChipsLayoutManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222376246,"owners_count":16974312,"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","layoutmanager","recyclerview","recyclerview-adapter","span","ui"],"created_at":"2024-07-31T19:01:11.017Z","updated_at":"2024-10-31T07:31:02.983Z","avatar_url":"https://github.com/BelooS.png","language":"Java","readme":"# ChipsLayoutManager \u003cimg alt=\"ChipsLayoutManager is an android library\" src=\"https://www.cleveroad.com/public/comercial/label-android.svg\" height=\"19\"\u003e [![minSdk for ChipsLayoutManager](https://img.shields.io/badge/minSdk-15-green.svg)](#) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ChipsLayoutManager-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/4568#)\n![ChipsLayoutManager for RecyclerView. Custom layout manager for RecyclerView](/images/header.png)\n\n## This is ChipsLayoutManager - custom Recycler View's LayoutManager which moves item to the next line when no space left on the current \nThis layout manager could represent [Google Chips material design pattern](https://material.google.com/components/chips.html#)\n\nAs an android developer i see that google isn't so polite to support all our wishes, and when i faced with such common task like create spannable list\nbut with support of CRUD animations i decided to make such stuff and share it.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"/images/demo.gif\" alt=\"Chips layout manager gif with scrolling\"\u003e\n\u003c/p\u003e\n\n## Setup and usage\n### Installation [ ![Download](https://api.bintray.com/packages/beloo/widget/ChipsLayoutManager/images/download.svg) ](https://bintray.com/beloo/widget/ChipsLayoutManager/_latestVersion)\n\nwith gradle\n```GRADLE \ncompile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'\n```\n\nAssuming you have installed jCenter provider:\n```GRADLE\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n```\n\nor just import `ChipsLayoutManager` module to your project.\n\n### Features\nLayout manager represents chips or spanned or \"bubble\" structure of list items and is a good replace for typical implementations of such issue based on spans in `TextView` \nor custom `FlowLayout`s.\n\n* supports `RecyclerView`'s/`LayoutManager`'s features, such as default animations while CRUD items \u0026 custom `ItemAnimator`s, `ItemDecorator`s, scrolling etc. `wrap_content` of height is supported\n* vertical scrolling is supported. Horizontal scrolling isn't supported. It is possible to disable vertical scrolling as well. Supported padding/margin, clipToPadding parameter of `RecyclerView`\n* supports different height and width of items\n* recycling items support (another advantage over `TextView` approach)\n* items gravity inside row support. For all items or only for required ones\n* LTR and RTL support\n* activity orientation change support\n* predictive animations supported (animate view movement outside of visible bounds)\n* setting max count of view in row\n* you are able to break row due to your conditions\n* justified views in row with spaces or additional view size\n\n| Insert/delete | Move |\n|---|---|\n|![Insert/delete animations with ChipsLayoutManager](/images/insert_delete_animations.gif) |![Move animations with ChipsLayoutManager](/images/move_animations.gif)|\n\n####Layout Directions\n\u003ccenter\u003e\n\n|  | Left to Right  | Right to Left  |\n|---|---|---|\n|  \u003cb\u003eHorizontal\u003c/b\u003e |![Left to Right Rows implementation of ChipsLayoutManager](/images/ltr_horizontal.png) |![Right to Left implementation of ChipsLayoutManager](/images/rtl_horizontal.png)|\n|  \u003cb\u003eVertical\u003c/b\u003e   |![Left to Right Columns implementation of ChipsLayoutManager](/images/ltr_vertical.png) ||\n\n\u003c/center\u003e\n\n####Fill strategy\nAny row has some space left, where is impossible to place the next view, because that space is too small.\nBut we could distribute that space for available views in that row.\n\nRow strategy is a mode of distribution left space.\n\n* `STRATEGY_DEFAULT` - is used by default. Left space is placed at the end of the row.\n* `STRATEGY_FILL_VIEW` - available space is distributed among views.\n* `STRATEGY_FILL_SPACE` - available space is distributed among spaces between views, start \u0026 end views are docked to a nearest border.\n* `STRATEGY_CENTER` - available space is distributed among spaces between views, start \u0026 end spaces included. Views are placed in center of canvas.\n* `STRATEGY_CENTER_DENSE` - Views are placed in center of canvas. There is no extra space distributed between views.\n\nIn such layouts by default last row isn't considered completed. So strategy isn't applied for last row.\nBut you can also enable opposite behaviour.\n\n### Usage\n\n```JAVA \nChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder()\n        //set vertical gravity for all items in a row. Default = Gravity.CENTER_VERTICAL\n        .setChildGravity(Gravity.TOP)\n        //whether RecyclerView can scroll. TRUE by default\n        .setScrollingEnabled(true)\n        //set maximum views count in a particular row\n        .setMaxViewsInRow(2)\n        //set gravity resolver where you can determine gravity for item in position. \n        //This method have priority over previous one\n        .setGravityResolver(new IChildGravityResolver() {\n            @Override\n            public int getItemGravity(int position) {\n                return Gravity.CENTER;\n            }\n        })\n        //you are able to break row due to your conditions. Row breaker should return true for that views\n        .setRowBreaker(new IRowBreaker() {\n            @Override\n            public boolean isItemBreakRow(@IntRange(from = 0) int position) {\n                return position == 6 || position == 11 || position == 2;\n            }\n        })\n        //a layoutOrientation of layout manager, could be VERTICAL OR HORIZONTAL. HORIZONTAL by default\n        .setOrientation(ChipsLayoutManager.HORIZONTAL)\n        // row strategy for views in completed row, could be STRATEGY_DEFAULT, STRATEGY_FILL_VIEW, \n        //STRATEGY_FILL_SPACE or STRATEGY_CENTER\n        .setRowStrategy(ChipsLayoutManager.STRATEGY_FILL_SPACE)\n        // whether strategy is applied to last row. FALSE by default\n        .withLastRow(true)\n        .build();\nrv.setLayoutManager(chipsLayoutManager);\n```\n\nNotice that if you changed gravity resolver or row breaker conditions in runtime - it won't affect already drown items and cached item positions.\nYou have to call `notifyItemChanged` on `ChipsLayoutManager` otherwise layout won't be predictable. \n\n**Device current direction** have been chosen by default.\nYou can manipulate with layout direction (**LTR** or **RTL**)\u003cbr/\u003e\n_On Api \u003e= 17:_\n```XML\n\u003candroid.support.v7.widget.RecyclerView\n       android:layout_width=\"match_parent\"\n       android:layout_height=\"match_parent\"\n       android:layoutDirection=\"rtl\"\n       /\u003e\n```\nor programmatically (_on all supported Api:_):\n```JAVA\nViewCompat.setLayoutDirection(recyclerView, ViewCompat.LAYOUT_DIRECTION_RTL);\n```\n\nFor example look at sample application.\n\u003cbr /\u003e\n### Bonus\nYou may need an `RecyclerView.ItemDecoration` to work with `ChipsLayoutManager` for fast setup as showed in sample. \u003cbr/\u003e\nIt contained in same package and named `SpacingItemDecoration`.\n\n## Support [ ![Maintained](https://img.shields.io/maintenance/yes/2017.svg) ](https://github.com/BelooS/ChipsLayoutManager/tree/dev)\nBETA is going.\nI respond to your founded issues. Just create a ticket if you found something goes wrong.\u003cbr/\u003e\nThanks for testing, guys. I'm really appreciate it.\n\n### Contributors\nAll pull requests are welcome. I've tried to make code clean \u0026 readable, so the next is up to you.\nI appreciate any help and contributors will be mentioned here.\n\nThanks, [szijpeter](https://github.com/szijpeter) and everyone for valuable updates.\n\n### Known issues\nI create issues in tracking board of known problems.\nThese issues are going to be fixed in next versions.\n\n### License [ ![license for ChipsLayoutManager](https://img.shields.io/hexpm/l/plug.svg) ](https://github.com/BelooS/ChipsLayoutManager/blob/dev/LICENSE)\n\n    Copyright 2016 Beloy Oleg, Ukraine.\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","funding_links":[],"categories":["Java","TagView"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBelooS%2FChipsLayoutManager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBelooS%2FChipsLayoutManager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBelooS%2FChipsLayoutManager/lists"}