{"id":13642859,"url":"https://github.com/tsunhua/StickyRecyclerSettingView","last_synced_at":"2025-04-20T21:31:43.293Z","repository":{"id":129847215,"uuid":"72642466","full_name":"tsunhua/StickyRecyclerSettingView","owner":"tsunhua","description":"A Fast Way to build a SettingActivity with RecyclerView on Android","archived":false,"fork":false,"pushed_at":"2016-11-30T07:21:33.000Z","size":452,"stargazers_count":63,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T10:06:33.783Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsunhua.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,"roadmap":null,"authors":null}},"created_at":"2016-11-02T13:28:35.000Z","updated_at":"2024-03-11T14:43:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"ae17e6a5-acd5-4149-af3b-dec276473029","html_url":"https://github.com/tsunhua/StickyRecyclerSettingView","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/tsunhua%2FStickyRecyclerSettingView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsunhua%2FStickyRecyclerSettingView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsunhua%2FStickyRecyclerSettingView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsunhua%2FStickyRecyclerSettingView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsunhua","download_url":"https://codeload.github.com/tsunhua/StickyRecyclerSettingView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249965542,"owners_count":21352922,"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-08-02T01:01:37.339Z","updated_at":"2025-04-20T21:31:42.829Z","avatar_url":"https://github.com/tsunhua.png","language":"Java","funding_links":[],"categories":["RecyclerView"],"sub_categories":[],"readme":"# StickyRecyclerSettingView\n\nEffect \n--------\n\n![](https://github.com/LinLshare/StickyRecyclerSettingView/blob/master/img/effect.gif?raw=true)\n\nUse\n--------\n\nAt first, clone the project and run the demo;\nSecondly, copy the code to your project and modify it to adapt your business.\n\nHere are the common way to setup setting view:\n\n#### 1. New a SettingRecyclerAdapter \n\n```java\nSettingRecyclerAdapter settingRecyclerAdapter= new SettingRecyclerAdapter();\n```\n\n#### 2. Define Settings.xml\n\nlike this: [settings.xml](https://github.com/LinLshare/StickyRecyclerSettingView/blob/master/app/src/main/res/xml/settings.xml)\n\n```xml\n\u003csettings xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n  \u003cheader\n        name=\"Normal Setting\"/\u003e\n  \u003citem\n      android:id=\"@+id/id\"\n      name=\"ID\"\n      secondaryTxt=\"23333\"/\u003e\n  \u003citem\n      android:id=\"@+id/name\"\n      name=\"Name\"\n      secondaryTxt=\"Lshare\"/\u003e\n   ...\n\u003c/settings\u003e\n```\n\n#### 3. Parse xml file and add data to adapter\n\nuse XmlResourceParser to parse the xml file you defined before(like this: [SettingActivity#loadData](https://github.com/LinLshare/StickyRecyclerSettingView/blob/master/app/src/main/java/io/github/linlshare/settingstickyrecyclerview/SettingActivity.java#L54)), and then call `settingRecyclerAdapter.addAll(settingItemList);` to add them to adapter.\n\n#### 4. SetItemClickListener\n\nJust call `settingRecyclerAdapter.setOnItemClickListener(this);` and then handle the event like follow:\n\n```java\n@Override public void onItemClick(int id, SettingItem item) {\n  Util.toast(this, item);\n  if (id == R.id.name) {\n    settingRecyclerAdapter.updateSecondaryText(id, \"Here it go\");\n  }\n}\n```\n#### 5. RecyclerView Setup\n\n```java\nrecyclerView.setLayoutManager(\n\tnew LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));\nrecyclerView.setAdapter(settingRecyclerAdapter);\nrecyclerView.addItemDecoration(new PinnedHeaderItemDecoration());\n```\n\nThanks To\n--------\n\n- AdapterDelegates: https://github.com/sockeqwe/AdapterDelegates\n- pinned-section-item-decoration: https://github.com/takahr/pinned-section-item-decoration\n \nLicense\n--------\n\n    Copyright 2016 Lshare\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%2Ftsunhua%2FStickyRecyclerSettingView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsunhua%2FStickyRecyclerSettingView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsunhua%2FStickyRecyclerSettingView/lists"}