Search in sources :

Example 1 with SectionedRecyclerViewAdapter

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

the class RegionTypeDetailsFragment method initRecyclerView.

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

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

Example 2 with SectionedRecyclerViewAdapter

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

the class HomeRecommendedFragment method initRecyclerView.

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

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

Example 3 with SectionedRecyclerViewAdapter

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

the class HomeBangumiFragment method initRecyclerView.

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

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

Example 4 with SectionedRecyclerViewAdapter

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

the class SeasonNewBangumiActivity method initRecyclerView.

@Override
public void initRecyclerView() {
    mSectionedRecyclerViewAdapter = new SectionedRecyclerViewAdapter();
    GridLayoutManager mGridLayoutManager = new GridLayoutManager(SeasonNewBangumiActivity.this, 3);
    mGridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

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

Example 5 with SectionedRecyclerViewAdapter

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

the class BangumiScheduleActivity method initRecyclerView.

@Override
public void initRecyclerView() {
    mSectionedAdapter = new SectionedRecyclerViewAdapter();
    GridLayoutManager mLayoutManager = new GridLayoutManager(BangumiScheduleActivity.this, 3);
    mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            switch(mSectionedAdapter.getSectionItemViewType(position)) {
                case SectionedRecyclerViewAdapter.VIEW_TYPE_HEADER:
                    return 3;
                default:
                    return 1;
            }
        }
    });
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mSectionedAdapter);
}
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