{"id":13989453,"url":"https://github.com/cundong/HeaderAndFooterRecyclerView","last_synced_at":"2025-07-22T10:32:41.779Z","repository":{"id":75543010,"uuid":"45250477","full_name":"cundong/HeaderAndFooterRecyclerView","owner":"cundong","description":"A RecyclerView solution, support addHeaderView、addFooterView","archived":false,"fork":false,"pushed_at":"2017-12-27T06:07:36.000Z","size":492,"stargazers_count":1372,"open_issues_count":27,"forks_count":321,"subscribers_count":57,"default_branch":"master","last_synced_at":"2025-05-23T13:22:19.770Z","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/cundong.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-10-30T12:47:33.000Z","updated_at":"2025-03-24T09:12:18.000Z","dependencies_parsed_at":"2023-06-06T20:45:12.491Z","dependency_job_id":null,"html_url":"https://github.com/cundong/HeaderAndFooterRecyclerView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cundong/HeaderAndFooterRecyclerView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cundong%2FHeaderAndFooterRecyclerView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cundong%2FHeaderAndFooterRecyclerView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cundong%2FHeaderAndFooterRecyclerView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cundong%2FHeaderAndFooterRecyclerView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cundong","download_url":"https://codeload.github.com/cundong/HeaderAndFooterRecyclerView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cundong%2FHeaderAndFooterRecyclerView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266475474,"owners_count":23934969,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-09T13:01:39.854Z","updated_at":"2025-07-22T10:32:41.287Z","avatar_url":"https://github.com/cundong.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"## HeaderAndFooterRecyclerView\n\n## Introduction\n\nHeaderAndFooterRecyclerView is a RecyclerView solution that supports addHeaderView, addFooterView to a RecyclerView.\n\nThrough this library, you can implement RecyclerView's Page Loading by dynamically modify the FooterView's State, such as \"loading\", \"loading error\", \"loading success\", \"slipping to the bottom\".\n\n## How to Use It\n\n* Add HeaderView, FooterView\n```java\n    mHeaderAndFooterRecyclerViewAdapter = new HeaderAndFooterRecyclerViewAdapter(mDataAdapter);\n    mRecyclerView.setAdapter(mHeaderAndFooterRecyclerViewAdapter);\n    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));\n\n    //add a HeaderView\n    RecyclerViewUtils.setHeaderView(mRecyclerView, new SampleHeader(this));\n\n    //add a FooterView\n    RecyclerViewUtils.setFooterView(mRecyclerView, new SampleFooter(this));\n```\n* LinearLayout / GridLayout / StaggeredGridLayout layout of RecyclerView paging load\n\n```java\nmRecyclerView.addOnScrollListener(mOnScrollListener);\n```\n\n```java\nprivate EndlessRecyclerOnScrollListener mOnScrollListener = new EndlessRecyclerOnScrollListener() {\n\n        @Override\n        public void onLoadNextPage(View view) {\n            super.onLoadNextPage(view);\n\n            LoadingFooter.State state = RecyclerViewStateUtils.getFooterViewState(mRecyclerView);\n            if(state == LoadingFooter.State.Loading) {\n                Log.d(\"@Cundong\", \"the state is Loading, just wait..\");\n                return;\n            }\n\n            mCurrentCounter = mDataList.size();\n\n            if (mCurrentCounter \u003c TOTAL_COUNTER) {\n                // loading more\n                RecyclerViewStateUtils.setFooterViewState(EndlessLinearLayoutActivity.this, mRecyclerView, REQUEST_COUNT, LoadingFooter.State.Loading, null);\n                requestData();\n            } else {\n                //the end\n                RecyclerViewStateUtils.setFooterViewState(EndlessLinearLayoutActivity.this, mRecyclerView, REQUEST_COUNT, LoadingFooter.State.TheEnd, null);\n            }\n        }\n    };\n```\n\n## Attention\n\nIf you have already added a HeaderView for RecyclerView by ```RecyclerViewUtils.setHeaderView(mRecyclerView, view);``` , then call the ViewHolder 's ```getAdapterPosition()```、```getLayoutPosition()```, ,the returned value will be affected by the addition of the HeaderView (the return position is the real position + headerCounter).\n\nTherefore, in this case, please use: ```RecyclerViewUtils.getAdapterPosition(mRecyclerView, ViewHolder.this)```, ```RecyclerViewUtils.getLayoutPosition(mRecyclerView, ViewHolder.this)```.\n\n## Demo\n\n* Add HeaderView, FooterView\n\n![Screenshots][1]\n\n* Support for ply loading of the LinearLayout layout RecyclerView\n\n![Screenshots][2]\n\n* Support for paging loads of GridLayout layout RecyclerView\n\n![Screenshots][3]\n\n* Supports paging loads of StaggeredGridLayout layout RecyclerView\n\n![Screenshots][4]\n\n* The page load fails when the GridLayout layout is RecyclerView\n\n![Screenshots][5]\n\n\n## License\n\n\u003e Copyright 2015 Cundong\n\u003e \n\u003e Licensed under the Apache License, Version 2.0 (the \"License\"); you\n\u003e may not use this file except in compliance with the License. You may\n\u003e obtain a copy of the License at\n\u003e \n\u003e    http://www.apache.org/licenses/LICENSE-2.0\n\u003e \n\u003e Unless required by applicable law or agreed to in writing, software\n\u003e distributed under the License is distributed on an \"AS IS\" BASIS,\n\u003e WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n\u003e implied. See the License for the specific language governing\n\u003e permissions and limitations under the License.\n\n[1]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art1.png\n[2]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art2.png\n[3]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art3.png\n[4]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art4.png\n[5]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art5.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcundong%2FHeaderAndFooterRecyclerView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcundong%2FHeaderAndFooterRecyclerView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcundong%2FHeaderAndFooterRecyclerView/lists"}