use of android.support.v7.widget.GridLayoutManager in project bilibili-android-client by HotBitmapGG.
the class HomeRegionFragment method initRecyclerView.
@Override
protected void initRecyclerView() {
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
HomeRegionItemAdapter mAdapter = new HomeRegionItemAdapter(mRecyclerView);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener((position, holder) -> {
switch(position) {
case 0:
//直播
startActivity(new Intent(getActivity(), LiveAppIndexActivity.class));
break;
case 1:
//番剧
RegionTypesInfo.DataBean mBangumi = regionTypes.get(1);
RegionTypeDetailsActivity.launch(getActivity(), mBangumi);
break;
case 2:
//动画
RegionTypesInfo.DataBean mAnimation = regionTypes.get(2);
RegionTypeDetailsActivity.launch(getActivity(), mAnimation);
break;
case 3:
//音乐
RegionTypesInfo.DataBean mMuise = regionTypes.get(3);
RegionTypeDetailsActivity.launch(getActivity(), mMuise);
break;
case 4:
//舞蹈
RegionTypesInfo.DataBean mDence = regionTypes.get(4);
RegionTypeDetailsActivity.launch(getActivity(), mDence);
break;
case 5:
//游戏
RegionTypesInfo.DataBean mGame = regionTypes.get(5);
RegionTypeDetailsActivity.launch(getActivity(), mGame);
break;
case 6:
//科技
RegionTypesInfo.DataBean mScience = regionTypes.get(6);
RegionTypeDetailsActivity.launch(getActivity(), mScience);
break;
case 7:
//生活
RegionTypesInfo.DataBean mLife = regionTypes.get(7);
RegionTypeDetailsActivity.launch(getActivity(), mLife);
break;
case 8:
//鬼畜
RegionTypesInfo.DataBean mKichiku = regionTypes.get(8);
RegionTypeDetailsActivity.launch(getActivity(), mKichiku);
break;
case 9:
//时尚
RegionTypesInfo.DataBean mFashion = regionTypes.get(9);
RegionTypeDetailsActivity.launch(getActivity(), mFashion);
break;
case 10:
//广告
startActivity(new Intent(getActivity(), AdvertisingActivity.class));
break;
case 11:
//娱乐
RegionTypesInfo.DataBean mRecreation = regionTypes.get(10);
RegionTypeDetailsActivity.launch(getActivity(), mRecreation);
break;
case 12:
//电影
RegionTypesInfo.DataBean mMovei = regionTypes.get(11);
RegionTypeDetailsActivity.launch(getActivity(), mMovei);
break;
case 13:
//电视剧
RegionTypesInfo.DataBean mTv = regionTypes.get(12);
RegionTypeDetailsActivity.launch(getActivity(), mTv);
break;
case 14:
// 游戏中心
startActivity(new Intent(getActivity(), GameCentreActivity.class));
break;
default:
break;
}
});
}
use of android.support.v7.widget.GridLayoutManager in project bilibili-android-client by HotBitmapGG.
the class LiveAppIndexActivity method initRecyclerView.
@Override
public void initRecyclerView() {
mLiveAppIndexAdapter = new LiveAppIndexAdapter(LiveAppIndexActivity.this);
mRecyclerView.setAdapter(mLiveAppIndexAdapter);
GridLayoutManager layout = new GridLayoutManager(LiveAppIndexActivity.this, 12);
layout.setOrientation(LinearLayoutManager.VERTICAL);
layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return mLiveAppIndexAdapter.getSpanSize(position);
}
});
mRecyclerView.setLayoutManager(layout);
}
use of android.support.v7.widget.GridLayoutManager 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();
}
use of android.support.v7.widget.GridLayoutManager in project bilibili-android-client by HotBitmapGG.
the class NewBangumiSerialActivity method initRecyclerView.
@Override
public void initRecyclerView() {
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new GridLayoutManager(NewBangumiSerialActivity.this, 3));
mAdapter = new NewBangumiSerialAdapter(mRecyclerView, newBangumiSerials, true);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener((position, holder) -> {
});
}
use of android.support.v7.widget.GridLayoutManager 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);
}
Aggregations