.
This commit is contained in:
@@ -133,7 +133,7 @@ public class GalleryFragment extends Fragment {
|
||||
if (matchdaysList.isEmpty()) return;
|
||||
|
||||
Matchday currentMatchday = matchdaysList.get(currentJornadaIndex);
|
||||
binding.textJornadaName.setText(currentMatchday.getName());
|
||||
binding.textJornadaName.setText(formatJornadaName(currentMatchday.getName()));
|
||||
adapter.setMatches(currentMatchday.getMatches());
|
||||
|
||||
// Enable/Disable navigation buttons
|
||||
@@ -145,6 +145,18 @@ public class GalleryFragment extends Fragment {
|
||||
binding.btnNextJornada.setAlpha(currentJornadaIndex < matchdaysList.size() - 1 ? 1.0f : 0.3f);
|
||||
}
|
||||
|
||||
private String formatJornadaName(String name) {
|
||||
if (name == null) return "---";
|
||||
// If the name is just a number, format it as "Xª Jornada"
|
||||
try {
|
||||
int num = Integer.parseInt(name);
|
||||
return num + "ª Jornada";
|
||||
} catch (NumberFormatException e) {
|
||||
// If it's already a full name like "Jornada 1", return as is
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
@@ -35,6 +35,16 @@ public class Match {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("home_equipa")
|
||||
public void setHomeEquipa(String homeName) {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("equipa_casa")
|
||||
public void setEquipaCasa(String homeName) {
|
||||
this.homeName = homeName;
|
||||
}
|
||||
|
||||
@PropertyName("away_nome")
|
||||
public String getAwayName() {
|
||||
return awayName;
|
||||
@@ -45,6 +55,16 @@ public class Match {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("away_equipa")
|
||||
public void setAwayEquipa(String awayName) {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("equipa_fora")
|
||||
public void setEquipaFora(String awayName) {
|
||||
this.awayName = awayName;
|
||||
}
|
||||
|
||||
@PropertyName("home_golos")
|
||||
public Integer getHomeScore() {
|
||||
return homeScore;
|
||||
@@ -95,6 +115,11 @@ public class Match {
|
||||
this.homeLogo = homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("logo_casa")
|
||||
public void setLogoCasa(String homeLogo) {
|
||||
this.homeLogo = homeLogo;
|
||||
}
|
||||
|
||||
@PropertyName("away_logo")
|
||||
public String getAwayLogo() {
|
||||
return awayLogo;
|
||||
@@ -105,6 +130,11 @@ public class Match {
|
||||
this.awayLogo = awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("logo_fora")
|
||||
public void setLogoFora(String awayLogo) {
|
||||
this.awayLogo = awayLogo;
|
||||
}
|
||||
|
||||
@PropertyName("campo")
|
||||
public String getStadium() {
|
||||
return stadium;
|
||||
|
||||
@@ -61,17 +61,28 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
|
||||
.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.textTime.setText(match.getDate() != null ? match.getDate() : "Final");
|
||||
// Scores
|
||||
if (match.getHomeScore() != null) {
|
||||
holder.textHomeScore.setText(String.valueOf(match.getHomeScore()));
|
||||
} else {
|
||||
holder.textScore.setText("Vs");
|
||||
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());
|
||||
holder.textHomeScore.setText("-");
|
||||
}
|
||||
|
||||
if (match.getAwayScore() != null) {
|
||||
holder.textAwayScore.setText(String.valueOf(match.getAwayScore()));
|
||||
} else {
|
||||
holder.textAwayScore.setText("-");
|
||||
}
|
||||
|
||||
// Match Info (Date/Time)
|
||||
String dateStr = match.getDate() != null ? match.getDate() : "";
|
||||
String timeStr = match.getTime() != null ? match.getTime() : "";
|
||||
String fullInfo = (dateStr + " " + timeStr).trim();
|
||||
holder.textMatchInfo.setText(fullInfo.isEmpty() ? "Data a definir" : fullInfo);
|
||||
|
||||
// Stadium
|
||||
String stadium = match.getStadium();
|
||||
holder.textStadium.setText(isValid(stadium) ? "Campo: " + stadium : "Campo a definir");
|
||||
}
|
||||
|
||||
private boolean isValid(String text) {
|
||||
@@ -86,8 +97,10 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final TextView textHomeTeam;
|
||||
public final TextView textAwayTeam;
|
||||
public final TextView textScore;
|
||||
public final TextView textTime;
|
||||
public final TextView textHomeScore;
|
||||
public final TextView textAwayScore;
|
||||
public final TextView textMatchInfo;
|
||||
public final TextView textStadium;
|
||||
public final ImageView imgHomeLogo;
|
||||
public final ImageView imgAwayLogo;
|
||||
|
||||
@@ -95,8 +108,10 @@ public class MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHold
|
||||
super(view);
|
||||
textHomeTeam = view.findViewById(R.id.text_home_team);
|
||||
textAwayTeam = view.findViewById(R.id.text_away_team);
|
||||
textScore = view.findViewById(R.id.text_score);
|
||||
textTime = view.findViewById(R.id.text_time);
|
||||
textHomeScore = view.findViewById(R.id.text_home_score);
|
||||
textAwayScore = view.findViewById(R.id.text_away_score);
|
||||
textMatchInfo = view.findViewById(R.id.text_match_info);
|
||||
textStadium = view.findViewById(R.id.text_match_stadium);
|
||||
imgHomeLogo = view.findViewById(R.id.img_home_logo);
|
||||
imgAwayLogo = view.findViewById(R.id.img_away_logo);
|
||||
}
|
||||
|
||||
@@ -1,95 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.google.android.material.card.MaterialCardView 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_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/bg_match_item">
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp"
|
||||
app:strokeWidth="0dp">
|
||||
|
||||
<!-- Home Team Section -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:minWidth="70dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:padding="12dp">
|
||||
|
||||
<!-- Header: Date, Time and Stadium -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Vs"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/primary_color"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_match_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="29/03/2026 10:00"
|
||||
android:textColor="#1976D2"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<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" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#BBDEFB"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<!-- Teams and Scores -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="15:00"
|
||||
android:textSize="11sp"
|
||||
android:textColor="@color/text_secondary" />
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- Home Team -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_home_logo"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="4dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_club_placeholder" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_home_team"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="J.U. Mosteiró"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Score Section -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_home_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2"
|
||||
android:textColor="#0D47A1"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="#E3F2FD"
|
||||
android:layout_marginHorizontal="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_away_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
android:textColor="#0D47A1"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Away Team -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_away_logo"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:padding="4dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_club_placeholder" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_away_team"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="G.D.C. Rio Mau"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Away Team Section -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|start"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
Reference in New Issue
Block a user