Skip to content

RecyclerView is a most useful view in the daily development, so try to master it.

Notifications You must be signed in to change notification settings

tanhuang01/master_recycler

Repository files navigation

master_recycler

1.PagedAdapter and SelectedAdapter.

     A PagedAdapter is used to add a function to the RecyclerView that when it slide to the bottom, load another page data to show. while a SelectedAdapter is used to add a function to a RecyclerView that if its a item is clicked, the backgrand of the item will change to selected state.
     The both proxy adapter are decoupled from the orignal normal adapter, which hold the data set.
     Relating classes are in the _5_page_selected package.

     You can use the adapters like this: (May be you should add another more code to initalize a RecyclerView, just as the Activity5.java shows)

        adapter = new NormalAdapter5();
        selectedAdapter = new SelectedAdapter5(adapter);
        pageAdapter = new PageAdapter5(selectedAdapter);
        
        recyclerView.setAdapter(pageAdapter);
        recyclerView.addOnScrollListener(new LoadMoreScrollListener5() {
            @Override
            public void loadMore(int loadedItem, int pageSize) {
                // load next page data
                presenter.loadMore(loadedItem, pageSize);
            }
        });
        
        // load first page data
        presenter.loadMore(0, pageAdapter.pageSize());

     And the app show:

load paged data and high-light selected item

About

RecyclerView is a most useful view in the daily development, so try to master it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages