@Test public void testGetAdapter() { mRecyclerView.setAdapter(mAdapter); RecyclerMixin mixin = new RecyclerMixin(mTemplateLayout, mRecyclerView); assertSame(mAdapter, mixin.getAdapter()); }
public Adapter<? extends ViewHolder> getAdapter() { @SuppressWarnings("unchecked") final RecyclerView.Adapter<? extends ViewHolder> adapter = mRecyclerView.getAdapter(); if (adapter instanceof HeaderAdapter) { return ((HeaderAdapter<? extends ViewHolder>) adapter).getWrappedAdapter(); } return adapter; }
RecyclerMixin implements Mixin { public Adapter<? extends ViewHolder> getAdapter() { @SuppressWarnings("unchecked") final RecyclerView.Adapter<? extends ViewHolder> adapter = mRecyclerView.getAdapter(); if (adapter instanceof HeaderAdapter) { return ((HeaderAdapter<? extends ViewHolder>) adapter).getWrappedAdapter(); } return adapter; } }
RecyclerMixin implements Mixin { public Adapter<? extends ViewHolder> getAdapter() { @SuppressWarnings("unchecked") final RecyclerView.Adapter<? extends ViewHolder> adapter = mRecyclerView.getAdapter(); if (adapter instanceof HeaderAdapter) { return ((HeaderAdapter<? extends ViewHolder>) adapter).getWrappedAdapter(); } return adapter; } RecyclerMixin(@NonNull TemplateLayout layout, @NonNull RecyclerView recyclerView); }
RecyclerMixin implements Mixin { public Adapter<? extends ViewHolder> getAdapter() { @SuppressWarnings("unchecked") final RecyclerView.Adapter<? extends ViewHolder> adapter = mRecyclerView.getAdapter(); if (adapter instanceof HeaderAdapter) { return ((HeaderAdapter<? extends ViewHolder>) adapter).getWrappedAdapter(); } return adapter; } RecyclerMixin(@NonNull TemplateLayout layout, @NonNull RecyclerView recyclerView); void parseAttributes(@Nullable AttributeSet attrs, int defStyleAttr); @SuppressWarnings("NullableProblems") // If clients guarantee that the template has a recycler // view, and call this after the template is inflated, // this will not return null. RecyclerView getRecyclerView(); @SuppressWarnings("NullableProblems") // If clients guarantee that the template has a header, // this call will not return null. View getHeader(); void onLayout(); Adapter<? extends ViewHolder> getAdapter(); void setAdapter(Adapter<? extends ViewHolder> adapter); void setDividerInset(int inset); int getDividerInset(); Drawable getDivider(); void setDividerItemDecoration(@NonNull DividerItemDecoration decoration); }
RecyclerMixin implements Mixin { public Adapter<? extends ViewHolder> getAdapter() { @SuppressWarnings("unchecked") final RecyclerView.Adapter<? extends ViewHolder> adapter = mRecyclerView.getAdapter(); if (adapter instanceof HeaderAdapter) { return ((HeaderAdapter<? extends ViewHolder>) adapter).getWrappedAdapter(); } return adapter; } RecyclerMixin(@NonNull TemplateLayout layout, @NonNull RecyclerView recyclerView); void parseAttributes(@Nullable AttributeSet attrs, int defStyleAttr); @SuppressWarnings("NullableProblems") // If clients guarantee that the template has a recycler // view, and call this after the template is inflated, // this will not return null. RecyclerView getRecyclerView(); @SuppressWarnings("NullableProblems") // If clients guarantee that the template has a header, // this call will not return null. View getHeader(); void onLayout(); Adapter<? extends ViewHolder> getAdapter(); void setAdapter(Adapter<? extends ViewHolder> adapter); void setDividerInset(int inset); int getDividerInset(); Drawable getDivider(); void setDividerItemDecoration(@NonNull DividerItemDecoration decoration);  }