Search in sources :

Example 1 with HomeAdapter

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

the class HomeActivity method initAdapter.

private void initAdapter() {
    BaseQuickAdapter homeAdapter = new HomeAdapter(R.layout.home_item_view, mDataList);
    homeAdapter.openLoadAnimation();
    View top = getLayoutInflater().inflate(R.layout.top_view, (ViewGroup) mRecyclerView.getParent(), false);
    homeAdapter.addHeaderView(top);
    mRecyclerView.addOnItemTouchListener(new OnItemClickListener() {

        @Override
        public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
            Intent intent = new Intent(HomeActivity.this, ACTIVITY[position]);
            startActivity(intent);
        }
    });
    mRecyclerView.setAdapter(homeAdapter);
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) HomeAdapter(com.chad.baserecyclerviewadapterhelper.adapter.HomeAdapter) Intent(android.content.Intent) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

Intent (android.content.Intent)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 HomeAdapter (com.chad.baserecyclerviewadapterhelper.adapter.HomeAdapter)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 OnItemClickListener (com.chad.library.adapter.base.listener.OnItemClickListener)1