in app/src/main/java/com/google/firebase/example/fireeats/adapter/RestaurantAdapter.java [88:116]
public void bind(final DocumentSnapshot snapshot,
final OnRestaurantSelectedListener listener) {
Restaurant restaurant = snapshot.toObject(Restaurant.class);
Resources resources = itemView.getResources();
// Load image
Glide.with(imageView.getContext())
.load(restaurant.getPhoto())
.into(imageView);
nameView.setText(restaurant.getName());
ratingBar.setRating((float) restaurant.getAvgRating());
cityView.setText(restaurant.getCity());
categoryView.setText(restaurant.getCategory());
numRatingsView.setText(resources.getString(R.string.fmt_num_ratings,
restaurant.getNumRatings()));
priceView.setText(RestaurantUtil.getPriceString(restaurant));
// Click listener
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener != null) {
listener.onRestaurantSelected(snapshot);
}
}
});
}