@Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // This is RecyclerViewWrapperAdapter. Checkout at
    // https://github.com/henrytao-me/recyclerview-multistate-section-endless-adapter
    RecyclerView.Adapter adapter =
        new SimpleRecyclerViewAdapter(new SimpleAdapter<>(getSampleData(), null)) {
          @Override
          public RecyclerView.ViewHolder onCreateFooterViewHolder(
              LayoutInflater layoutInflater, ViewGroup viewGroup) {
            return null;
          }

          @Override
          public RecyclerView.ViewHolder onCreateHeaderViewHolder(
              LayoutInflater layoutInflater, ViewGroup viewGroup) {
            return new HeaderHolder(layoutInflater, viewGroup, R.layout.item_header_spacing);
          }
        };
    vRecyclerView.hasFixedSize();
    vRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    vRecyclerView.setAdapter(adapter);

    int actionBarSize = ResourceUtils.getActionBarSize(getContext());
    int progressViewStart =
        getResources().getDimensionPixelSize(R.dimen.app_bar_height) - actionBarSize;
    int progressViewEnd = progressViewStart + (int) (actionBarSize * 1.5f);
    vSwipeRefreshLayout.setProgressViewOffset(true, progressViewStart, progressViewEnd);
    vSwipeRefreshLayout.setOnRefreshListener(this);
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // This is RecyclerViewWrapperAdapter. Checkout at
    // https://github.com/henrytao-me/recyclerview-multistate-section-endless-adapter
    RecyclerView.Adapter adapter =
        new SimpleRecyclerViewAdapter(
            new SimpleAdapter<>(getSampleData(getArgTitle(), getArgCount()), null)) {
          @Override
          public RecyclerView.ViewHolder onCreateFooterViewHolder(
              LayoutInflater layoutInflater, ViewGroup viewGroup) {
            return null;
          }

          @Override
          public RecyclerView.ViewHolder onCreateHeaderViewHolder(
              LayoutInflater layoutInflater, ViewGroup viewGroup) {
            int headerLayout = getArgHeaderLayout();
            if (headerLayout > 0) {
              return new HeaderHolder(layoutInflater, viewGroup, headerLayout);
            }
            return null;
          }
        };
    vRecyclerView.hasFixedSize();
    vRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    vRecyclerView.setAdapter(adapter);
  }
コード例 #3
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    vRecyclerView.hasFixedSize();
    vRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    vRecyclerView.setAdapter(new SimpleAdapter<>(getSampleData(), null));
  }
コード例 #4
0
 @Test
 public void testSetUpRecyclerView() throws NoSuchFieldException, IllegalAccessException {
   assertTrue(recyclerView.hasFixedSize());
   assertTrue(recyclerView.getLayoutManager() != null);
   assertTrue(adapter != null);
 }