// Path: service/github/src/main/java/com/jakewharton/u2020/data/api/model/Repository.java
// public final class Repository {
//   @NonNull public final String name;
//   @NonNull public final User owner;
//   @Nullable public final String description;
// 
//   public final long watchers;
//   public final long forks;
// 
//   public final String html_url;
// 
//   public final Instant updated_at;
// 
//   private Repository(Builder builder) {
//     this.name = requireNonNull(builder.name, "name == null");
//     this.owner = requireNonNull(builder.owner, "owner == null");
//     this.description = builder.description;
//     this.watchers = builder.stars;
//     this.forks = builder.forks;
//     this.html_url = requireNonNull(builder.htmlUrl, "html_url == null");
//     this.updated_at = requireNonNull(builder.updatedAt, "updated_at == null");
//   }
// 
//   @Override public String toString() {
//     return "Repository{" +
//         "name='" + name + '\'' +
//         ", owner=" + owner +
//         ", description='" + description + '\'' +
//         ", watchers=" + watchers +
//         ", forks=" + forks +
//         ", html_url='" + html_url + '\'' +
//         ", updated_at=" + updated_at +
//         '}';
//   }
// 
//   public static final class Builder {
//     private String name;
//     private User owner;
//     private String description;
//     private long stars;
//     private long forks;
//     private String htmlUrl;
//     private Instant updatedAt;
// 
//     public Builder name(String name) {
//       this.name = name;
//       return this;
//     }
// 
//     public Builder owner(User owner) {
//       this.owner = owner;
//       return this;
//     }
// 
//     public Builder description(String description) {
//       this.description = description;
//       return this;
//     }
// 
//     public Builder stars(long stars) {
//       this.stars = stars;
//       return this;
//     }
// 
//     public Builder forks(long forks) {
//       this.forks = forks;
//       return this;
//     }
// 
//     public Builder htmlUrl(String htmlUrl) {
//       this.htmlUrl = htmlUrl;
//       return this;
//     }
// 
//     public Builder updatedAt(Instant updatedAt) {
//       this.updatedAt = updatedAt;
//       return this;
//     }
// 
//     public Repository build() {
//       return new Repository(this);
//     }
//   }
// }


import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.jakewharton.u2020.R;
import com.jakewharton.u2020.data.api.model.Repository;
import com.squareup.picasso.Picasso;
import java.util.Collections;
import java.util.List;
import rx.functions.Action1;
package com.jakewharton.u2020.ui.trending;


final class TrendingAdapter extends RecyclerView.Adapter<TrendingAdapter.ViewHolder>
    implements Action1<List<Repository>> {
  public interface RepositoryClickListener {
    void onRepositoryClick(Repository repository);
  }

  private final Picasso picasso;
  private final RepositoryClickListener repositoryClickListener;

  private List<Repository> repositories = Collections.emptyList();

  public TrendingAdapter(Picasso picasso, RepositoryClickListener repositoryClickListener) {
    this.picasso = picasso;
    this.repositoryClickListener = repositoryClickListener;
    setHasStableIds(true);
  }

  @Override public void call(List<Repository> repositories) {
    this.repositories = repositories;
    notifyDataSetChanged();
  }

  @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    TrendingItemView view = (TrendingItemView) LayoutInflater.from(viewGroup.getContext())
        .inflate(R.layout.trending_view_repository, viewGroup, false);
    return new ViewHolder(view);
  }

  @Override public void onBindViewHolder(ViewHolder viewHolder, int i) {
// Path: service/github/src/main/java/com/jakewharton/u2020/data/api/model/Repository.java
// public final class Repository {
//   @NonNull public final String name;
//   @NonNull public final User owner;
//   @Nullable public final String description;
// 
//   public final long watchers;
//   public final long forks;
// 
//   public final String html_url;
// 
//   public final Instant updated_at;
// 
//   private Repository(Builder builder) {
//     this.name = requireNonNull(builder.name, "name == null");
//     this.owner = requireNonNull(builder.owner, "owner == null");
//     this.description = builder.description;
//     this.watchers = builder.stars;
//     this.forks = builder.forks;
//     this.html_url = requireNonNull(builder.htmlUrl, "html_url == null");
//     this.updated_at = requireNonNull(builder.updatedAt, "updated_at == null");
//   }
// 
//   @Override public String toString() {
//     return "Repository{" +
//         "name='" + name + '\'' +
//         ", owner=" + owner +
//         ", description='" + description + '\'' +
//         ", watchers=" + watchers +
//         ", forks=" + forks +
//         ", html_url='" + html_url + '\'' +
//         ", updated_at=" + updated_at +
//         '}';
//   }
// 
//   public static final class Builder {
//     private String name;
//     private User owner;
//     private String description;
//     private long stars;
//     private long forks;
//     private String htmlUrl;
//     private Instant updatedAt;
// 
//     public Builder name(String name) {
//       this.name = name;
//       return this;
//     }
// 
//     public Builder owner(User owner) {
//       this.owner = owner;
//       return this;
//     }
// 
//     public Builder description(String description) {
//       this.description = description;
//       return this;
//     }
// 
//     public Builder stars(long stars) {
//       this.stars = stars;
//       return this;
//     }
// 
//     public Builder forks(long forks) {
//       this.forks = forks;
//       return this;
//     }
// 
//     public Builder htmlUrl(String htmlUrl) {
//       this.htmlUrl = htmlUrl;
//       return this;
//     }
// 
//     public Builder updatedAt(Instant updatedAt) {
//       this.updatedAt = updatedAt;
//       return this;
//     }
// 
//     public Repository build() {
//       return new Repository(this);
//     }
//   }
// }


// Path: app/src/main/java/com/jakewharton/u2020/ui/trending/TrendingAdapter.java
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.jakewharton.u2020.R;
import com.jakewharton.u2020.data.api.model.Repository;
import com.squareup.picasso.Picasso;
import java.util.Collections;
import java.util.List;
import rx.functions.Action1;

package com.jakewharton.u2020.ui.trending;


final class TrendingAdapter extends RecyclerView.Adapter<TrendingAdapter.ViewHolder>
    implements Action1<List<Repository>> {
  public interface RepositoryClickListener {
    void onRepositoryClick(Repository repository);
  }

  private final Picasso picasso;
  private final RepositoryClickListener repositoryClickListener;

  private List<Repository> repositories = Collections.emptyList();

  public TrendingAdapter(Picasso picasso, RepositoryClickListener repositoryClickListener) {
    this.picasso = picasso;
    this.repositoryClickListener = repositoryClickListener;
    setHasStableIds(true);
  }

  @Override public void call(List<Repository> repositories) {
    this.repositories = repositories;
    notifyDataSetChanged();
  }

  @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    TrendingItemView view = (TrendingItemView) LayoutInflater.from(viewGroup.getContext())
        .inflate(R.layout.trending_view_repository, viewGroup, false);
    return new ViewHolder(view);
  }

  @Override public void onBindViewHolder(ViewHolder viewHolder, int i) {
    viewHolder.bindTo(repositories.get(i));