This commit is contained in:
2026-04-14 17:13:52 +01:00
parent fa9ba84d5c
commit 740680e9fb
13 changed files with 605 additions and 58 deletions

View File

@@ -46,6 +46,15 @@ public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.Vi
holder.text1.setText(restaurant.getName());
holder.text2.setText(restaurant.getCategory() + (restaurant.isAvailable() ? " - Disponível" : " - Indisponível"));
if (restaurant.getLogoUrl() != null && !restaurant.getLogoUrl().isEmpty()) {
com.bumptech.glide.Glide.with(holder.itemView.getContext())
.load(restaurant.getLogoUrl())
.circleCrop()
.into(holder.imgThumb);
} else {
holder.imgThumb.setImageResource(R.mipmap.ic_launcher);
}
holder.itemView.setOnClickListener(v -> {
if (listener != null) {
listener.onRestaurantClick(restaurant);
@@ -99,11 +108,13 @@ public class RestaurantAdapter extends RecyclerView.Adapter<RestaurantAdapter.Vi
public static class ViewHolder extends RecyclerView.ViewHolder {
TextView text1, text2;
ImageButton btnFavorite;
android.widget.ImageView imgThumb;
public ViewHolder(@NonNull View itemView) {
super(itemView);
text1 = itemView.findViewById(R.id.txtRestaurantName);
text2 = itemView.findViewById(R.id.txtRestaurantCategory);
btnFavorite = itemView.findViewById(R.id.btnFavorite);
imgThumb = itemView.findViewById(R.id.imgRestaurantThumb);
}
}
}