Skip to content

Instantly share code, notes, and snippets.

@andrzejchm
Last active March 14, 2018 06:59
Show Gist options
  • Save andrzejchm/7cbc7c2538c3cd3c91820cdebdd19702 to your computer and use it in GitHub Desktop.
Save andrzejchm/7cbc7c2538c3cd3c91820cdebdd19702 to your computer and use it in GitHub Desktop.
public class RepositoriesRecyclerAdapter extends RecyclerView.Adapter<RepositoriesRecyclerAdapter.RepoViewHolder> {
private final RepositoriesListPresenter presenter;
public RepositoriesRecyclerAdapter(RepositoriesListPresenter repositoriesPresenter) {
this.presenter = repositoriesPresenter;
}
@Override
public RepositoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new RepositoryViewHolder(LayoutInflater.from(parent.getContext())
.inflate(R.layout.cell_repo_view, parent, false));
}
@Override
public void onBindViewHolder(RepositoryViewHolder holder, int position) {
presenter.onBindRepositoryRowViewAtPosition(position, holder);
}
@Override
public int getItemCount() {
return presenter.getRepositoriesRowsCount();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment