This commit is contained in:
2026-04-21 15:34:34 +01:00
parent 6a1e604b96
commit 5061b49f6e
5 changed files with 217 additions and 110 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp">
<!-- Header: Date, Time and Stadium -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="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:gravity="center"
android:orientation="horizontal">
<!-- Home Team -->
<LinearLayout
android:layout_width="0dp"
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" />
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/img_home_logo"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
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 / Time Section -->
<!-- Score 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">
android:layout_marginHorizontal="16dp"
android:orientation="horizontal">
<TextView
android:id="@+id/text_score"
android:id="@+id/text_home_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vs"
android:textStyle="bold"
android:textColor="@color/primary_color"
android:textSize="18sp" />
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_time"
android:id="@+id/text_away_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15:00"
android:textSize="11sp"
android:textColor="@color/text_secondary" />
android:text="4"
android:textColor="#0D47A1"
android:textSize="32sp"
android:textStyle="bold" />
</LinearLayout>
<!-- Away Team Section -->
<!-- Away Team -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|start"
android:orientation="horizontal">
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/img_away_logo"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="2dp"
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="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="Away"
android:textStyle="bold"
android:layout_marginTop="8dp"
android:text="G.D.C. Rio Mau"
android:textColor="@color/text_primary"
android:layout_marginStart="8dp" />
android:textSize="13sp"
android:textStyle="bold"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -1,21 +1,16 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
#Tue Apr 21 15:33:57 WEST 2026
android.nonTransitiveRClass=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1536M" -Dfile.encoding\=UTF-8