diff --git a/app/src/main/java/com/example/vdcscore/MainActivity.java b/app/src/main/java/com/example/vdcscore/MainActivity.java index 06b4223..f82e127 100644 --- a/app/src/main/java/com/example/vdcscore/MainActivity.java +++ b/app/src/main/java/com/example/vdcscore/MainActivity.java @@ -70,7 +70,7 @@ public class MainActivity extends AppCompatActivity { // menu should be considered as top level destinations. mAppBarConfiguration = new AppBarConfiguration.Builder( R.id.nav_home, R.id.nav_gallery, R.id.nav_definicoes, - R.id.nav_live_games, R.id.nav_clubs) + R.id.nav_live_games, R.id.nav_clubs, R.id.nav_top_scorers) .setOpenableLayout(drawer) .build(); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main); diff --git a/app/src/main/java/com/example/vdcscore/ui/gallery/GalleryFragment.java b/app/src/main/java/com/example/vdcscore/ui/gallery/GalleryFragment.java index 89bb036..a852084 100644 --- a/app/src/main/java/com/example/vdcscore/ui/gallery/GalleryFragment.java +++ b/app/src/main/java/com/example/vdcscore/ui/gallery/GalleryFragment.java @@ -19,6 +19,8 @@ import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; public class GalleryFragment extends Fragment { @@ -106,6 +108,20 @@ public class GalleryFragment extends Fragment { } } + // Sort matchdays numerically (e.g. "1" before "10") + Collections.sort(matchdaysList, new Comparator() { + @Override + public int compare(Matchday m1, Matchday m2) { + try { + Integer num1 = Integer.parseInt(m1.getName()); + Integer num2 = Integer.parseInt(m2.getName()); + return num1.compareTo(num2); + } catch (NumberFormatException e) { + return m1.getName().compareTo(m2.getName()); + } + } + }); + if (matchdaysList.isEmpty()) { binding.textJornadaName.setText("Sem jornadas"); adapter.setMatches(new ArrayList<>()); diff --git a/app/src/main/java/com/example/vdcscore/ui/gallery/Match.java b/app/src/main/java/com/example/vdcscore/ui/gallery/Match.java index 05cec12..5dbd200 100644 --- a/app/src/main/java/com/example/vdcscore/ui/gallery/Match.java +++ b/app/src/main/java/com/example/vdcscore/ui/gallery/Match.java @@ -13,6 +13,7 @@ public class Match { private String homeLogo; private String awayLogo; private String stadium; + private String matchReportUrl; public Match() { } @@ -184,4 +185,14 @@ public class Match { public void setStadium(String stadium) { this.stadium = stadium; } + + @PropertyName("matchReportUrl") + public String getMatchReportUrl() { + return matchReportUrl; + } + + @PropertyName("matchReportUrl") + public void setMatchReportUrl(String matchReportUrl) { + this.matchReportUrl = matchReportUrl; + } } diff --git a/app/src/main/java/com/example/vdcscore/ui/gallery/MatchesAdapter.java b/app/src/main/java/com/example/vdcscore/ui/gallery/MatchesAdapter.java index 542c4d4..188a2ff 100644 --- a/app/src/main/java/com/example/vdcscore/ui/gallery/MatchesAdapter.java +++ b/app/src/main/java/com/example/vdcscore/ui/gallery/MatchesAdapter.java @@ -12,6 +12,8 @@ import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.example.vdcscore.R; +import android.content.Intent; +import android.net.Uri; import java.util.ArrayList; import java.util.List; @@ -87,6 +89,18 @@ public class MatchesAdapter extends RecyclerView.Adapter { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(match.getMatchReportUrl())); + holder.itemView.getContext().startActivity(browserIntent); + }); + } else { + holder.btnMatchReport.setVisibility(View.GONE); + holder.btnMatchReport.setOnClickListener(null); + } } private boolean isValid(String text) { @@ -107,6 +121,7 @@ public class MatchesAdapter extends RecyclerView.Adapter + + + diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index 1a02cb3..840f1ae 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -24,5 +24,9 @@ android:id="@+id/nav_definicoes" android:icon="@android:drawable/ic_menu_preferences" android:title="@string/menu_definicoes" /> + \ No newline at end of file diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 509a1e2..8f580b6 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -96,4 +96,10 @@ app:argType="com.example.vdcscore.models.Player" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a97bac8..5e9bc29 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,6 +14,7 @@ Jogos ao Vivo Detalhes do Jogo Clubes + Melhores Marcadores Alterar Foto de Perfil diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 95d88c5..0be60da 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -33,4 +33,9 @@ \ No newline at end of file