Coder Social home page Coder Social logo

yippeeapp / xrecyclerview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xrecyclerview/xrecyclerview

0.0 2.0 0.0 6.21 MB

a RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

Java 100.00%

xrecyclerview's Introduction

XRecyclerView

a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need to implement a special adapter . Screenshots

demo

on real device it is much more smoother. Usage

##gradle

compile 'com.jcodecraeer:xrecyclerview:1.2.2'

just like a standard RecyclerView

LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(mAdapter);

##pull to refresh and load more the pull to refresh and load more featrue is enabled by default. we provide a callback to trigger the refresh and LoadMore event.

 mRecyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {
    @Override
    public void onRefresh() {
       //refresh data here
    }

    @Override
    public void onLoadMore() {
       // load more data here
    }
});

and of course you have to tell our RecyclerView when the refreshing or loading more work is done. you can use

mRecyclerView.loadMoreComplete();

to notify that the loading more work is done. and

 mRecyclerView.refreshComplete();

to notify that the refreshing work is done.

here is what we get:

default

###custom refresh and loading more style pull refresh and loading more style is highly customizable.

custom loading style

the loading effect we use the AVLoadingIndicatorView . and it is built in(make a little change). we provide all the effect in AVLoadingIndicatorView library besides we add a system style. you can call

mRecyclerView.setRefreshProgressStyle(int style);

and

mRecyclerView.setLaodingMoreProgressStyle(int style);

to set the RefreshProgressStyle and LaodingMoreProgressStyle respectively.

for example

mRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);

refreshloadingballspinfade

mRecyclerView.setLaodingMoreProgressStyle(ProgressStyle.SquareSpin);

loadingmoresquarespin

BallPulse effect

BallPulse

all the effect can be get in the ProgressStyle class

public class ProgressStyle {
    public static final int SysProgress=-1;
    public static final int BallPulse=0;
    public static final int BallGridPulse=1;
    public static final int BallClipRotate=2;
    public static final int BallClipRotatePulse=3;
    public static final int SquareSpin=4;
    public static final int BallClipRotateMultiple=5;
    public static final int BallPulseRise=6;
    public static final int BallRotate=7;
    public static final int CubeTransition=8;
    public static final int BallZigZag=9;
    public static final int BallZigZagDeflect=10;
    public static final int BallTrianglePath=11;
    public static final int BallScale=12;
    public static final int LineScale=13;
    public static final int LineScaleParty=14;
    public static final int BallScaleMultiple=15;
    public static final int BallPulseSync=16;
    public static final int BallBeat=17;
    public static final int LineScalePulseOut=18;
    public static final int LineScalePulseOutRapid=19;
    public static final int BallScaleRipple=20;
    public static final int BallScaleRippleMultiple=21;
    public static final int BallSpinFadeLoader=22;
    public static final int LineSpinFadeLoader=23;
    public static final int TriangleSkewSpin=24;
    public static final int Pacman=25;
    public static final int BallGridBeat=26;
    public static final int SemiCircleSpin=27;
}

refresh arrow icon

we provide a default arrow icon:

ic_pulltorefresh_arrow

but if you don't like it,you can replace it with any other icon you want. just call

mRecyclerView.setArrowImageView(R.drawable.iconfont_downgrey);

customarrow ###disable refresh and load more featrue if you don't want the refresh and load more featrue(in that case,you probably dont'n need the lib neither),you can call

mRecyclerView.setPullRefreshEnabled(false);

and

mRecyclerView.setPullRefreshEnabled(true);

in which false means disabled ,true means enabled. ##Header you can add header to XRecyclerView,just call addHeaderView().

View header =   LayoutInflater.from(this).inflate(R.layout.recyclerview_header, (ViewGroup)findViewById(android.R.id.content),false);
mRecyclerView.addHeaderView(header);

if you like ,you can add two header

View header =   LayoutInflater.from(this).inflate(R.layout.recyclerview_header, (ViewGroup)findViewById(android.R.id.content),false);
View header1 =   LayoutInflater.from(this).inflate(R.layout.recyclerview_header1, (ViewGroup)findViewById(android.R.id.content),false);
mRecyclerView.addHeaderView(header);
mRecyclerView.addHeaderView(header1);

xrecyclerview's People

Contributors

jianghejie avatar

Watchers

Chew Chit Siang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.