Search in sources :

Example 6 with SectionedRecyclerViewAdapter

use of com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter in project bilibili-android-client by HotBitmapGG.

the class AdvertisingActivity method initRecyclerView.

@Override
public void initRecyclerView() {
    mSectionedRecyclerViewAdapter = new SectionedRecyclerViewAdapter();
    GridLayoutManager mLayoutManager = new GridLayoutManager(AdvertisingActivity.this, 2);
    mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            switch(mSectionedRecyclerViewAdapter.getSectionItemViewType(position)) {
                case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER:
                    return 2;
                default:
                    return 1;
            }
        }
    });
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mSectionedRecyclerViewAdapter);
    setRecycleNoScroll();
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SectionedRecyclerViewAdapter(com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter)

Example 7 with SectionedRecyclerViewAdapter

use of com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter in project bilibili-android-client by HotBitmapGG.

the class RegionTypeRecommendFragment method initRecyclerView.

@Override
protected void initRecyclerView() {
    mSectionedRecyclerViewAdapter = new SectionedRecyclerViewAdapter();
    GridLayoutManager mLayoutManager = new GridLayoutManager(getActivity(), 2);
    mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            switch(mSectionedRecyclerViewAdapter.getSectionItemViewType(position)) {
                case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER:
                    return 2;
                default:
                    return 1;
            }
        }
    });
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mSectionedRecyclerViewAdapter);
    setRecycleNoScroll();
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SectionedRecyclerViewAdapter(com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)7 SectionedRecyclerViewAdapter (com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter)7