imagem dos clubes inseridas

This commit is contained in:
2026-01-29 10:30:59 +00:00
parent beede716c6
commit 695e8cac2e
5 changed files with 29 additions and 19 deletions

View File

@@ -54,4 +54,5 @@ dependencies {
testImplementation(libs.junit) testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit) androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core) androidTestImplementation(libs.espresso.core)
implementation("com.github.bumptech.glide:glide:4.16.0")
} }

View File

@@ -2,9 +2,7 @@ package com.example.vdcscore.models;
import com.google.firebase.database.PropertyName; import com.google.firebase.database.PropertyName;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public class Club { public class Club {
@PropertyName("id") @PropertyName("id")
@@ -13,8 +11,8 @@ public class Club {
@PropertyName("nome") @PropertyName("nome")
private String name; private String name;
@PropertyName("logoUrl") @PropertyName("imagem")
private String logoUrl; private String imageUrl;
@PropertyName("campo") @PropertyName("campo")
private String stadium; private String stadium;
@@ -36,11 +34,11 @@ public class Club {
players = new ArrayList<>(); players = new ArrayList<>();
} }
public Club(int id, String name, String logoUrl, String stadium, int foundationYear, String address, public Club(int id, String name, String imageUrl, String stadium, int foundationYear, String address,
String president) { String president) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.logoUrl = logoUrl; this.imageUrl = imageUrl;
this.stadium = stadium; this.stadium = stadium;
this.foundationYear = foundationYear; this.foundationYear = foundationYear;
this.address = address; this.address = address;
@@ -68,14 +66,14 @@ public class Club {
this.name = name; this.name = name;
} }
@PropertyName("logoUrl") @PropertyName("imagem")
public String getLogoUrl() { public String getImageUrl() {
return logoUrl; return imageUrl;
} }
@PropertyName("logoUrl") @PropertyName("imagem")
public void setLogoUrl(String logoUrl) { public void setImageUrl(String imageUrl) {
this.logoUrl = logoUrl; this.imageUrl = imageUrl;
} }
@PropertyName("campo") @PropertyName("campo")

View File

@@ -9,6 +9,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.vdcscore.R; import com.example.vdcscore.R;
import com.example.vdcscore.models.Club; import com.example.vdcscore.models.Club;
@@ -50,19 +51,22 @@ public class ClubAdapter extends RecyclerView.Adapter<ClubAdapter.ClubViewHolder
static class ClubViewHolder extends RecyclerView.ViewHolder { static class ClubViewHolder extends RecyclerView.ViewHolder {
private final TextView name; private final TextView name;
private final TextView stadium; private final TextView stadium;
private final ImageView logo; private final ImageView image_detail_logo;
public ClubViewHolder(@NonNull View itemView) { public ClubViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
name = itemView.findViewById(R.id.text_club_name); name = itemView.findViewById(R.id.text_club_name);
stadium = itemView.findViewById(R.id.text_club_stadium); stadium = itemView.findViewById(R.id.text_club_stadium);
logo = itemView.findViewById(R.id.image_club_logo); image_detail_logo = itemView.findViewById(R.id.image_club_logo);
} }
public void bind(final Club club, final OnItemClickListener listener) { public void bind(final Club club, final OnItemClickListener listener) {
name.setText(club.getName()); name.setText(club.getName());
stadium.setText(club.getStadium()); stadium.setText(club.getStadium());
// TODO: Load image from logoUrl using a library like Glide
Glide.with(itemView.getContext())
.load(club.getImageUrl())
.into(image_detail_logo);
itemView.setOnClickListener(v -> listener.onItemClick(club)); itemView.setOnClickListener(v -> listener.onItemClick(club));
} }

View File

@@ -19,6 +19,7 @@ import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener; import com.google.firebase.database.ValueEventListener;
import com.bumptech.glide.Glide;
public class ClubDetailFragment extends Fragment { public class ClubDetailFragment extends Fragment {
@@ -72,8 +73,14 @@ public class ClubDetailFragment extends Fragment {
binding.textDetailAddress.setText(club.getAddress()); binding.textDetailAddress.setText(club.getAddress());
// binding.textDetailStadium.setText(club.getStadium()); // Hidden for now // binding.textDetailStadium.setText(club.getStadium()); // Hidden for now
// Load Logo (Default for now as requested) // binding.imageDetailLogo.setImageResource(R.mipmap.ic_launcher_round);
binding.imageDetailLogo.setImageResource(R.mipmap.ic_launcher_round); if (getContext() != null) {
Glide.with(ClubDetailFragment.this)
.load(club.getImageUrl())
.placeholder(R.mipmap.ic_launcher_round)
.error(R.mipmap.ic_launcher)
.into(binding.imageDetailLogo);
}
} }
} }

View File

@@ -1,6 +1,6 @@
#Wed Jan 28 08:50:25 WET 2026 #Thu Jan 29 09:53:07 WET 2026
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists