imagem dos clubes inseridas
This commit is contained in:
@@ -54,4 +54,5 @@ dependencies {
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
}
|
||||
@@ -2,9 +2,7 @@ package com.example.vdcscore.models;
|
||||
|
||||
import com.google.firebase.database.PropertyName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Club {
|
||||
@PropertyName("id")
|
||||
@@ -13,8 +11,8 @@ public class Club {
|
||||
@PropertyName("nome")
|
||||
private String name;
|
||||
|
||||
@PropertyName("logoUrl")
|
||||
private String logoUrl;
|
||||
@PropertyName("imagem")
|
||||
private String imageUrl;
|
||||
|
||||
@PropertyName("campo")
|
||||
private String stadium;
|
||||
@@ -36,11 +34,11 @@ public class Club {
|
||||
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) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.logoUrl = logoUrl;
|
||||
this.imageUrl = imageUrl;
|
||||
this.stadium = stadium;
|
||||
this.foundationYear = foundationYear;
|
||||
this.address = address;
|
||||
@@ -68,14 +66,14 @@ public class Club {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@PropertyName("logoUrl")
|
||||
public String getLogoUrl() {
|
||||
return logoUrl;
|
||||
@PropertyName("imagem")
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
@PropertyName("logoUrl")
|
||||
public void setLogoUrl(String logoUrl) {
|
||||
this.logoUrl = logoUrl;
|
||||
@PropertyName("imagem")
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
@PropertyName("campo")
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.ImageView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.vdcscore.R;
|
||||
import com.example.vdcscore.models.Club;
|
||||
|
||||
@@ -50,19 +51,22 @@ public class ClubAdapter extends RecyclerView.Adapter<ClubAdapter.ClubViewHolder
|
||||
static class ClubViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView name;
|
||||
private final TextView stadium;
|
||||
private final ImageView logo;
|
||||
private final ImageView image_detail_logo;
|
||||
|
||||
public ClubViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.text_club_name);
|
||||
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) {
|
||||
name.setText(club.getName());
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
public class ClubDetailFragment extends Fragment {
|
||||
|
||||
@@ -72,8 +73,14 @@ public class ClubDetailFragment extends Fragment {
|
||||
binding.textDetailAddress.setText(club.getAddress());
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Wed Jan 28 08:50:25 WET 2026
|
||||
#Thu Jan 29 09:53:07 WET 2026
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Reference in New Issue
Block a user