@Test public void getItemViewType() { adapter.setItems(Collections.singletonList(new BadgeAssertion())); adapter.setPageLoading(true); assertThat(adapter.getItemViewType(0)).isEqualTo(AccomplishmentListAdapter.RowType.ITEM); assertThat(adapter.getItemViewType(1)).isEqualTo(AccomplishmentListAdapter.RowType.PROGRESS); }
@Override public int getItemViewType(int position) { if (isProgressVisible && position == getItemCount() - 1) { return RowType.PROGRESS; } return RowType.ITEM; }
AccomplishmentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Override public int getItemViewType(int position) { if (isProgressVisible && position == getItemCount() - 1) { return RowType.PROGRESS; } return RowType.ITEM; } }
AccomplishmentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Override public int getItemViewType(int position) { if (isProgressVisible && position == getItemCount() - 1) { return RowType.PROGRESS; } return RowType.ITEM; } AccomplishmentListAdapter(@NonNull String imageUrlPrefix, @NonNull Listener listener); }
AccomplishmentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Override public int getItemViewType(int position) { if (isProgressVisible && position == getItemCount() - 1) { return RowType.PROGRESS; } return RowType.ITEM; } AccomplishmentListAdapter(@NonNull String imageUrlPrefix, @NonNull Listener listener); void setSharingEnabled(boolean enableSharing); @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override int getItemViewType(int position); @Override void onBindViewHolder(RecyclerView.ViewHolder holder, int position); @Override int getItemCount(); void setItems(@NonNull List<BadgeAssertion> newItems); void setPageLoading(boolean visible); }
AccomplishmentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Override public int getItemViewType(int position) { if (isProgressVisible && position == getItemCount() - 1) { return RowType.PROGRESS; } return RowType.ITEM; } AccomplishmentListAdapter(@NonNull String imageUrlPrefix, @NonNull Listener listener); void setSharingEnabled(boolean enableSharing); @Override RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType); @Override int getItemViewType(int position); @Override void onBindViewHolder(RecyclerView.ViewHolder holder, int position); @Override int getItemCount(); void setItems(@NonNull List<BadgeAssertion> newItems); void setPageLoading(boolean visible);  }