prompt
This commit is contained in:
@@ -56,17 +56,45 @@ public class ClubDetailFragment extends Fragment {
|
||||
if (statsTeam != null) {
|
||||
populateStats(statsTeam);
|
||||
setupComparison(statsTeam);
|
||||
// Also load basic info metadata (president, etc.)
|
||||
loadClubDetails(statsTeam.getTeam_id());
|
||||
} else {
|
||||
Club clubeRecebido = (Club) getArguments().getSerializable("clube_selecionado");
|
||||
if (clubeRecebido != null) {
|
||||
populateClubInfo(clubeRecebido);
|
||||
} else if (clubId != null) {
|
||||
loadClubDetails(Integer.parseInt(clubId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadClubDetails(int clubId) {
|
||||
DatabaseReference clubRef = FirebaseDatabase.getInstance().getReference("clubes").child(String.valueOf(clubId));
|
||||
clubRef.addListenerForSingleValueEvent(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||
Club club = snapshot.getValue(Club.class);
|
||||
if (club != null) {
|
||||
populateClubInfo(club);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError error) {
|
||||
if (getContext() != null) {
|
||||
Toast.makeText(getContext(), "Erro ao carregar detalhes do clube", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void populateStats(Team team) {
|
||||
binding.textDetailClubName.setText(team.getNome());
|
||||
binding.labelStats.setVisibility(View.VISIBLE);
|
||||
binding.containerStats.setVisibility(View.VISIBLE);
|
||||
binding.btnCompare.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.textDetailPoints.setText(String.valueOf(team.getPontos()));
|
||||
binding.textDetailPlayed.setText(String.valueOf(team.getJogos()));
|
||||
binding.textDetailWon.setText(team.getVitorias() + "V");
|
||||
@@ -98,11 +126,12 @@ public class ClubDetailFragment extends Fragment {
|
||||
|
||||
private void populateClubInfo(Club club) {
|
||||
binding.textDetailClubName.setText(club.getName());
|
||||
// If coming from Clubs list, we don't have stats easily unless we fetch them or hide stats container.
|
||||
// For now, hide stats if no statsTeam
|
||||
binding.labelStats.setVisibility(View.GONE);
|
||||
binding.containerStats.setVisibility(View.GONE);
|
||||
binding.btnCompare.setVisibility(View.GONE);
|
||||
|
||||
// Bind new club info fields
|
||||
binding.textDetailPresident.setText(club.getPresident() != null && !club.getPresident().isEmpty() ? club.getPresident() : "---");
|
||||
binding.textDetailFoundation.setText(club.getFoundationYear() > 0 ? String.valueOf(club.getFoundationYear()) : "---");
|
||||
binding.textDetailStadium.setText(club.getStadium() != null && !club.getStadium().isEmpty() ? club.getStadium() : "---");
|
||||
binding.textDetailAddress.setText(club.getAddress() != null && !club.getAddress().isEmpty() ? club.getAddress() : "---");
|
||||
|
||||
if (getContext() != null) {
|
||||
Glide.with(this)
|
||||
|
||||
@@ -45,6 +45,16 @@ public class Match {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("equipa_casa_nome")
|
||||
public void setEquipaCasaNome(String homeName) {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("home_team_name")
|
||||
public void setHomeTeamName(String homeName) {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("away_nome")
|
||||
public String getAwayName() {
|
||||
return awayName;
|
||||
@@ -65,6 +75,16 @@ public class Match {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("equipa_fora_nome")
|
||||
public void setEquipaForaNome(String awayName) {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("away_team_name")
|
||||
public void setAwayTeamName(String awayName) {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("home_golos")
|
||||
public Integer getHomeScore() {
|
||||
return homeScore;
|
||||
@@ -120,6 +140,16 @@ public class Match {
|
||||
this.homeLogo = homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("equipa_casa_logo")
|
||||
public void setEquipaCasaLogo(String homeLogo) {
|
||||
this.homeLogo = homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("home_team_logo")
|
||||
public void setHomeTeamLogo(String homeLogo) {
|
||||
this.homeLogo = homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("away_logo")
|
||||
public String getAwayLogo() {
|
||||
return awayLogo;
|
||||
@@ -135,6 +165,16 @@ public class Match {
|
||||
this.awayLogo = awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("equipa_fora_logo")
|
||||
public void setEquipaForaLogo(String awayLogo) {
|
||||
this.awayLogo = awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("away_team_logo")
|
||||
public void setAwayTeamLogo(String awayLogo) {
|
||||
this.awayLogo = awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("campo")
|
||||
public String getStadium() {
|
||||
return stadium;
|
||||
|
||||
@@ -50,15 +50,19 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
|
||||
holder.textHomeTeam.setText(isValid(homeName) ? homeName : "Equipa A");
|
||||
holder.textAwayTeam.setText(isValid(awayName) ? awayName : "Equipa B");
|
||||
|
||||
// Logos
|
||||
// Logos with better loading
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.load(match.getHomeLogo())
|
||||
.placeholder(R.drawable.ic_club_placeholder)
|
||||
.error(R.drawable.ic_club_placeholder)
|
||||
.circleCrop()
|
||||
.into(holder.imgHomeLogo);
|
||||
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.load(match.getAwayLogo())
|
||||
.placeholder(R.drawable.ic_club_placeholder)
|
||||
.error(R.drawable.ic_club_placeholder)
|
||||
.circleCrop()
|
||||
.into(holder.imgAwayLogo);
|
||||
|
||||
// Scores
|
||||
|
||||
6
app/src/main/res/drawable/bg_jornada_nav.xml
Normal file
6
app/src/main/res/drawable/bg_jornada_nav.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#F8F9FA" />
|
||||
<corners android:radius="14dp" />
|
||||
<stroke android:width="1dp" android:color="#F1F3F5" />
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/bg_match_item.xml
Normal file
6
app/src/main/res/drawable/bg_match_item.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/surface_card" />
|
||||
<corners android:radius="16dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider" />
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/ic_club_placeholder.xml
Normal file
9
app/src/main/res/drawable/ic_club_placeholder.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#E0E0E0"
|
||||
android:pathData="M12,2L4,5v6.09c0,5.05 3.41,9.76 8,10.91 4.59,-1.15 8,-5.86 8,-10.91V5L12,2z"/>
|
||||
</vector>
|
||||
@@ -61,6 +61,177 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<!-- Club Info Header -->
|
||||
<TextView
|
||||
android:id="@+id/label_club_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="INFORMAÇÃO DO CLUBE:"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#616161"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_detail_club_name"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<!-- Club Info Container -->
|
||||
<LinearLayout
|
||||
android:id="@+id/container_club_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/label_club_info"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<!-- Presidente Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_person"
|
||||
app:tint="#455A64"
|
||||
android:background="@drawable/circle_edit_background"
|
||||
android:backgroundTint="#ECEFF1"
|
||||
android:padding="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="PRESIDENTE:"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#616161"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_detail_president"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#263238"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Foundation Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_calendar"
|
||||
app:tint="#1976D2"
|
||||
android:background="@drawable/circle_edit_background"
|
||||
android:backgroundTint="#E3F2FD"
|
||||
android:padding="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="ANO DE FUNDAÇÃO:"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#616161"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_detail_foundation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#263238"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Stadium Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_soccer"
|
||||
app:tint="#388E3C"
|
||||
android:background="@drawable/circle_edit_background"
|
||||
android:backgroundTint="#E8F5E9"
|
||||
android:padding="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="CAMPO:"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#616161"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_detail_stadium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#263238"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Morada Row -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_location"
|
||||
app:tint="#D32F2F"
|
||||
android:background="@drawable/circle_edit_background"
|
||||
android:backgroundTint="#FFEBEE"
|
||||
android:padding="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="MORADA:"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#616161"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_detail_address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#263238"
|
||||
android:textStyle="bold"
|
||||
android:maxWidth="200dp"
|
||||
android:gravity="end"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Statistics Header -->
|
||||
<TextView
|
||||
android:id="@+id/label_stats"
|
||||
@@ -70,7 +241,8 @@
|
||||
android:textSize="14sp"
|
||||
android:textColor="#616161"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_detail_club_name"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/container_club_info"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<!-- Stats Container -->
|
||||
@@ -80,6 +252,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/label_stats"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
@@ -320,6 +493,7 @@
|
||||
app:cornerRadius="12dp"
|
||||
android:backgroundTint="#FFC107"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/container_stats"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
@@ -4,16 +4,17 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp"
|
||||
android:layout_marginVertical="10dp"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="6dp"
|
||||
app:strokeWidth="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- Header: Date, Time and Stadium -->
|
||||
<LinearLayout
|
||||
@@ -21,7 +22,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="8dp">
|
||||
android:layout_marginBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_match_info"
|
||||
@@ -30,22 +31,25 @@
|
||||
android:text="29/03/2026 10:00"
|
||||
android:textColor="#1976D2"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:letterSpacing="0.05" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_match_stadium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Campo:Guilhabreu"
|
||||
android:textColor="#1976D2"
|
||||
android:textSize="11sp" />
|
||||
android:textColor="#5C6BC0"
|
||||
android:textSize="11sp"
|
||||
android:layout_marginTop="2dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="#BBDEFB"
|
||||
android:layout_marginBottom="12dp" />
|
||||
android:background="#E0E0E0"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<!-- Teams and Scores -->
|
||||
<LinearLayout
|
||||
@@ -64,8 +68,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_home_logo"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:padding="4dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_club_placeholder" />
|
||||
@@ -74,12 +78,14 @@
|
||||
android:id="@+id/text_home_team"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="J.U. Mosteiró"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Score Section -->
|
||||
@@ -87,7 +93,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -95,14 +101,14 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2"
|
||||
android:textColor="#0D47A1"
|
||||
android:textSize="32sp"
|
||||
android:textColor="#1A237E"
|
||||
android:textSize="34sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="#E3F2FD"
|
||||
android:background="#EEEEEE"
|
||||
android:layout_marginHorizontal="12dp" />
|
||||
|
||||
<TextView
|
||||
@@ -110,8 +116,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
android:textColor="#0D47A1"
|
||||
android:textSize="32sp"
|
||||
android:textColor="#1A237E"
|
||||
android:textSize="34sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -125,8 +131,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_away_logo"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="65dp"
|
||||
android:padding="4dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_club_placeholder" />
|
||||
@@ -135,12 +141,14 @@
|
||||
android:id="@+id/text_away_team"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="G.D.C. Rio Mau"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textColor="#333333"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user