Giter Club home page Giter Club logo

lrecyclerview's Introduction

lrecyclerview

pull to refresh and load more recyclerview

your header or footer or empty doing this

public class SimpleFooter extends FooterWrapper {

		public SimpleFooter(Context context) {
    	super(context);
	}
	....
}

your activity write as this

public class LRecyclerViewActivity extends Activity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	LrecyclerView recycler = (LRecyclerView) findViewById(R.id.recycler);
	GridLayoutManager manager = new GridLayoutManager(this,2);
	recycler.setLayoutManager(manager);
	SparseIntArray layouts = new SparseIntArray();
	layouts.put(1,R.layout.img_item);
	layouts.put(2,R.layout.text_item);
	recycler.setAdapter(new MultiTypeAdapter<String>().list(list)
		.generator(new LAdapter.TypeGenerator<MultiTypeAdapter<String>>() {\n
			@Override
			public int generate(MultiTypeAdapter<String> adapter, int position) {
				return position % 3 == 0 ? position % 2 == 0 ? 1 : 2 : 1;
				}
				}).layouts(layouts).binder(new LAdapter.TypeBinder<MultiTypeAdapter<String>>() {
				@Override            
				public void bind(MultiTypeAdapter<String> adapter, LHolder holder, int position, int viewType) { 
					if (viewType == 1){
						holder.setImage(R.id.img,R.mipmap.ic_launcher);
					}else {
						holder.setText(R.id.text,position + "");
					}
				}
			}));
	recycler.setRefreshEnable(true);
	recycler.setHeader(new SimpleHeader(this));
	recycler.addRefreshListener(this);
	recycler.setLoadEnable(true);
	SimpleFooter simpleFooter = new SimpleFooter(this);
	recycler.setFooter(simpleFooter);
	recycler.setMode(LRecyclerView.LOAD_MODE_DEFAULT);
	recycler.setComputeBottom(3);
	SimpleEmpty simpleEmpty = new SimpleEmpty(this);
	recycler.setEmpty(simpleEmpty);
	}
}

Download

dependencies {
	compile 'leicher:lrecyclerview:1.0.1'
}

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.