ver jogos ao vivo e ver os clubes
This commit is contained in:
41
app/src/main/java/com/example/vdcscore/ui/clubs/Club.java
Normal file
41
app/src/main/java/com/example/vdcscore/ui/clubs/Club.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.example.vdcscore.ui.clubs;
|
||||
|
||||
public class Club {
|
||||
private String name;
|
||||
private String stadium;
|
||||
private String logoUrl;
|
||||
|
||||
public Club() {
|
||||
// Default constructor required for calls to DataSnapshot.getValue(Club.class)
|
||||
}
|
||||
|
||||
public Club(String name, String stadium, String logoUrl) {
|
||||
this.name = name;
|
||||
this.stadium = stadium;
|
||||
this.logoUrl = logoUrl;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStadium() {
|
||||
return stadium;
|
||||
}
|
||||
|
||||
public void setStadium(String stadium) {
|
||||
this.stadium = stadium;
|
||||
}
|
||||
|
||||
public String getLogoUrl() {
|
||||
return logoUrl;
|
||||
}
|
||||
|
||||
public void setLogoUrl(String logoUrl) {
|
||||
this.logoUrl = logoUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.example.vdcscore.ui.clubs;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.vdcscore.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ClubAdapter extends RecyclerView.Adapter<ClubAdapter.ClubViewHolder> {
|
||||
|
||||
private final List<Club> mClubs;
|
||||
|
||||
public ClubAdapter(List<Club> clubs) {
|
||||
mClubs = clubs;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ClubViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.item_club, parent, false);
|
||||
return new ClubViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ClubViewHolder holder, int position) {
|
||||
Club club = mClubs.get(position);
|
||||
holder.bind(club);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mClubs.size();
|
||||
}
|
||||
|
||||
static class ClubViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView name;
|
||||
private final TextView stadium;
|
||||
private final ImageView logo;
|
||||
|
||||
public ClubViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
name = itemView.findViewById(R.id.text_club_name);
|
||||
stadium = itemView.findViewById(R.id.text_club_stadium);
|
||||
logo = itemView.findViewById(R.id.image_club_logo);
|
||||
}
|
||||
|
||||
public void bind(final Club club) {
|
||||
name.setText(club.getName());
|
||||
stadium.setText(club.getStadium());
|
||||
// TODO: Load image from logoUrl using a library like Glide or Picasso
|
||||
// For now we leave the default placeholder
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.example.vdcscore.ui.clubs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.vdcscore.R;
|
||||
import com.example.vdcscore.databinding.FragmentClubsBinding;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ClubsFragment extends Fragment {
|
||||
|
||||
private FragmentClubsBinding binding;
|
||||
private DatabaseReference mDatabase;
|
||||
private static final String TAG = "ClubsFragment";
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FragmentClubsBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
mDatabase = FirebaseDatabase.getInstance().getReference().child("clubs");
|
||||
|
||||
RecyclerView recyclerView = binding.recyclerClubs;
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
ProgressBar progressBar = binding.progressBar;
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
mDatabase.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||
List<Club> clubs = new ArrayList<>();
|
||||
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||
Club club = postSnapshot.getValue(Club.class);
|
||||
clubs.add(club);
|
||||
}
|
||||
ClubAdapter adapter = new ClubAdapter(clubs);
|
||||
recyclerView.setAdapter(adapter);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
if (clubs.isEmpty()) {
|
||||
// Add mock data if empty for demonstration
|
||||
addMockClubsIfEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError error) {
|
||||
Log.w(TAG, "loadClubs:onCancelled", error.toException());
|
||||
Toast.makeText(getContext(), "Failed to load clubs.", Toast.LENGTH_SHORT).show();
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private void addMockClubsIfEmpty() {
|
||||
// If database is empty, optional helper to add data?
|
||||
// For now, let's keep it strictly reading from Firebase or showing empty state.
|
||||
// But to ensure user sees something if they haven't set up DB yet:
|
||||
List<Club> mockClubs = new ArrayList<>();
|
||||
mockClubs.add(new Club("VDC", "Campo Principal", ""));
|
||||
mockClubs.add(new Club("Benfica", "Estádio da Luz", ""));
|
||||
ClubAdapter adapter = new ClubAdapter(mockClubs);
|
||||
binding.recyclerClubs.setAdapter(adapter);
|
||||
|
||||
Toast.makeText(getContext(), "No clubs found in Firebase. Showing mock data.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.example.vdcscore.ui.livegames;
|
||||
|
||||
public class Game {
|
||||
private String id;
|
||||
private String homeTeam;
|
||||
private String awayTeam;
|
||||
private int homeScore;
|
||||
private int awayScore;
|
||||
private String time;
|
||||
private int homePossession;
|
||||
private int awayPossession;
|
||||
private int homeShots;
|
||||
private int awayShots;
|
||||
|
||||
public Game(String id, String homeTeam, String awayTeam, int homeScore, int awayScore, String time) {
|
||||
this.id = id;
|
||||
this.homeTeam = homeTeam;
|
||||
this.awayTeam = awayTeam;
|
||||
this.homeScore = homeScore;
|
||||
this.awayScore = awayScore;
|
||||
this.time = time;
|
||||
// Default mocked stats
|
||||
this.homePossession = 50;
|
||||
this.awayPossession = 50;
|
||||
this.homeShots = 5;
|
||||
this.awayShots = 3;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getHomeTeam() {
|
||||
return homeTeam;
|
||||
}
|
||||
|
||||
public String getAwayTeam() {
|
||||
return awayTeam;
|
||||
}
|
||||
|
||||
public int getHomeScore() {
|
||||
return homeScore;
|
||||
}
|
||||
|
||||
public int getAwayScore() {
|
||||
return awayScore;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public int getHomePossession() {
|
||||
return homePossession;
|
||||
}
|
||||
|
||||
public int getAwayPossession() {
|
||||
return awayPossession;
|
||||
}
|
||||
|
||||
public int getHomeShots() {
|
||||
return homeShots;
|
||||
}
|
||||
|
||||
public int getAwayShots() {
|
||||
return awayShots;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.example.vdcscore.ui.livegames;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.vdcscore.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GameAdapter extends RecyclerView.Adapter<GameAdapter.GameViewHolder> {
|
||||
|
||||
private final List<Game> mGames;
|
||||
private final OnGameClickListener mListener;
|
||||
|
||||
public interface OnGameClickListener {
|
||||
void onGameClick(Game game);
|
||||
}
|
||||
|
||||
public GameAdapter(List<Game> games, OnGameClickListener listener) {
|
||||
mGames = games;
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public GameViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.item_live_game, parent, false);
|
||||
return new GameViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GameViewHolder holder, int position) {
|
||||
Game game = mGames.get(position);
|
||||
holder.bind(game, mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mGames.size();
|
||||
}
|
||||
|
||||
static class GameViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView time;
|
||||
private final TextView homeTeam;
|
||||
private final TextView awayTeam;
|
||||
private final TextView score;
|
||||
|
||||
public GameViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
time = itemView.findViewById(R.id.text_game_time);
|
||||
homeTeam = itemView.findViewById(R.id.text_home_team);
|
||||
awayTeam = itemView.findViewById(R.id.text_away_team);
|
||||
score = itemView.findViewById(R.id.text_score);
|
||||
}
|
||||
|
||||
public void bind(final Game game, final OnGameClickListener listener) {
|
||||
time.setText(game.getTime());
|
||||
homeTeam.setText(game.getHomeTeam());
|
||||
awayTeam.setText(game.getAwayTeam());
|
||||
score.setText(game.getHomeScore() + " - " + game.getAwayScore());
|
||||
|
||||
itemView.setOnClickListener(v -> listener.onGameClick(game));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.vdcscore.ui.livegames;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GameViewModel extends ViewModel {
|
||||
|
||||
private final MutableLiveData<List<Game>> mGames;
|
||||
private final MutableLiveData<Game> mSelectedGame;
|
||||
|
||||
public GameViewModel() {
|
||||
mGames = new MutableLiveData<>();
|
||||
mSelectedGame = new MutableLiveData<>();
|
||||
loadMockGames();
|
||||
}
|
||||
|
||||
public LiveData<List<Game>> getGames() {
|
||||
return mGames;
|
||||
}
|
||||
|
||||
public LiveData<Game> getSelectedGame() {
|
||||
return mSelectedGame;
|
||||
}
|
||||
|
||||
public void selectGame(Game game) {
|
||||
mSelectedGame.setValue(game);
|
||||
}
|
||||
|
||||
private void loadMockGames() {
|
||||
List<Game> games = new ArrayList<>();
|
||||
games.add(new Game("1", "VDC", "Benfica", 2, 1, "45'"));
|
||||
games.add(new Game("2", "Sporting", "Porto", 0, 0, "12'"));
|
||||
games.add(new Game("3", "Braga", "V. Guimarães", 1, 3, "88'"));
|
||||
mGames.setValue(games);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.example.vdcscore.ui.livegames;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.example.vdcscore.R;
|
||||
import com.example.vdcscore.databinding.FragmentLiveGameDetailBinding;
|
||||
|
||||
public class LiveGameDetailFragment extends Fragment {
|
||||
|
||||
private FragmentLiveGameDetailBinding binding;
|
||||
private GameViewModel gameViewModel;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
gameViewModel = new ViewModelProvider(requireActivity()).get(GameViewModel.class);
|
||||
|
||||
binding = FragmentLiveGameDetailBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
gameViewModel.getSelectedGame().observe(getViewLifecycleOwner(), game -> {
|
||||
if (game != null) {
|
||||
binding.detailGameTime.setText(game.getTime());
|
||||
binding.detailHomeTeam.setText(game.getHomeTeam());
|
||||
binding.detailAwayTeam.setText(game.getAwayTeam());
|
||||
binding.detailScore.setText(game.getHomeScore() + " - " + game.getAwayScore());
|
||||
|
||||
binding.progressPossession.setProgress(game.getHomePossession());
|
||||
binding.textPossessionHome.setText(game.getHomePossession() + "%");
|
||||
binding.textPossessionAway.setText(game.getAwayPossession() + "%");
|
||||
|
||||
binding.textShotsHome.setText(String.valueOf(game.getHomeShots()));
|
||||
binding.textShotsAway.setText(String.valueOf(game.getAwayShots()));
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.example.vdcscore.ui.livegames;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.vdcscore.R;
|
||||
import com.example.vdcscore.databinding.FragmentLiveGamesBinding;
|
||||
|
||||
public class LiveGamesFragment extends Fragment {
|
||||
|
||||
private FragmentLiveGamesBinding binding;
|
||||
private GameViewModel gameViewModel;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
gameViewModel = new ViewModelProvider(requireActivity()).get(GameViewModel.class);
|
||||
|
||||
binding = FragmentLiveGamesBinding.inflate(inflater, container, false);
|
||||
View root = binding.getRoot();
|
||||
|
||||
RecyclerView recyclerView = binding.recyclerLiveGames;
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
gameViewModel.getGames().observe(getViewLifecycleOwner(), games -> {
|
||||
GameAdapter adapter = new GameAdapter(games, game -> {
|
||||
gameViewModel.selectGame(game);
|
||||
Navigation.findNavController(root).navigate(R.id.action_nav_live_games_to_nav_live_game_detail);
|
||||
});
|
||||
recyclerView.setAdapter(adapter);
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
27
app/src/main/res/layout/fragment_clubs.xml
Normal file
27
app/src/main/res/layout/fragment_clubs.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
||||
android:background="#f5f5f5">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_clubs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
151
app/src/main/res/layout/fragment_live_game_detail.xml
Normal file
151
app/src/main/res/layout/fragment_live_game_detail.xml
Normal file
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView 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="match_parent"
|
||||
android:background="#ffffff">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_game_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="65'"
|
||||
android:textColor="@android:color/holo_red_dark"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_home_team"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:text="Home"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@+id/detail_score"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_game_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="1 - 1"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/detail_home_team"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/detail_home_team" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/detail_away_team"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Away"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/detail_home_team"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/detail_score"
|
||||
app:layout_constraintTop_toTopOf="@+id/detail_home_team" />
|
||||
|
||||
<!-- Stats Section -->
|
||||
<TextView
|
||||
android:id="@+id/text_stats_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="Estatísticas ao Vivo"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/detail_home_team" />
|
||||
|
||||
<!-- Possession -->
|
||||
<TextView
|
||||
android:id="@+id/label_possession"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Posse de Bola"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_stats_title" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_possession"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:max="100"
|
||||
android:progress="50"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/label_possession" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_possession_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="50%"
|
||||
app:layout_constraintStart_toStartOf="@+id/progress_possession"
|
||||
app:layout_constraintBottom_toTopOf="@+id/progress_possession"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_possession_away"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="50%"
|
||||
app:layout_constraintEnd_toEndOf="@+id/progress_possession"
|
||||
app:layout_constraintBottom_toTopOf="@+id/progress_possession"/>
|
||||
|
||||
|
||||
<!-- Shots -->
|
||||
<TextView
|
||||
android:id="@+id/label_shots"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Remates"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/progress_possession" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_shots_home"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@+id/label_shots"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/label_shots" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_shots_away"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/label_shots"
|
||||
app:layout_constraintTop_toTopOf="@+id/label_shots" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
29
app/src/main/res/layout/fragment_live_games.xml
Normal file
29
app/src/main/res/layout/fragment_live_games.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
||||
android:background="#f5f5f5">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_live_games"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_no_games"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Não há jogos ao vivo no momento"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
49
app/src/main/res/layout/item_club.xml
Normal file
49
app/src/main/res/layout/item_club.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView 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:layout_margin="8dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_club_logo"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:contentDescription="Club Logo"
|
||||
android:src="@drawable/ic_menu_gallery"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_club_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="Club Name"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/image_club_logo"
|
||||
app:layout_constraintTop_toTopOf="@+id/image_club_logo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_club_stadium"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Stadium Name"
|
||||
android:textColor="@color/text_secondary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/text_club_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_club_name" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
66
app/src/main/res/layout/item_live_game.xml
Normal file
66
app/src/main/res/layout/item_live_game.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView 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:layout_margin="8dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_game_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="45'"
|
||||
android:textColor="@color/holo_red_dark"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_home_team"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="Home Team"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toStartOf="@+id/text_score"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_game_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_score"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="2 - 1"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/text_home_team"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/text_home_team" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_away_team"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="Away Team"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/text_home_team"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/text_score"
|
||||
app:layout_constraintTop_toTopOf="@+id/text_home_team" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -12,6 +12,14 @@
|
||||
android:id="@+id/nav_gallery"
|
||||
android:icon="@drawable/ic_menu_gallery"
|
||||
android:title="@string/menu_gallery" />
|
||||
<item
|
||||
android:id="@+id/nav_live_games"
|
||||
android:icon="@android:drawable/ic_menu_view"
|
||||
android:title="@string/menu_live_games" />
|
||||
<item
|
||||
android:id="@+id/nav_clubs"
|
||||
android:icon="@android:drawable/ic_menu_my_calendar"
|
||||
android:title="@string/menu_clubs" />
|
||||
<item
|
||||
android:id="@+id/nav_definicoes"
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
|
||||
@@ -22,4 +22,17 @@
|
||||
android:name="com.example.vdcscore.ui.definicoes.DefinicoesFragment"
|
||||
android:label="@string/menu_definicoes"
|
||||
tools:layout="@layout/fragment_definicoes" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_live_games"
|
||||
android:name="com.example.vdcscore.ui.livegames.LiveGamesFragment"
|
||||
android:label="@string/menu_live_games"
|
||||
tools:layout="@layout/fragment_live_games" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_clubs"
|
||||
android:name="com.example.vdcscore.ui.clubs.ClubsFragment"
|
||||
android:label="@string/menu_clubs"
|
||||
tools:layout="@layout/fragment_clubs" />
|
||||
|
||||
</navigation>
|
||||
@@ -11,6 +11,8 @@
|
||||
<string name="menu_home">Classificação</string>
|
||||
<string name="menu_gallery">Jornadas</string>
|
||||
<string name="menu_definicoes">Definições</string>
|
||||
<string name="menu_live_games">Jogos ao Vivo</string>
|
||||
<string name="menu_clubs">Clubes</string>
|
||||
|
||||
<!-- Profile Strings -->
|
||||
<string name="change_photo_title">Alterar Foto de Perfil</string>
|
||||
|
||||
Reference in New Issue
Block a user