Search in sources :

Example 1 with RCVListAdapter

use of com.example.jingbin.cloudreader.view.test.RCVListAdapter in project CloudReader by youlookwhat.

the class SlideScrollViewActivity method initRecyclerView.

private void initRecyclerView() {
    rcvGoodsList.setVisibility(View.VISIBLE);
    final RCVListAdapter adapter = new RCVListAdapter(this);
    View header = new View(this);
    header.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    header.getLayoutParams().height = getResources().getDimensionPixelOffset(R.dimen.new_home_header_size) - getStatusBarHeight(this);
    adapter.setHeader(header);
    rcvGoodsList.setLayoutManager(new LinearLayoutManager(this));
    rcvGoodsList.setItemAnimator(new DefaultItemAnimator());
    rcvGoodsList.setAdapter(adapter);
    adapter.setDataSource(Arrays.asList("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""));
    adapter.notifyDataSetChanged();
    rcvGoodsList.setOnScrollListener(new RecyclerView.OnScrollListener() {

        public int scrolledY = 0;

        @Override
        public void onScrolled(RecyclerView recyclerView, final int dx, final int dy) {
            super.onScrolled(recyclerView, dx, dy);
            scrolledY += dy;
            scrollChangeHeader(scrolledY);
        }
    });
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) DiscoverScrollView(com.example.jingbin.cloudreader.view.DiscoverScrollView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) RCVListAdapter(com.example.jingbin.cloudreader.view.test.RCVListAdapter) LinearLayout(android.widget.LinearLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 DiscoverScrollView (com.example.jingbin.cloudreader.view.DiscoverScrollView)1 RCVListAdapter (com.example.jingbin.cloudreader.view.test.RCVListAdapter)1