.
This commit is contained in:
@@ -9,6 +9,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.vdcscore.R;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -73,6 +74,16 @@ public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.View
|
||||
holder.textLost.setText(String.valueOf(team.getLost()));
|
||||
holder.textGoalDiff.setText(String.valueOf(team.getGoalDifference()));
|
||||
holder.textPoints.setText(String.valueOf(team.getPoints()));
|
||||
|
||||
if (team.getImageUrl() != null && !team.getImageUrl().isEmpty()) {
|
||||
Glide.with(holder.itemView.getContext())
|
||||
.load(team.getImageUrl())
|
||||
.placeholder(R.mipmap.ic_launcher)
|
||||
.error(R.mipmap.ic_launcher)
|
||||
.into(holder.imageLogo);
|
||||
} else {
|
||||
holder.imageLogo.setImageResource(R.mipmap.ic_launcher);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,45 +1,106 @@
|
||||
package com.example.vdcscore.ui.home;
|
||||
|
||||
import com.google.firebase.database.Exclude;
|
||||
import com.google.firebase.database.IgnoreExtraProperties;
|
||||
|
||||
@IgnoreExtraProperties
|
||||
public class Team {
|
||||
@Exclude
|
||||
private String id;
|
||||
|
||||
// Nomes exatos dos nós na Base de Dados
|
||||
public String nome;
|
||||
public int pontos;
|
||||
public int jogos;
|
||||
public int empates;
|
||||
public int derrotas;
|
||||
public int diferenca_golos;
|
||||
public int golos_marcados;
|
||||
public int golos_sofridos;
|
||||
public String imagem;
|
||||
private String name;
|
||||
private int points;
|
||||
private int played;
|
||||
private int won;
|
||||
private int drawn;
|
||||
private int lost;
|
||||
private int goalsFor;
|
||||
private int goalsAgainst;
|
||||
private int goalDifference;
|
||||
|
||||
public Team() {
|
||||
// Necessário pelo Firebase
|
||||
// Required empty constructor for Firebase
|
||||
}
|
||||
|
||||
// Apenas usados para consumo na UI, ignorados na leitura direta do Firebase
|
||||
@Exclude public String getId() { return id; }
|
||||
@Exclude public void setId(String id) { this.id = id; }
|
||||
|
||||
@Exclude public String getName() { return nome; }
|
||||
@Exclude public int getPlayed() { return jogos; }
|
||||
|
||||
@Exclude public int getWon() {
|
||||
if (pontos > 0) return (pontos - empates) / 3;
|
||||
return 0;
|
||||
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
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(int points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public int getPlayed() {
|
||||
return played;
|
||||
}
|
||||
|
||||
public void setPlayed(int played) {
|
||||
this.played = played;
|
||||
}
|
||||
|
||||
public int getWon() {
|
||||
return won;
|
||||
}
|
||||
|
||||
public void setWon(int won) {
|
||||
this.won = won;
|
||||
}
|
||||
|
||||
public int getDrawn() {
|
||||
return drawn;
|
||||
}
|
||||
|
||||
public void setDrawn(int drawn) {
|
||||
this.drawn = drawn;
|
||||
}
|
||||
|
||||
public int getLost() {
|
||||
return lost;
|
||||
}
|
||||
|
||||
public void setLost(int lost) {
|
||||
this.lost = lost;
|
||||
}
|
||||
|
||||
public int getGoalsFor() {
|
||||
return goalsFor;
|
||||
}
|
||||
|
||||
public void setGoalsFor(int goalsFor) {
|
||||
this.goalsFor = goalsFor;
|
||||
}
|
||||
|
||||
public int getGoalsAgainst() {
|
||||
return goalsAgainst;
|
||||
}
|
||||
|
||||
public void setGoalsAgainst(int goalsAgainst) {
|
||||
this.goalsAgainst = goalsAgainst;
|
||||
}
|
||||
|
||||
public int getGoalDifference() {
|
||||
return goalDifference;
|
||||
}
|
||||
|
||||
public void setGoalDifference(int goalDifference) {
|
||||
this.goalDifference = goalDifference;
|
||||
}
|
||||
|
||||
@Exclude public int getDrawn() { return empates; }
|
||||
@Exclude public int getLost() { return derrotas; }
|
||||
@Exclude public int getGoalDifference() { return diferenca_golos; }
|
||||
@Exclude public int getGoalsFor() { return golos_marcados; }
|
||||
@Exclude public int getGoalsAgainst() { return golos_sofridos; }
|
||||
@Exclude public int getPoints() { return pontos; }
|
||||
@Exclude public String getImageUrl() { return imagem; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user