Search in sources :

Example 1 with PullToRefreshAdapter

use of com.chad.baserecyclerviewadapterhelper.adapter.PullToRefreshAdapter in project BaseRecyclerViewAdapterHelper by CymChad.

the class PullToRefreshUseActivity method initAdapter.

private void initAdapter() {
    pullToRefreshAdapter = new PullToRefreshAdapter();
    pullToRefreshAdapter.setOnLoadMoreListener(this, mRecyclerView);
    pullToRefreshAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_LEFT);
    //        pullToRefreshAdapter.setAutoLoadMoreSize(3);
    mRecyclerView.setAdapter(pullToRefreshAdapter);
    mCurrentCounter = pullToRefreshAdapter.getData().size();
    mRecyclerView.addOnItemTouchListener(new OnItemClickListener() {

        @Override
        public void onSimpleItemClick(final BaseQuickAdapter adapter, final View view, final int position) {
            Toast.makeText(PullToRefreshUseActivity.this, Integer.toString(position), Toast.LENGTH_LONG).show();
        }
    });
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) PullToRefreshAdapter(com.chad.baserecyclerviewadapterhelper.adapter.PullToRefreshAdapter) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) CustomLoadMoreView(com.chad.baserecyclerviewadapterhelper.loadmore.CustomLoadMoreView) View(android.view.View)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 PullToRefreshAdapter (com.chad.baserecyclerviewadapterhelper.adapter.PullToRefreshAdapter)1 CustomLoadMoreView (com.chad.baserecyclerviewadapterhelper.loadmore.CustomLoadMoreView)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 OnItemClickListener (com.chad.library.adapter.base.listener.OnItemClickListener)1