All Projects → thibseisel → recyclerfragment

thibseisel / recyclerfragment

Licence: MIT license
An Android Fragment that displays a set of items in a RecyclerView.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to recyclerfragment

Recyclerstickyheaderview
Sticky header view or suspending view for RecyclerView.
Stars: ✭ 347 (+2068.75%)
Mutual labels:  recyclerview, android-ui
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+34481.25%)
Mutual labels:  recyclerview, android-ui
Scrollingpagerindicator
Pager indicator inspired by Instagram. Lightweight and easy to set up.
Stars: ✭ 419 (+2518.75%)
Mutual labels:  recyclerview, android-ui
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+18200%)
Mutual labels:  recyclerview, android-ui
Easyadapter
Recyclerview adapter library- Create adapter in just 3 lines of code
Stars: ✭ 122 (+662.5%)
Mutual labels:  recyclerview, android-ui
Fastadapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Stars: ✭ 3,512 (+21850%)
Mutual labels:  recyclerview, android-ui
Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+3762.5%)
Mutual labels:  recyclerview, android-ui
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (+675%)
Mutual labels:  recyclerview, android-ui
Multilinedivider
Multi divider in RecyclerView on Android.
Stars: ✭ 13 (-18.75%)
Mutual labels:  recyclerview, android-ui
Androidveil
🎭 An easy, flexible way to implement veil skeletons and shimmering effect for Android.
Stars: ✭ 792 (+4850%)
Mutual labels:  recyclerview, android-ui
RecyclerELE
Android Library for easy addition of Empty, Loading and Error views in a RecyclerView
Stars: ✭ 27 (+68.75%)
Mutual labels:  recyclerview, android-ui
Notzz App
📝 A Simple Note-Taking App built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, State Flow, Hilt-Dependency Injection, Jetpack DataStore, Architecture Components, MVVM, Room, Material Design Components).
Stars: ✭ 158 (+887.5%)
Mutual labels:  recyclerview, android-ui
CeilingLayout
CeilingLayout用来控制子View的吸顶联滑,理论上支持实现了NestedScrollingChild的联滑控件,如NestedScrollView、RecyclerView、SmartRefreshLayout等;只需要在xml里配置需要吸顶子View的位置索引就能自动实现吸顶联滑效果。
Stars: ✭ 26 (+62.5%)
Mutual labels:  recyclerview, android-ui
Stacklayoutmanager
customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
Stars: ✭ 343 (+2043.75%)
Mutual labels:  recyclerview, android-ui
android-tableview-kotlin
Android's missing TableView component.
Stars: ✭ 40 (+150%)
Mutual labels:  recyclerview, android-ui
Androidribbon
🎀 The simple way to implement a beautiful ribbon with the shimmering on Android.
Stars: ✭ 502 (+3037.5%)
Mutual labels:  recyclerview, android-ui
movie-booking
An example for booking movie seat, combined of Android Data Binding, State Design Pattern and Multibinding + Autofactory. iOS version is: https://github.com/lizhiquan/MovieBooking
Stars: ✭ 80 (+400%)
Mutual labels:  recyclerview, android-ui
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+4575%)
Mutual labels:  recyclerview, android-ui
Carouselrecyclerview
Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.
Stars: ✭ 107 (+568.75%)
Mutual labels:  recyclerview, android-ui
Pageindicator
An Instagram like page indicator compatible with RecyclerView and ViewPager.
Stars: ✭ 236 (+1375%)
Mutual labels:  recyclerview, android-ui

JCenter

RecyclerFragment is a small Android library that allow you to display RecyclerView data in a Fragment. Easy to use, it is similar to the framework's ListFragment with additional features.

Download

The library is available through jCenter. You just have to include the dependency in your build.gradle file :

dependencies {
    compile 'fr.nihilus:recyclerfragment:x.y.z'
}

Features

  • Fragment with a RecyclerView and a hideable ProgressBar out of the box
  • Ability to show the ProgressBar when waiting for asynchronous data
  • Customizable layout
  • Support for an "empty view" to be displayed automatically in place of RecyclerView when the adapter contains no data.

How to use

The preferred way to use RecyclerFragment is to extend it to add your behavior in onActivityCreated(Bundle).

The following example show you how to use RecyclerFragment when loading data asynchronously :

public class MyFragment extends RecyclerFragment {

    private MyAdapter mAdapter;

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mAdapter = new MyAdapter();

        // You have to set your adapter with the following method
        setAdapter(adapter);

        // Like ListFragment, the RecyclerView is hidden by default.
        // Setting the adapter with setAdapter(adapter) will display it.
        // Since we load data asynchronously, we want to show
        // the progress indicator while loading.
        setRecyclerShown(false);

        // Load some data asynchronously
        new AsyncTask<Void, Void, String[]>() {

            @Override
            protected String[] doInBackground(Void... params) {
                return dataLoadedFromNetwork();
            }

            @Override
            protected void onPostExecute(String[] result) {
                // Update data in our adapter
                mAdapter.setData(result);
                mAdapter.notifyDataSetChanged();

                // Stop showing the progress indicator
                setRecyclerShown(true);
            }

        }.execute();
    }
}

Note that the progress indicator won't we shown if your data is loaded in less than 500 ms. This is an expected behavior: similarly to ContentLoadingProgressBar, the progress indicator is only shown if it will be displayed a sufficient amount of time to avoid UI "flashes".

Using a custom layout

You may need to customize the layout of RecyclerFragment. All you have to do is to override onCreateView and inflate your custom view hierarchy. Howether, your layout has to meet the following criterias:

  • It must contain a RecyclerView with id @id/recycler
  • It must contain any View with id @id/progress to be displayed when the RecyclerView is hidden by setRecyclerShown(false).

You may optionally specify a View to be automatically displayed in place of the RecyclerView when the adapter is empty: just mark it with the id @id/empty.

The following is an example of custom layout for RecyclerFragment:

fragment_custom.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/parent"
             xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <ProgressBar
        android:id="@id/progress"
        style="?android:progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:visibility="gone"/>

    <FrameLayout
        android:id="@id/recycler_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@id/recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"/>

        <TextView
            android:id="@id/empty"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="No items to display."
            android:textAppearance="@style/TextAppearance.AppCompat.Large"
            android:layout_gravity="center"/>
    </FrameLayout>
</FrameLayout>

MyFragment.java

public class MyFragment extends RecyclerFragment {

    @NonNull
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_custom, container, false);
    }
}

Don't forget to set your LayoutManager in XML or via setLayoutManager(RecyclerView.LayoutManager), as only the default implementation uses a LinearLayoutManager when no other is provided.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].