{"id":21806502,"url":"https://github.com/thibseisel/recyclerfragment","last_synced_at":"2025-10-15T11:17:24.583Z","repository":{"id":129022809,"uuid":"89867068","full_name":"thibseisel/recyclerfragment","owner":"thibseisel","description":"An Android Fragment that displays a set of items in a RecyclerView.","archived":false,"fork":false,"pushed_at":"2018-04-20T08:01:46.000Z","size":330,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T20:16:27.517Z","etag":null,"topics":["android-library","android-ui","jcenter","recyclerview"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thibseisel.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-30T17:50:44.000Z","updated_at":"2024-10-31T02:09:38.000Z","dependencies_parsed_at":"2023-05-02T21:55:32.238Z","dependency_job_id":null,"html_url":"https://github.com/thibseisel/recyclerfragment","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/thibseisel/recyclerfragment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibseisel%2Frecyclerfragment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibseisel%2Frecyclerfragment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibseisel%2Frecyclerfragment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibseisel%2Frecyclerfragment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thibseisel","download_url":"https://codeload.github.com/thibseisel/recyclerfragment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thibseisel%2Frecyclerfragment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279076197,"owners_count":26098105,"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-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["android-library","android-ui","jcenter","recyclerview"],"created_at":"2024-11-27T12:20:08.768Z","updated_at":"2025-10-15T11:17:24.555Z","avatar_url":"https://github.com/thibseisel.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[ ![JCenter](https://api.bintray.com/packages/nihilus/android/recyclerfragment/images/download.svg) ](https://bintray.com/nihilus/android/recyclerfragment/_latestVersion)\n\nRecyclerFragment is a small Android library that allow you to\ndisplay `RecyclerView` data in a `Fragment`. Easy to use, it is similar to\nthe framework's `ListFragment` with additional features.\n\n![](img/todo-demo.gif)\n\n# Download #\nThe library is available through jCenter.\nYou just have to include the dependency in your build.gradle file :\n\n```gradle\ndependencies {\n    compile 'fr.nihilus:recyclerfragment:x.y.z'\n}\n```\n\n# Features #\n\n- Fragment with a `RecyclerView` and a hideable `ProgressBar` out of the box\n- Ability to show the `ProgressBar` when waiting for asynchronous data\n- Customizable layout\n- Support for an \"empty view\" to be displayed automatically in place\nof RecyclerView when the adapter contains no data.\n\n# How to use #\n\nThe preferred way to use RecyclerFragment is to extend it to add\nyour behavior in `onActivityCreated(Bundle)`.\n\nThe following example show you how to use RecyclerFragment when loading\ndata asynchronously :\n\n```java\npublic class MyFragment extends RecyclerFragment {\n\n    private MyAdapter mAdapter;\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        mAdapter = new MyAdapter();\n\n        // You have to set your adapter with the following method\n        setAdapter(adapter);\n\n        // Like ListFragment, the RecyclerView is hidden by default.\n        // Setting the adapter with setAdapter(adapter) will display it.\n        // Since we load data asynchronously, we want to show\n        // the progress indicator while loading.\n        setRecyclerShown(false);\n\n        // Load some data asynchronously\n        new AsyncTask\u003cVoid, Void, String[]\u003e() {\n\n            @Override\n            protected String[] doInBackground(Void... params) {\n                return dataLoadedFromNetwork();\n            }\n\n            @Override\n            protected void onPostExecute(String[] result) {\n                // Update data in our adapter\n                mAdapter.setData(result);\n                mAdapter.notifyDataSetChanged();\n\n                // Stop showing the progress indicator\n                setRecyclerShown(true);\n            }\n\n        }.execute();\n    }\n}\n```\n\nNote that the progress indicator won't we shown if your data is loaded\nin less than 500 ms. This is an expected behavior: similarly to\n`ContentLoadingProgressBar`, the progress indicator is only shown if it\nwill be displayed a sufficient amount of time to avoid UI \"flashes\".\n\n# Using a custom layout #\n\nYou may need to customize the layout of RecyclerFragment.\nAll you have to do is to override `onCreateView` and inflate\nyour custom view hierarchy. Howether, your layout has to meet\nthe following criterias:\n- It must contain a `RecyclerView` with id `@id/recycler`\n- It must contain any `View` with id `@id/progress` to be displayed\nwhen the `RecyclerView` is hidden by `setRecyclerShown(false)`.\n\nYou may optionally specify a `View` to be automatically displayed\nin place of the `RecyclerView` when the adapter is empty:\njust mark it with the id `@id/empty`.\n\nThe following is an example of custom layout for RecyclerFragment:\n\n### fragment_custom.xml ###\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cFrameLayout android:id=\"@+id/parent\"\n             xmlns:android=\"http://schemas.android.com/apk/res/android\"\n             android:layout_width=\"match_parent\"\n             android:layout_height=\"match_parent\"\u003e\n\n    \u003cProgressBar\n        android:id=\"@id/progress\"\n        style=\"?android:progressBarStyleLarge\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"center\"\n        android:visibility=\"gone\"/\u003e\n\n    \u003cFrameLayout\n        android:id=\"@id/recycler_container\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\u003e\n\n        \u003candroid.support.v7.widget.RecyclerView\n            android:id=\"@id/recycler\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:clipToPadding=\"false\"\n            android:paddingTop=\"8dp\"\n            android:paddingBottom=\"8dp\"/\u003e\n\n        \u003cTextView\n            android:id=\"@id/empty\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"No items to display.\"\n            android:textAppearance=\"@style/TextAppearance.AppCompat.Large\"\n            android:layout_gravity=\"center\"/\u003e\n    \u003c/FrameLayout\u003e\n\u003c/FrameLayout\u003e\n```\n\n### MyFragment.java ###\n\n```java\npublic class MyFragment extends RecyclerFragment {\n\n    @NonNull\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,\n                             @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_custom, container, false);\n    }\n}\n```\n\nDon't forget to set your LayoutManager in XML or via\n`setLayoutManager(RecyclerView.LayoutManager)`,\nas only the default implementation uses a `LinearLayoutManager` when\nno other is provided.\n\n# License #\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthibseisel%2Frecyclerfragment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthibseisel%2Frecyclerfragment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthibseisel%2Frecyclerfragment/lists"}