Search in sources :

Example 76 with GridLayoutManager

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;
        }
    });
}
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)

Example 77 with GridLayoutManager

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);
}
Also used : LiveAppIndexAdapter(com.hotbitmapgg.bilibili.adapter.LiveAppIndexAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Example 78 with GridLayoutManager

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();
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SectionedRecyclerViewAdapter(com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter)

Example 79 with GridLayoutManager

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) -> {
    });
}
Also used : NewBangumiSerialAdapter(com.hotbitmapgg.bilibili.adapter.NewBangumiSerialAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Example 80 with GridLayoutManager

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);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SectionedRecyclerViewAdapter(com.hotbitmapgg.bilibili.widget.sectioned.SectionedRecyclerViewAdapter)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)292 RecyclerView (android.support.v7.widget.RecyclerView)135 View (android.view.View)76 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)73 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)44 TextView (android.widget.TextView)39 BindView (butterknife.BindView)19 Toolbar (android.support.v7.widget.Toolbar)16 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)14 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)14 Nullable (android.support.annotation.Nullable)13 ImageView (android.widget.ImageView)13 ArrayList (java.util.ArrayList)13 Intent (android.content.Intent)12 Handler (android.os.Handler)12 Bundle (android.os.Bundle)11 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)11 SuppressLint (android.annotation.SuppressLint)10 Context (android.content.Context)10 Point (android.graphics.Point)9