Search in sources :

Example 1 with EyepetizerAdapter

use of com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter in project Ency by xiarunhao123.

the class EyepetizerHotActivity method initialize.

@Override
protected void initialize() {
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTitle("热门排行");
    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    VideoBean hotVideoBean = (VideoBean) bundle.getSerializable("data");
    hotAdapter = new EyepetizerAdapter();
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.setAdapter(hotAdapter);
    hotAdapter.setNewData(hotVideoBean.getItemList());
    hotAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            VideoBean.ItemListBean bean = (VideoBean.ItemListBean) adapter.getData().get(position);
            VideoBean.ItemListBean.DataBeanX beanX = bean.getData();
            Intent intent = new Intent(mContext, EyepetizerDetailActivity.class);
            intent.putExtra("data", beanX);
            mContext.startActivity(intent);
        }
    });
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) BindView(butterknife.BindView) VideoBean(com.xxx.ency.model.bean.VideoBean) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) EyepetizerAdapter(com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter)

Example 2 with EyepetizerAdapter

use of com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter in project Ency by xiarunhao123.

the class EyepetizerFragment method initialize.

@Override
protected void initialize() {
    swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
    swipeRefreshLayout.setRefreshing(true);
    swipeRefreshLayout.setOnRefreshListener(this);
    mPresenter.getVideoData(page, Constants.EYEPETIZER_UDID, "weekly", "256", "XXX");
    mPresenter.getPTP();
    View headerView = getActivity().getLayoutInflater().inflate(R.layout.header_eyepetizer, null);
    recyclerViewTop = headerView.findViewById(R.id.recyclerview_eyepetizer_top);
    tvHot = headerView.findViewById(R.id.txt_hot);
    tvLike = headerView.findViewById(R.id.txt_like);
    llMore = headerView.findViewById(R.id.layout_more);
    llMore.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(mContext, EyepetizerHotActivity.class);
            intent.putExtra("data", hotVideoBean);
            mContext.startActivity(intent);
        }
    });
    hotAdapter = new Eyepetizer2Adapter();
    hotAdapter.setOnItemClickListener(this);
    recyclerViewTop.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
    recyclerViewTop.setAdapter(hotAdapter);
    recyclerViewTop.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            super.onScrollStateChanged(recyclerView, newState);
            switch(newState) {
                case RecyclerView.SCROLL_STATE_DRAGGING:
                    swipeRefreshLayout.setEnabled(false);
                    break;
                case RecyclerView.SCROLL_STATE_IDLE:
                    swipeRefreshLayout.setEnabled(true);
                    break;
            }
        }
    });
    new PagerSnapHelper().attachToRecyclerView(recyclerViewTop);
    dailyAdapter = new EyepetizerAdapter();
    dailyAdapter.setOnItemClickListener(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.setAdapter(dailyAdapter);
    dailyAdapter.addHeaderView(headerView);
    dailyAdapter.setOnLoadMoreListener(this, recyclerView);
}
Also used : PagerSnapHelper(android.support.v7.widget.PagerSnapHelper) Intent(android.content.Intent) Eyepetizer2Adapter(com.xxx.ency.view.eyepetizer.adapter.Eyepetizer2Adapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) EyepetizerAdapter(com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter)

Aggregations

Intent (android.content.Intent)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 BindView (butterknife.BindView)2 EyepetizerAdapter (com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter)2 Bundle (android.os.Bundle)1 PagerSnapHelper (android.support.v7.widget.PagerSnapHelper)1 TextView (android.widget.TextView)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 VideoBean (com.xxx.ency.model.bean.VideoBean)1 Eyepetizer2Adapter (com.xxx.ency.view.eyepetizer.adapter.Eyepetizer2Adapter)1