Search in sources :

Example 1 with HomeRegionItemAdapter

use of com.hotbitmapgg.bilibili.adapter.HomeRegionItemAdapter 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;
        }
    });
}
Also used : HomeRegionItemAdapter(com.hotbitmapgg.bilibili.adapter.HomeRegionItemAdapter) RegionTypesInfo(com.hotbitmapgg.bilibili.entity.region.RegionTypesInfo) GameCentreActivity(com.hotbitmapgg.bilibili.module.entry.GameCentreActivity) GridLayoutManager(android.support.v7.widget.GridLayoutManager) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 HomeRegionItemAdapter (com.hotbitmapgg.bilibili.adapter.HomeRegionItemAdapter)1 RegionTypesInfo (com.hotbitmapgg.bilibili.entity.region.RegionTypesInfo)1 GameCentreActivity (com.hotbitmapgg.bilibili.module.entry.GameCentreActivity)1