{"id":13537521,"url":"https://github.com/XRecyclerView/XRecyclerView","last_synced_at":"2025-04-02T04:30:59.633Z","repository":{"id":54611184,"uuid":"46404729","full_name":"XRecyclerView/XRecyclerView","owner":"XRecyclerView","description":"A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView","archived":false,"fork":false,"pushed_at":"2023-09-11T08:50:57.000Z","size":6529,"stargazers_count":5337,"open_issues_count":243,"forks_count":1262,"subscribers_count":164,"default_branch":"master","last_synced_at":"2024-10-29T15:38:00.125Z","etag":null,"topics":["custom-view","featrue","load-more","pull-refresh","recyclerview"],"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/XRecyclerView.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}},"created_at":"2015-11-18T08:14:22.000Z","updated_at":"2024-10-24T07:25:28.000Z","dependencies_parsed_at":"2022-08-13T21:30:53.453Z","dependency_job_id":"536389f5-a541-4b2f-855b-494e87fb9767","html_url":"https://github.com/XRecyclerView/XRecyclerView","commit_stats":null,"previous_names":["jianghejie/xrecyclerview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRecyclerView%2FXRecyclerView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRecyclerView%2FXRecyclerView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRecyclerView%2FXRecyclerView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRecyclerView%2FXRecyclerView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XRecyclerView","download_url":"https://codeload.github.com/XRecyclerView/XRecyclerView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757026,"owners_count":20828813,"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":["custom-view","featrue","load-more","pull-refresh","recyclerview"],"created_at":"2024-08-01T09:01:00.019Z","updated_at":"2025-04-02T04:30:54.625Z","avatar_url":"https://github.com/XRecyclerView.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# XRecyclerView\na RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView.\nyou don't need to implement a special adapter .qq 群478803619\nScreenshots\n-----------\n![demo](https://github.com/jianghejie/XRecyclerView/blob/master/art/demo.gif)\n\non real device it is much more smoother. \nUsage\n-----\n## gradle\n```groovy\n// 1.6.0 is the main\ncompile 'com.jcodecraeer:xrecyclerview:1.6.0'\n```\njust like a standard RecyclerView\n```java\nLinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());\nlayoutManager.setOrientation(LinearLayoutManager.VERTICAL);\nmRecyclerView.setLayoutManager(layoutManager);\nmRecyclerView.setAdapter(mAdapter);\n```\n## pull to refresh and load more\nthe pull to refresh and load more featrue is enabled by default. we provide a callback to trigger the refresh and LoadMore event.\n```java\n mRecyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {\n    @Override\n    public void onRefresh() {\n       //refresh data here\n    }\n\n    @Override\n    public void onLoadMore() {\n       // load more data here\n    }\n});\n```\nnew function of 1.5.7 version.\n```java\nmRecyclerView\n    .getDefaultRefreshHeaderView() // get default refresh header view\n    .setRefreshTimeVisible(true);  // make refresh time visible,false means hiding\n\n// if you are not sure that you are 100% going to\n// have no data load back from server anymore,do not use this\n@Deprecated\npublic void setEmptyView(View emptyView) {\n    ...\n}\n```\n\nnew function of 1.5.6 version,fixed a memory leak problem,use the code below to release XR's memory\n```java\n// any time,when you finish your activity or fragment,call this below\nif(mRecyclerView != null){\n    mRecyclerView.destroy(); // this will totally release XR's memory\n    mRecyclerView = null;\n}\n```\n\nnew function of 1.5.3 version,you can use XR in the sticky scroll model now,like the code below,the demo activity is 'LinearStickyScrollActivity'\n```java\nfinal View topView = findViewById(R.id.topView);\nfinal View tabView = findViewById(R.id.tabView);\nfinal View content = findViewById(R.id.contentView);\n\nfinal StickyScrollLinearLayout s = findViewById(R.id.StickyScrollLinearLayout);\ns.addOnLayoutChangeListener(\n        new View.OnLayoutChangeListener() {\n            @Override\n            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {\n                if(s.getContentView() != null)\n                    return;\n                // 放在这里是为了等初始化结束后再添加，防止 height 获取 =0\n                // add from here just in case they height==0\n                s.setInitInterface(\n                        new StickyScrollLinearLayout.StickyScrollInitInterface() {\n                            @Override\n                            public View setTopView() {\n                                return topView;\n                            }\n\n                            @Override\n                            public View setTabView() {\n                                return tabView;\n                            }\n\n                            @Override\n                            public View setContentView() {\n                                return content;\n                            }\n                        }\n                );\n            }\n        }\n);\n```\n\ncall notifyItemRemoved or notifyItemInserted, remember to use the functions inside XRecyclerView\n```java\nlistData.remove(pos);\nmRecyclerView.notifyItemRemoved(listData,pos);\n```\n\nand of course you have to tell our RecyclerView when the refreshing or loading more work is done.\nyou can use\n```java\nmRecyclerView.loadMoreComplete();\n```\n\nto control when the item number of the screen is list.size-2,we call the onLoadMore\n\n```java\nmRecyclerView.setLimitNumberToCallLoadMore(2); // default is 1\n```\n\nto notify that the loading more work is done.\nand\n\n```java\n mRecyclerView.refreshComplete();\n```\n\nto notify that the refreshing work is done.\n\nhere is what we get:\n\n![default](https://github.com/jianghejie/XRecyclerView/blob/master/art/default.gif)\n\n## call refresh() manually(I change the previous setRefreshing() method to refresh() )\n\n```java\nmRecyclerView.refresh();\n```\n\n### custom refresh and loading more style\npull refresh and loading more style is highly customizable.\n\n#### custom loading style\nthe loading effect we use the  [AVLoadingIndicatorView](https://github.com/81813780/AVLoadingIndicatorView) . and it is built in(make a little change).\nwe provide all the effect in AVLoadingIndicatorView library besides we add a system style.\nyou can call \n```java\nmRecyclerView.setRefreshProgressStyle(int style);\n```\nand \n```java\nmRecyclerView.setLaodingMoreProgressStyle(int style);\n```\nto set the RefreshProgressStyle and  LaodingMoreProgressStyle respectively.\n\nfor example\n```java\nmRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);\n```\n![refreshloadingballspinfade](https://github.com/jianghejie/XRecyclerView/blob/master/art/refreshloadingballspinfade.gif)\n```java\nmRecyclerView.setLaodingMoreProgressStyle(ProgressStyle.SquareSpin);\n```\n![loadingmoresquarespin](https://github.com/jianghejie/XRecyclerView/blob/master/art/loadingmoresquarespin.gif)\n\n\nBallPulse  effect\n\n![BallPulse](https://github.com/jianghejie/XRecyclerView/blob/master/art/ballpulse.gif)\n\nall the effect can be get in the ProgressStyle class\n\n```java\npublic class ProgressStyle {\n    public static final int SysProgress=-1;\n    public static final int BallPulse=0;\n    public static final int BallGridPulse=1;\n    public static final int BallClipRotate=2;\n    public static final int BallClipRotatePulse=3;\n    public static final int SquareSpin=4;\n    public static final int BallClipRotateMultiple=5;\n    public static final int BallPulseRise=6;\n    public static final int BallRotate=7;\n    public static final int CubeTransition=8;\n    public static final int BallZigZag=9;\n    public static final int BallZigZagDeflect=10;\n    public static final int BallTrianglePath=11;\n    public static final int BallScale=12;\n    public static final int LineScale=13;\n    public static final int LineScaleParty=14;\n    public static final int BallScaleMultiple=15;\n    public static final int BallPulseSync=16;\n    public static final int BallBeat=17;\n    public static final int LineScalePulseOut=18;\n    public static final int LineScalePulseOutRapid=19;\n    public static final int BallScaleRipple=20;\n    public static final int BallScaleRippleMultiple=21;\n    public static final int BallSpinFadeLoader=22;\n    public static final int LineSpinFadeLoader=23;\n    public static final int TriangleSkewSpin=24;\n    public static final int Pacman=25;\n    public static final int BallGridBeat=26;\n    public static final int SemiCircleSpin=27;\n}\n```\n#### refresh arrow icon\nwe provide a default arrow icon:\n\n![ic_pulltorefresh_arrow](https://github.com/jianghejie/XRecyclerView/blob/master/art/ic_pulltorefresh_arrow.png)\n\nbut if you don't like it,you can replace it with any other icon  you want.\njust call\n```java\nmRecyclerView.setArrowImageView(R.drawable.iconfont_downgrey);\n```\n![customarrow](https://github.com/jianghejie/XRecyclerView/blob/master/art/customarrow.gif)\n### disable refresh and load more featrue\nif you don't want the refresh and load more featrue(in that case,you probably dont'n need the lib neither),you can call\n```java\nmRecyclerView.setPullRefreshEnabled(false);\n```\nand\n```java\nmRecyclerView.setPullRefreshEnabled(true);\n```\nin which false means disabled ,true means enabled.\n##Header\nyou can add header to XRecyclerView，just call addHeaderView().\n\n```java\nView header =   LayoutInflater.from(this).inflate(R.layout.recyclerview_header, (ViewGroup)findViewById(android.R.id.content),false);\nmRecyclerView.addHeaderView(header);\n```\nif you like ,you can add two header\n\n```java\nView header =   LayoutInflater.from(this).inflate(R.layout.recyclerview_header, (ViewGroup)findViewById(android.R.id.content),false);\nView header1 =   LayoutInflater.from(this).inflate(R.layout.recyclerview_header1, (ViewGroup)findViewById(android.R.id.content),false);\nmRecyclerView.addHeaderView(header);\nmRecyclerView.addHeaderView(header1);\n```\nLicense\n-------\n\n    Copyright 2015 jianghejie\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\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXRecyclerView%2FXRecyclerView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FXRecyclerView%2FXRecyclerView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXRecyclerView%2FXRecyclerView/lists"}