Search in sources :

Example 1 with Eyepetizer2Adapter

use of com.xxx.ency.view.eyepetizer.adapter.Eyepetizer2Adapter 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)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 PagerSnapHelper (android.support.v7.widget.PagerSnapHelper)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 Eyepetizer2Adapter (com.xxx.ency.view.eyepetizer.adapter.Eyepetizer2Adapter)1 EyepetizerAdapter (com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter)1