Compare commits

..

5 Commits

Author SHA1 Message Date
6a1e604b96 . 2026-04-14 17:22:27 +01:00
a79ee68417 mais opcoes de ver estatisticas de clube 2026-03-17 17:16:23 +00:00
33a3064a89 tabela nova 2026-03-17 17:09:00 +00:00
109e4b4a92 tabela 2026-03-17 17:06:02 +00:00
1a4b5b7d37 resolve frcoisas 2026-03-17 17:03:32 +00:00
13 changed files with 799 additions and 302 deletions

View File

@@ -8,6 +8,7 @@ import android.view.Menu;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.navigation.NavigationView; import com.google.android.material.navigation.NavigationView;

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.example.vdcscore.ui.home.Team;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
public class ClubDetailFragment extends Fragment { public class ClubDetailFragment extends Fragment {
@@ -50,73 +51,129 @@ public class ClubDetailFragment extends Fragment {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
if (getArguments() != null) { if (getArguments() != null) {
Club clubeRecebido = (Club) getArguments().getSerializable("clube_selecionado"); Team statsTeam = (Team) getArguments().getSerializable("clube_selecionado_estatisticas");
if (clubeRecebido != null) { if (statsTeam != null) {
// Preencher views diretamente populateStats(statsTeam);
binding.textDetailClubName.setText(clubeRecebido.getName()); setupComparison(statsTeam);
binding.textDetailFoundation.setText(String.valueOf(clubeRecebido.getFoundationYear())); } else {
binding.textDetailPresident.setText(clubeRecebido.getPresident()); Club clubeRecebido = (Club) getArguments().getSerializable("clube_selecionado");
binding.textDetailAddress.setText(clubeRecebido.getAddress()); if (clubeRecebido != null) {
populateClubInfo(clubeRecebido);
if (getContext() != null) {
Glide.with(this)
.load(clubeRecebido.getImageUrl())
.placeholder(R.mipmap.ic_launcher_round)
.error(R.mipmap.ic_launcher)
.into(binding.imageDetailLogo);
} }
// Configurar o botão para ver jogadores
binding.btnPlayers.setOnClickListener(v -> {
Bundle bundle = new Bundle();
// Passar o 'clube_selecionado' também para a lista de jogadores se necessário,
// ou passar o ID como antes se o fragmento de jogadores esperar ID
bundle.putString("clubId", String.valueOf(clubeRecebido.getId()));
bundle.putString("escalao", escalao);
// Se o ClubPlayersFragment esperar "clube_selecionado" tambem, poderiamos
// passar:
// bundle.putSerializable("clube_selecionado", clubeRecebido);
Navigation.findNavController(view).navigate(R.id.action_nav_club_detail_to_nav_club_players,
bundle);
});
} }
} }
} }
private void loadClubDetails() { private void populateStats(Team team) {
mDatabase.addListenerForSingleValueEvent(new ValueEventListener() { binding.textDetailClubName.setText(team.getNome());
@Override binding.textDetailPoints.setText(String.valueOf(team.getPontos()));
public void onDataChange(@NonNull DataSnapshot snapshot) { binding.textDetailPlayed.setText(String.valueOf(team.getJogos()));
Club club = snapshot.getValue(Club.class); binding.textDetailWon.setText(team.getVitorias() + "V");
if (club != null) { binding.textDetailDrawn.setText(team.getEmpates() + "E");
binding.textDetailClubName.setText(club.getName()); binding.textDetailLost.setText(team.getDerrotas() + "D");
binding.textDetailFoundation.setText(String.valueOf(club.getFoundationYear())); binding.textDetailGoals.setText(team.getGolos_marcados() + " - " + team.getGolos_sofridos());
binding.textDetailPresident.setText(club.getPresident()); binding.textDetailGoalDiff.setText((team.getDiferenca_golos() > 0 ? "+" : "") + team.getDiferenca_golos());
binding.textDetailAddress.setText(club.getAddress());
// binding.textDetailStadium.setText(club.getStadium()); // Hidden for now // Posicao circle and text
binding.textDetailPosition.setText(team.getPosicao() > 0 ? team.getPosicao() + "º" : "---");
binding.textDetailPositionCircle.setText(String.valueOf(team.getPosicao() > 0 ? team.getPosicao() : "-"));
// binding.imageDetailLogo.setImageResource(R.mipmap.ic_launcher_round); if (getContext() != null) {
if (getContext() != null) { Glide.with(this)
Glide.with(ClubDetailFragment.this) .load(team.getImagem())
.load(club.getImageUrl()) .placeholder(R.mipmap.ic_launcher_round)
.placeholder(R.mipmap.ic_launcher_round) .error(R.mipmap.ic_launcher)
.error(R.mipmap.ic_launcher) .into(binding.imageDetailLogo);
.into(binding.imageDetailLogo); }
}
}
}
@Override // Button players
public void onCancelled(@NonNull DatabaseError error) { binding.btnPlayers.setOnClickListener(v -> {
if (getContext() != null) { Bundle bundle = new Bundle();
Toast.makeText(getContext(), "Failed to load club details.", Toast.LENGTH_SHORT).show(); bundle.putString("clubId", String.valueOf(team.getTeam_id()));
} bundle.putString("escalao", escalao);
} Navigation.findNavController(v).navigate(R.id.action_nav_club_detail_to_nav_club_players, bundle);
}); });
} }
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);
if (getContext() != null) {
Glide.with(this)
.load(club.getImageUrl())
.placeholder(R.mipmap.ic_launcher_round)
.error(R.mipmap.ic_launcher)
.into(binding.imageDetailLogo);
}
binding.btnPlayers.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putString("clubId", String.valueOf(club.getId()));
bundle.putString("escalao", escalao);
Navigation.findNavController(v).navigate(R.id.action_nav_club_detail_to_nav_club_players, bundle);
});
}
private void setupComparison(Team team1) {
binding.btnCompare.setOnClickListener(v -> {
// Fetch all teams of same escalao if not fetched
FirebaseDatabase.getInstance().getReference("classificacoes").child(escalao)
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
java.util.List<Team> otherTeams = new java.util.ArrayList<>();
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
Team t = postSnapshot.getValue(Team.class);
if (t != null && t.getTeam_id() != team1.getTeam_id()) {
otherTeams.add(t);
}
}
showComparisonDialog(team1, otherTeams);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {}
});
});
}
private void showComparisonDialog(Team team1, java.util.List<Team> otherTeams) {
String[] teamNames = new String[otherTeams.size()];
for (int i = 0; i < otherTeams.size(); i++) {
teamNames[i] = otherTeams.get(i).getNome();
}
new androidx.appcompat.app.AlertDialog.Builder(requireContext())
.setTitle("Selecionar Equipa para Comparar")
.setItems(teamNames, (dialog, which) -> {
Team team2 = otherTeams.get(which);
displayComparison(team1, team2);
})
.show();
}
private void displayComparison(Team t1, Team t2) {
binding.layoutComparison.setVisibility(View.VISIBLE);
binding.textCompareTeam1.setText(t1.getNome());
binding.textCompareTeam2.setText(t2.getNome());
binding.textCompareP1.setText(String.valueOf(t1.getPontos()));
binding.textCompareP2.setText(String.valueOf(t2.getPontos()));
binding.textCompareG1.setText(String.valueOf(t1.getGolos_marcados()));
binding.textCompareG2.setText(String.valueOf(t2.getGolos_marcados()));
// Highlight advantage
binding.textCompareP1.setTextColor(t1.getPontos() >= t2.getPontos() ? android.graphics.Color.GREEN : android.graphics.Color.RED);
binding.textCompareP2.setTextColor(t2.getPontos() >= t1.getPontos() ? android.graphics.Color.GREEN : android.graphics.Color.RED);
}
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();

View File

@@ -28,6 +28,7 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsCompat;
import com.bumptech.glide.Glide;
import com.example.vdcscore.LoginActivity; import com.example.vdcscore.LoginActivity;
import com.example.vdcscore.R; import com.example.vdcscore.R;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;

View File

@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import com.example.vdcscore.R;
import com.example.vdcscore.databinding.FragmentGalleryBinding; import com.example.vdcscore.databinding.FragmentGalleryBinding;
import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseError;
@@ -23,8 +24,12 @@ import java.util.List;
public class GalleryFragment extends Fragment { public class GalleryFragment extends Fragment {
private FragmentGalleryBinding binding; private FragmentGalleryBinding binding;
private MatchdaysAdapter adapter; private MatchesAdapter adapter;
private DatabaseReference mDatabase; private DatabaseReference mDatabase;
private List<Matchday> matchdaysList = new ArrayList<>();
private int currentJornadaIndex = 0;
private String currentCategory = "seniores";
private ValueEventListener currentListener;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
@@ -33,57 +38,119 @@ public class GalleryFragment extends Fragment {
View root = binding.getRoot(); View root = binding.getRoot();
// Initialize RecyclerView // Initialize RecyclerView
adapter = new MatchdaysAdapter(); adapter = new MatchesAdapter();
binding.recyclerMatchdays.setLayoutManager(new LinearLayoutManager(getContext())); binding.recyclerMatchdays.setLayoutManager(new LinearLayoutManager(getContext()));
binding.recyclerMatchdays.setAdapter(adapter); binding.recyclerMatchdays.setAdapter(adapter);
// Initialize Firebase // Setup Toggle Group
mDatabase = FirebaseDatabase.getInstance().getReference("matchdays"); binding.toggleGroupCategory.addOnButtonCheckedListener((group, checkedId, isChecked) -> {
if (isChecked) {
if (checkedId == R.id.btn_seniores) {
currentCategory = "seniores";
} else if (checkedId == R.id.btn_juniores) {
currentCategory = "juniores";
}
fetchMatchdays();
}
});
// Fetch Data // Setup Navigation Buttons
binding.btnPrevJornada.setOnClickListener(v -> {
if (currentJornadaIndex > 0) {
currentJornadaIndex--;
updateUI();
}
});
binding.btnNextJornada.setOnClickListener(v -> {
if (currentJornadaIndex < matchdaysList.size() - 1) {
currentJornadaIndex++;
updateUI();
}
});
// Initial Fetch
fetchMatchdays(); fetchMatchdays();
return root; return root;
} }
private void fetchMatchdays() { private void fetchMatchdays() {
mDatabase.addValueEventListener(new ValueEventListener() { if (mDatabase != null && currentListener != null) {
mDatabase.removeEventListener(currentListener);
}
binding.textJornadaName.setText("Carregando...");
mDatabase = FirebaseDatabase.getInstance().getReference("jornadas").child(currentCategory);
currentListener = new ValueEventListener() {
@Override @Override
public void onDataChange(@NonNull DataSnapshot snapshot) { public void onDataChange(@NonNull DataSnapshot snapshot) {
if (binding == null) return; if (binding == null) return;
List<Matchday> matchdays = new ArrayList<>();
for (DataSnapshot postSnapshot : snapshot.getChildren()) { matchdaysList.clear();
Matchday matchday = new Matchday(); for (DataSnapshot jornadaSnap : snapshot.getChildren()) {
matchday.setId(postSnapshot.getKey()); String name = jornadaSnap.getKey();
matchday.setName(postSnapshot.child("name").getValue(String.class));
List<Match> matches = new ArrayList<>(); List<Match> matches = new ArrayList<>();
for (DataSnapshot matchSnapshot : postSnapshot.child("matches").getChildren()) {
Match match = matchSnapshot.getValue(Match.class); for (DataSnapshot matchSnap : jornadaSnap.getChildren()) {
Match match = matchSnap.getValue(Match.class);
if (match != null) { if (match != null) {
match.setId(matchSnapshot.getKey()); match.setId(matchSnap.getKey());
matches.add(match); matches.add(match);
} }
} }
matchday.setMatches(matches);
matchdays.add(matchday); if (!matches.isEmpty()) {
matchdaysList.add(new Matchday(name, matches));
}
}
if (matchdaysList.isEmpty()) {
binding.textJornadaName.setText("Sem jornadas");
adapter.setMatches(new ArrayList<>());
} else {
// Try to stay on the same index or go to the first one
if (currentJornadaIndex >= matchdaysList.size()) {
currentJornadaIndex = matchdaysList.size() - 1;
}
updateUI();
} }
adapter.setMatchdays(matchdays);
} }
@Override @Override
public void onCancelled(@NonNull DatabaseError error) { public void onCancelled(@NonNull DatabaseError error) {
if (getContext() != null) { if (getContext() != null) {
Toast.makeText(getContext(), "Erro ao carregar jornadas: " + error.getMessage(), Toast.LENGTH_SHORT) Toast.makeText(getContext(), "Erro ao carregar: " + error.getMessage(), Toast.LENGTH_SHORT).show();
.show();
} }
} }
}); };
mDatabase.addValueEventListener(currentListener);
}
private void updateUI() {
if (matchdaysList.isEmpty()) return;
Matchday currentMatchday = matchdaysList.get(currentJornadaIndex);
binding.textJornadaName.setText(currentMatchday.getName());
adapter.setMatches(currentMatchday.getMatches());
// Enable/Disable navigation buttons
binding.btnPrevJornada.setEnabled(currentJornadaIndex > 0);
binding.btnNextJornada.setEnabled(currentJornadaIndex < matchdaysList.size() - 1);
// Visual feedback for disabled buttons
binding.btnPrevJornada.setAlpha(currentJornadaIndex > 0 ? 1.0f : 0.3f);
binding.btnNextJornada.setAlpha(currentJornadaIndex < matchdaysList.size() - 1 ? 1.0f : 0.3f);
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
if (mDatabase != null && currentListener != null) {
mDatabase.removeEventListener(currentListener);
}
binding = null; binding = null;
} }
} }

View File

@@ -1,27 +1,22 @@
package com.example.vdcscore.ui.gallery; package com.example.vdcscore.ui.gallery;
import com.google.firebase.database.PropertyName;
public class Match { public class Match {
private String id; private String id;
private String homeTeam; private String homeName;
private String awayTeam; private String awayName;
private int homeScore; private Integer homeScore;
private int awayScore; private Integer awayScore;
private String date; private String date;
private String time; private String time;
private String status; // "Scheduled", "Finished", "Live" private String homeLogo;
private String awayLogo;
private String stadium;
public Match() { public Match() {
} }
public Match(String homeTeam, String awayTeam, String date, String time) {
this.homeTeam = homeTeam;
this.awayTeam = awayTeam;
this.date = date;
this.time = time;
this.status = "Scheduled";
}
// Getters and Setters
public String getId() { public String getId() {
return id; return id;
} }
@@ -30,59 +25,93 @@ public class Match {
this.id = id; this.id = id;
} }
public String getHomeTeam() { @PropertyName("home_nome")
return homeTeam; public String getHomeName() {
return homeName;
} }
public void setHomeTeam(String homeTeam) { @PropertyName("home_nome")
this.homeTeam = homeTeam; public void setHomeName(String homeName) {
this.homeName = homeName;
} }
public String getAwayTeam() { @PropertyName("away_nome")
return awayTeam; public String getAwayName() {
return awayName;
} }
public void setAwayTeam(String awayTeam) { @PropertyName("away_nome")
this.awayTeam = awayTeam; public void setAwayName(String awayName) {
this.awayName = awayName;
} }
public int getHomeScore() { @PropertyName("home_golos")
public Integer getHomeScore() {
return homeScore; return homeScore;
} }
public void setHomeScore(int homeScore) { @PropertyName("home_golos")
public void setHomeScore(Integer homeScore) {
this.homeScore = homeScore; this.homeScore = homeScore;
} }
public int getAwayScore() { @PropertyName("away_golos")
public Integer getAwayScore() {
return awayScore; return awayScore;
} }
public void setAwayScore(int awayScore) { @PropertyName("away_golos")
public void setAwayScore(Integer awayScore) {
this.awayScore = awayScore; this.awayScore = awayScore;
} }
@PropertyName("data")
public String getDate() { public String getDate() {
return date; return date;
} }
@PropertyName("data")
public void setDate(String date) { public void setDate(String date) {
this.date = date; this.date = date;
} }
@PropertyName("hora")
public String getTime() { public String getTime() {
return time; return time;
} }
@PropertyName("hora")
public void setTime(String time) { public void setTime(String time) {
this.time = time; this.time = time;
} }
public String getStatus() { @PropertyName("home_logo")
return status; public String getHomeLogo() {
return homeLogo;
} }
public void setStatus(String status) { @PropertyName("home_logo")
this.status = status; public void setHomeLogo(String homeLogo) {
this.homeLogo = homeLogo;
}
@PropertyName("away_logo")
public String getAwayLogo() {
return awayLogo;
}
@PropertyName("away_logo")
public void setAwayLogo(String awayLogo) {
this.awayLogo = awayLogo;
}
@PropertyName("campo")
public String getStadium() {
return stadium;
}
@PropertyName("campo")
public void setStadium(String stadium) {
this.stadium = stadium;
} }
} }

View File

@@ -3,21 +3,32 @@ package com.example.vdcscore.ui.gallery;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
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 java.util.ArrayList;
import java.util.List; import java.util.List;
public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHolder> { public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHolder> {
private List<Match> matches; private List<Match> matches = new ArrayList<>();
public MatchesAdapter() {
}
public MatchesAdapter(List<Match> matches) { public MatchesAdapter(List<Match> matches) {
this.matches = matches; this.matches = (matches != null) ? matches : new ArrayList<>();
}
public void setMatches(List<Match> matches) {
this.matches = (matches != null) ? matches : new ArrayList<>();
notifyDataSetChanged();
} }
@NonNull @NonNull
@@ -31,21 +42,45 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Match match = matches.get(position); Match match = matches.get(position);
holder.textHomeTeam.setText(match.getHomeTeam());
holder.textAwayTeam.setText(match.getAwayTeam());
if ("Finished".equals(match.getStatus())) { // Team Names with fallback
String homeName = match.getHomeName();
String awayName = match.getAwayName();
holder.textHomeTeam.setText(isValid(homeName) ? homeName : "Equipa A");
holder.textAwayTeam.setText(isValid(awayName) ? awayName : "Equipa B");
// Logos
Glide.with(holder.itemView.getContext())
.load(match.getHomeLogo())
.placeholder(R.drawable.ic_club_placeholder)
.into(holder.imgHomeLogo);
Glide.with(holder.itemView.getContext())
.load(match.getAwayLogo())
.placeholder(R.drawable.ic_club_placeholder)
.into(holder.imgAwayLogo);
// Scores and Time
if (match.getHomeScore() != null && match.getAwayScore() != null) {
holder.textScore.setText(match.getHomeScore() + " - " + match.getAwayScore()); holder.textScore.setText(match.getHomeScore() + " - " + match.getAwayScore());
holder.textTime.setText("Final"); holder.textTime.setText(match.getDate() != null ? match.getDate() : "Final");
} else { } else {
holder.textScore.setText("Vs"); holder.textScore.setText("Vs");
holder.textTime.setText(match.getTime()); String timeStr = "";
if (match.getDate() != null) timeStr += match.getDate();
if (match.getTime() != null) timeStr += " " + match.getTime();
holder.textTime.setText(timeStr.trim().isEmpty() ? "Agendado" : timeStr.trim());
} }
} }
private boolean isValid(String text) {
return text != null && !text.trim().isEmpty() && !text.equalsIgnoreCase("null");
}
@Override @Override
public int getItemCount() { public int getItemCount() {
return matches == null ? 0 : matches.size(); return matches.size();
} }
public static class ViewHolder extends RecyclerView.ViewHolder { public static class ViewHolder extends RecyclerView.ViewHolder {
@@ -53,6 +88,8 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
public final TextView textAwayTeam; public final TextView textAwayTeam;
public final TextView textScore; public final TextView textScore;
public final TextView textTime; public final TextView textTime;
public final ImageView imgHomeLogo;
public final ImageView imgAwayLogo;
public ViewHolder(View view) { public ViewHolder(View view) {
super(view); super(view);
@@ -60,6 +97,8 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
textAwayTeam = view.findViewById(R.id.text_away_team); textAwayTeam = view.findViewById(R.id.text_away_team);
textScore = view.findViewById(R.id.text_score); textScore = view.findViewById(R.id.text_score);
textTime = view.findViewById(R.id.text_time); textTime = view.findViewById(R.id.text_time);
imgHomeLogo = view.findViewById(R.id.img_home_logo);
imgAwayLogo = view.findViewById(R.id.img_away_logo);
} }
} }
} }

View File

@@ -39,6 +39,12 @@ public class HomeFragment extends Fragment {
// Initialize RecyclerView // Initialize RecyclerView
adapter = new StandingsAdapter(); adapter = new StandingsAdapter();
adapter.setOnTeamClickListener(team -> {
Bundle bundle = new Bundle();
bundle.putSerializable("clube_selecionado_estatisticas", team);
bundle.putString("escalao", currentEscalao);
androidx.navigation.Navigation.findNavController(root).navigate(R.id.action_nav_home_to_nav_club_detail, bundle);
});
binding.recyclerStandings.setLayoutManager(new LinearLayoutManager(getContext())); binding.recyclerStandings.setLayoutManager(new LinearLayoutManager(getContext()));
binding.recyclerStandings.setAdapter(adapter); binding.recyclerStandings.setAdapter(adapter);
@@ -78,8 +84,12 @@ public class HomeFragment extends Fragment {
try { try {
Team team = postSnapshot.getValue(Team.class); Team team = postSnapshot.getValue(Team.class);
if (team != null) { if (team != null) {
if (team.getTeam_id() == null) { if (team.getTeam_id() == 0) {
team.setTeam_id(postSnapshot.getKey()); try {
team.setTeam_id(Integer.parseInt(postSnapshot.getKey()));
} catch (NumberFormatException e) {
// fallback if key is not a number
}
} }
teams.add(team); teams.add(team);
} }
@@ -88,13 +98,10 @@ public class HomeFragment extends Fragment {
} }
} }
// Sort properly // Set positions after sorting
Collections.sort(teams, (t1, t2) -> { for (int i = 0; i < teams.size(); i++) {
if (t1.getPontos() != t2.getPontos()) { teams.get(i).setPosicao(i + 1);
return t2.getPontos() - t1.getPontos(); }
}
return t2.getDiferenca_golos() - t1.getDiferenca_golos();
});
if (adapter != null) { if (adapter != null) {
adapter.setTeams(teams); adapter.setTeams(teams);

View File

@@ -18,11 +18,20 @@ import com.bumptech.glide.Glide;
public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.ViewHolder> { public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.ViewHolder> {
private List<Team> mTeams; private List<Team> mTeams;
private OnTeamClickListener mListener;
public interface OnTeamClickListener {
void onTeamClick(Team team);
}
public StandingsAdapter() { public StandingsAdapter() {
this.mTeams = new ArrayList<>(); this.mTeams = new ArrayList<>();
} }
public void setOnTeamClickListener(OnTeamClickListener listener) {
this.mListener = listener;
}
public void setTeams(List<Team> teams) { public void setTeams(List<Team> teams) {
this.mTeams = teams; this.mTeams = teams;
notifyDataSetChanged(); notifyDataSetChanged();
@@ -72,6 +81,12 @@ public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.View
holder.textLost.setText(String.valueOf(team.getDerrotas())); holder.textLost.setText(String.valueOf(team.getDerrotas()));
holder.textGoalDiff.setText(String.valueOf(team.getDiferenca_golos())); holder.textGoalDiff.setText(String.valueOf(team.getDiferenca_golos()));
holder.textPoints.setText(String.valueOf(team.getPontos())); holder.textPoints.setText(String.valueOf(team.getPontos()));
holder.itemView.setOnClickListener(v -> {
if (mListener != null) {
mListener.onTeamClick(team);
}
});
} }
@Override @Override

View File

@@ -1,115 +1,118 @@
package com.example.vdcscore.ui.home; package com.example.vdcscore.ui.home;
public class Team { @com.google.firebase.database.IgnoreExtraProperties
private String id; public class Team implements java.io.Serializable {
private String name; private int team_id;
private int points; private String nome;
private int played; private int pontos;
private int won; private int jogos;
private int drawn; private int vitorias;
private int lost; private int empates;
private int goalsFor; private int derrotas;
private int goalsAgainst; private int golos_marcados;
private int goalDifference; private int golos_sofridos;
private String imageUrl; private int diferenca_golos;
private String imagem;
private int posicao;
public Team() { public Team() {
// Required empty constructor for Firebase // Required empty constructor for Firebase
} }
public Team(String id, String name, int points, int played) {
this.id = id;
this.name = name;
this.points = points;
this.played = played;
}
// Getters and Setters // Getters and Setters
public String getId() { public int getTeam_id() {
return id; return team_id;
} }
public void setId(String id) { public void setTeam_id(int team_id) {
this.id = id; this.team_id = team_id;
} }
public String getName() { public String getNome() {
return name; return nome;
} }
public void setName(String name) { public void setNome(String nome) {
this.name = name; this.nome = nome;
} }
public int getPoints() { public int getPontos() {
return points; return pontos;
} }
public void setPoints(int points) { public void setPontos(int pontos) {
this.points = points; this.pontos = pontos;
} }
public int getPlayed() { public int getJogos() {
return played; return jogos;
} }
public void setPlayed(int played) { public void setJogos(int jogos) {
this.played = played; this.jogos = jogos;
} }
public int getWon() { public int getVitorias() {
return won; return vitorias;
} }
public void setWon(int won) { public void setVitorias(int vitorias) {
this.won = won; this.vitorias = vitorias;
} }
public int getDrawn() { public int getEmpates() {
return drawn; return empates;
} }
public void setDrawn(int drawn) { public void setEmpates(int empates) {
this.drawn = drawn; this.empates = empates;
} }
public int getLost() { public int getDerrotas() {
return lost; return derrotas;
} }
public void setLost(int lost) { public void setDerrotas(int derrotas) {
this.lost = lost; this.derrotas = derrotas;
} }
public int getGoalsFor() { public int getGolos_marcados() {
return goalsFor; return golos_marcados;
} }
public void setGoalsFor(int goalsFor) { public void setGolos_marcados(int golos_marcados) {
this.goalsFor = goalsFor; this.golos_marcados = golos_marcados;
} }
public int getGoalsAgainst() { public int getGolos_sofridos() {
return goalsAgainst; return golos_sofridos;
} }
public void setGoalsAgainst(int goalsAgainst) { public void setGolos_sofridos(int golos_sofridos) {
this.goalsAgainst = goalsAgainst; this.golos_sofridos = golos_sofridos;
} }
public int getGoalDifference() { public int getDiferenca_golos() {
return goalDifference; return diferenca_golos;
} }
public void setGoalDifference(int goalDifference) { public void setDiferenca_golos(int diferenca_golos) {
this.goalDifference = goalDifference; this.diferenca_golos = diferenca_golos;
} }
public String getImageUrl() { public String getImagem() {
return imageUrl; return imagem;
} }
public void setImageUrl(String imageUrl) { public void setImagem(String imagem) {
this.imageUrl = imageUrl; this.imagem = imagem;
}
public int getPosicao() {
return posicao;
}
public void setPosicao(int posicao) {
this.posicao = posicao;
} }
} }

View File

@@ -61,150 +61,314 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
<!-- President Section --> <!-- Statistics Header -->
<TextView
android:id="@+id/label_stats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ESTATÍSTICAS:"
android:textSize="14sp"
android:textColor="#616161"
android:layout_marginTop="32dp"
app:layout_constraintTop_toBottomOf="@id/text_detail_club_name"
app:layout_constraintStart_toStartOf="parent"/>
<!-- Stats Container -->
<LinearLayout <LinearLayout
android:id="@+id/layout_president" android:id="@+id/container_stats"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="vertical"
android:gravity="center_vertical" android:layout_marginTop="16dp"
android:layout_marginTop="24dp" app:layout_constraintTop_toBottomOf="@id/label_stats"
app:layout_constraintTop_toBottomOf="@id/text_detail_club_name"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"> app:layout_constraintEnd_toEndOf="parent">
<ImageView <!-- Posicao Row -->
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"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal"
android:layout_marginStart="16dp"> android:gravity="center_vertical"
android:paddingVertical="8dp">
<TextView
android:id="@+id/text_detail_position_circle"
android:layout_width="40dp"
android:layout_height="40dp"
android:gravity="center"
android:text="1"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:background="@drawable/bg_circle_green"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="16dp"
android:text="POSIÇÃO ATUAL:"
android:textSize="12sp"
android:textColor="#616161"/>
<TextView
android:id="@+id/text_detail_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1º"
android:textSize="18sp"
android:textColor="#263238"
android:textStyle="bold"/>
</LinearLayout>
<!-- Pontos 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="#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="PONTOS:"
android:textSize="12sp"
android:textColor="#616161"/>
<TextView
android:id="@+id/text_detail_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30"
android:textSize="18sp"
android:textColor="#D32F2F"
android:textStyle="bold"/>
</LinearLayout>
<View android:layout_width="match_parent" android:layout_height="1dp" android:background="#F5F5F5"/>
<!-- Games 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="#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="JOGOS REALIZADOS:"
android:textSize="12sp"
android:textColor="#616161"/>
<TextView
android:id="@+id/text_detail_played"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:textSize="16sp"
android:textColor="#263238"
android:textStyle="bold"/>
</LinearLayout>
<!-- W/D/L Summary -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="56dp"
android:paddingBottom="8dp">
<TextView <TextView
android:id="@+id/text_detail_won"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="PRESIDENTE:" android:text="10V"
android:textSize="12sp" android:textColor="#388E3C"
android:textColor="#616161"/> android:textStyle="bold"
android:textSize="14sp"
android:layout_marginEnd="16dp"/>
<TextView <TextView
android:id="@+id/text_detail_president" android:id="@+id/text_detail_drawn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="João Silva" android:text="0E"
android:textSize="16sp" android:textColor="#FBC02D"
android:textColor="#263238" android:textStyle="bold"
android:textStyle="bold"/> android:textSize="14sp"
android:layout_marginEnd="16dp"/>
<TextView
android:id="@+id/text_detail_lost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0D"
android:textColor="#D32F2F"
android:textStyle="bold"
android:textSize="14sp"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
<!-- Address Section --> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#F5F5F5"/>
<LinearLayout
android:id="@+id/layout_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/layout_president"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_location"
app:tint="#455A64"
android:background="@drawable/circle_edit_background"
android:backgroundTint="#ECEFF1"
android:padding="8dp"/>
<!-- Goals Row -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal"
android:layout_marginStart="16dp"> android:gravity="center_vertical"
android:paddingVertical="8dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_soccer"
app:tint="#455A64"
android:background="@drawable/circle_edit_background"
android:backgroundTint="#ECEFF1"
android:padding="8dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="MORADA:" android:layout_weight="1"
android:layout_marginStart="16dp"
android:text="GOLOS (M-S):"
android:textSize="12sp" android:textSize="12sp"
android:textColor="#616161"/> android:textColor="#616161"/>
<TextView <TextView
android:id="@+id/text_detail_address" android:id="@+id/text_detail_goals"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="Rua Desportiva 123" android:text="54 - 8"
android:textSize="16sp" android:textSize="16sp"
android:textColor="#263238" android:textColor="#263238"
android:textStyle="bold"/> android:textStyle="bold"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
<!-- Foundation Section -->
<LinearLayout
android:id="@+id/layout_foundation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@id/layout_address"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_calendar"
app:tint="#455A64"
android:background="@drawable/circle_edit_background"
android:backgroundTint="#ECEFF1"
android:padding="8dp"/>
<!-- Goal Diff Row -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="horizontal"
android:layout_marginStart="16dp"> android:gravity="center_vertical"
android:paddingVertical="8dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_soccer"
app:tint="#7B1FA2"
android:background="@drawable/circle_edit_background"
android:backgroundTint="#F3E5F5"
android:padding="8dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="ANO DE FUNDAÇÃO:" android:layout_weight="1"
android:layout_marginStart="16dp"
android:text="DIFERENÇA DE GOLOS:"
android:textSize="12sp" android:textSize="12sp"
android:textColor="#616161"/> android:textColor="#616161"/>
<TextView <TextView
android:id="@+id/text_detail_foundation" android:id="@+id/text_detail_goal_diff"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="1995" android:text="+46"
android:textSize="16sp" android:textSize="16sp"
android:textColor="#263238" android:textColor="#7B1FA2"
android:textStyle="bold"/> android:textStyle="bold"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
<!-- Comparison Button -->
<Button
android:id="@+id/btn_compare"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="COMPARAR ESTATÍSTICAS"
android:layout_marginTop="24dp"
app:cornerRadius="12dp"
android:backgroundTint="#FFC107"
android:textColor="@color/black"
app:layout_constraintTop_toBottomOf="@id/container_stats"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<!-- Comparison View (Hidden initially) -->
<LinearLayout
android:id="@+id/layout_comparison"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:layout_marginTop="16dp"
android:padding="12dp"
android:background="@drawable/shape_score_bg"
app:layout_constraintTop_toBottomOf="@id/btn_compare">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CONFRONTO DIRETO"
android:textStyle="bold"
android:textSize="14sp"
android:layout_gravity="center"
android:layout_marginBottom="8dp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow android:padding="4dp">
<View android:layout_width="0dp" android:layout_weight="1"/>
<TextView android:id="@+id/text_compare_team1" android:text="Equipa A" android:textStyle="bold" android:gravity="center" android:layout_width="0dp" android:layout_weight="2"/>
<TextView android:id="@+id/text_compare_team2" android:text="Equipa B" android:textStyle="bold" android:gravity="center" android:layout_width="0dp" android:layout_weight="2"/>
</TableRow>
<TableRow android:padding="4dp">
<TextView android:text="Pontos" android:textSize="12sp" android:layout_width="0dp" android:layout_weight="1"/>
<TextView android:id="@+id/text_compare_p1" android:text="30" android:gravity="center" android:layout_width="0dp" android:layout_weight="2"/>
<TextView android:id="@+id/text_compare_p2" android:text="20" android:gravity="center" android:layout_width="0dp" android:layout_weight="2"/>
</TableRow>
<TableRow android:padding="4dp">
<TextView android:text="Golos" android:textSize="12sp" android:layout_width="0dp" android:layout_weight="1"/>
<TextView android:id="@+id/text_compare_g1" android:text="50" android:gravity="center" android:layout_width="0dp" android:layout_weight="2"/>
<TextView android:id="@+id/text_compare_g2" android:text="30" android:gravity="center" android:layout_width="0dp" android:layout_weight="2"/>
</TableRow>
</TableLayout>
</LinearLayout> </LinearLayout>
<!-- Stadium Section (Hidden per screenshot but kept in model, or should I show it?)
The screenshot doesn't explicitly show Stadium but the code had it.
I will hide it for now to match screenshot strictly or add it if plenty space?
The user said "appears like this", implies following the screenshot.
But previously stadium was shown. I will add it as well for completeness if it fits,
or just omit if the screenshot is strict.
Screenshot: CLUBE, PRESIDENTE, MORADA, ANO DE FUNDACAO. No Stadium.
I will omit Stadium from UI to match unique request "like this".
-->
<!-- Players Button --> <!-- Players Button -->
<Button <Button
@@ -223,7 +387,7 @@
app:iconTint="@color/white" app:iconTint="@color/white"
android:gravity="center" android:gravity="center"
android:layout_marginTop="40dp" android:layout_marginTop="40dp"
app:layout_constraintTop_toBottomOf="@id/layout_foundation" app:layout_constraintTop_toBottomOf="@id/layout_comparison"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="1.0" app:layout_constraintVertical_bias="1.0"
android:layout_marginBottom="20dp"/> android:layout_marginBottom="20dp"/>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -9,19 +10,91 @@
tools:context=".ui.gallery.GalleryFragment"> tools:context=".ui.gallery.GalleryFragment">
<TextView <TextView
android:id="@+id/text_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Jornadas" android:text="Jornadas"
android:textSize="24sp" android:textSize="28sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/primary_color" android:textColor="@color/primary_color"
android:layout_marginBottom="16dp" /> android:layout_marginBottom="16dp" />
<!-- Category Toggle -->
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/toggle_group_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
app:singleSelection="true"
app:selectionRequired="true"
app:checkedButton="@+id/btn_seniores">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_seniores"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Seniores"
android:textAllCaps="false" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_juniores"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Juniores"
android:textAllCaps="false" />
</com.google.android.material.button.MaterialButtonToggleGroup>
<!-- Matchday Navigation -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:background="@drawable/bg_jornada_nav"
android:padding="8dp"
android:layout_marginBottom="16dp">
<ImageButton
android:id="@+id/btn_prev_jornada"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@android:drawable/ic_media_previous"
android:contentDescription="Anterior"
app:tint="@color/primary_color" />
<TextView
android:id="@+id/text_jornada_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Carregando..."
android:textSize="18sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="@color/text_primary" />
<ImageButton
android:id="@+id/btn_next_jornada"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@android:drawable/ic_media_next"
android:contentDescription="Próxima"
app:tint="@color/primary_color" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_matchdays" android:id="@+id/recycler_matchdays"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:paddingBottom="16dp"/> android:paddingBottom="16dp"
tools:listitem="@layout/item_match"/>
</LinearLayout> </LinearLayout>

View File

@@ -1,30 +1,50 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center_vertical" android:gravity="center_vertical"
android:padding="8dp"> android:padding="12dp"
android:layout_marginBottom="8dp"
android:background="@drawable/bg_match_item">
<!-- Home Team --> <!-- Home Team Section -->
<TextView <LinearLayout
android:id="@+id/text_home_team"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="end" android:gravity="center_vertical|end"
android:text="Home" android:orientation="horizontal">
android:textStyle="bold"
android:textColor="@color/text_primary" />
<!-- Score / Time --> <TextView
android:id="@+id/text_home_team"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:text="Home"
android:textStyle="bold"
android:textColor="@color/text_primary"
android:layout_marginEnd="8dp" />
<ImageView
android:id="@+id/img_home_logo"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:scaleType="centerInside"
android:src="@drawable/ic_club_placeholder" />
</LinearLayout>
<!-- Score / Time Section -->
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp" android:layout_marginHorizontal="12dp"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:minWidth="60dp"> android:minWidth="70dp">
<TextView <TextView
android:id="@+id/text_score" android:id="@+id/text_score"
@@ -32,27 +52,44 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Vs" android:text="Vs"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/secondary_color" android:textColor="@color/primary_color"
android:textSize="16sp" /> android:textSize="18sp" />
<TextView <TextView
android:id="@+id/text_time" android:id="@+id/text_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="15:00" android:text="15:00"
android:textSize="12sp" android:textSize="11sp"
android:textColor="@color/text_secondary" /> android:textColor="@color/text_secondary" />
</LinearLayout> </LinearLayout>
<!-- Away Team --> <!-- Away Team Section -->
<TextView <LinearLayout
android:id="@+id/text_away_team"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start" android:gravity="center_vertical|start"
android:text="Away" android:orientation="horizontal">
android:textStyle="bold"
android:textColor="@color/text_primary" /> <ImageView
android:id="@+id/img_away_logo"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
android:scaleType="centerInside"
android:src="@drawable/ic_club_placeholder" />
<TextView
android:id="@+id/text_away_team"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="Away"
android:textStyle="bold"
android:textColor="@color/text_primary"
android:layout_marginStart="8dp" />
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -9,7 +9,11 @@
android:id="@+id/nav_home" android:id="@+id/nav_home"
android:name="com.example.vdcscore.ui.home.HomeFragment" android:name="com.example.vdcscore.ui.home.HomeFragment"
android:label="@string/menu_home" android:label="@string/menu_home"
tools:layout="@layout/fragment_home" /> tools:layout="@layout/fragment_home">
<action
android:id="@+id/action_nav_home_to_nav_club_detail"
app:destination="@id/nav_club_detail" />
</fragment>
<fragment <fragment
android:id="@+id/nav_gallery" android:id="@+id/nav_gallery"