alteraçoes
parent
fe0dbed813
commit
2e47ced7c7
|
|
@ -18,10 +18,6 @@ import com.google.firebase.auth.FirebaseAuth;
|
||||||
|
|
||||||
public class CriarContaActivity extends AppCompatActivity {
|
public class CriarContaActivity extends AppCompatActivity {
|
||||||
|
|
||||||
// teste de alguma coisa
|
|
||||||
// mais um teste
|
|
||||||
// asdasdas
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,24 @@ import com.google.firebase.auth.FirebaseAuth;
|
||||||
import com.google.firebase.auth.FirebaseUser;
|
import com.google.firebase.auth.FirebaseUser;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.text.InputType;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import com.google.firebase.storage.StorageReference;
|
||||||
|
import com.google.firebase.storage.UploadTask;
|
||||||
|
import com.google.firebase.auth.UserProfileChangeRequest;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
private ActivityMainBinding binding;
|
private ActivityMainBinding binding;
|
||||||
|
private ActivityResultLauncher<String> mGetContent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
@ -56,19 +69,28 @@ public class MainActivity extends AppCompatActivity {
|
||||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
|
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
|
||||||
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
|
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
|
||||||
NavigationUI.setupWithNavController(navigationView, navController);
|
NavigationUI.setupWithNavController(navigationView, navController);
|
||||||
|
|
||||||
|
// Initialize Gallery Launcher
|
||||||
|
mGetContent = registerForActivityResult(new ActivityResultContracts.GetContent(),
|
||||||
|
uri -> {
|
||||||
|
if (uri != null) {
|
||||||
|
uploadImageToStorage(uri);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Carregar dados do utilizador no menu lateral
|
// Carregar dados do utilizador no menu lateral
|
||||||
loadUserDataInNavHeader();
|
loadUserDataInNavHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadUserDataInNavHeader() {
|
private void loadUserDataInNavHeader() {
|
||||||
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
if (user == null) return;
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
View headerView = binding.navView.getHeaderView(0);
|
View headerView = binding.navView.getHeaderView(0);
|
||||||
TextView textViewName = headerView.findViewById(R.id.textViewName);
|
TextView textViewName = headerView.findViewById(R.id.textViewName);
|
||||||
ImageView imageView = headerView.findViewById(R.id.imageView);
|
ImageView imageView = headerView.findViewById(R.id.imageView);
|
||||||
|
|
||||||
// Carregar nome
|
// Carregar nome
|
||||||
if (textViewName != null) {
|
if (textViewName != null) {
|
||||||
if (user.getDisplayName() != null && !user.getDisplayName().isEmpty()) {
|
if (user.getDisplayName() != null && !user.getDisplayName().isEmpty()) {
|
||||||
|
|
@ -77,9 +99,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
textViewName.setText("Utilizador");
|
textViewName.setText("Utilizador");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carregar foto de perfil
|
// Carregar foto de perfil
|
||||||
if (imageView != null) {
|
if (imageView != null) {
|
||||||
|
imageView.setOnClickListener(v -> showChangeProfilePhotoDialog());
|
||||||
if (user.getPhotoUrl() != null) {
|
if (user.getPhotoUrl() != null) {
|
||||||
loadProfileImageInNavHeader(user.getPhotoUrl().toString(), imageView);
|
loadProfileImageInNavHeader(user.getPhotoUrl().toString(), imageView);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -88,7 +111,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadProfileImageInNavHeader(String imageUrl, ImageView imageView) {
|
private void loadProfileImageInNavHeader(String imageUrl, ImageView imageView) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
|
|
@ -119,11 +142,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadProfileImageFromStorage(ImageView imageView) {
|
private void loadProfileImageFromStorage(ImageView imageView) {
|
||||||
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
if (user == null || imageView == null) return;
|
if (user == null || imageView == null)
|
||||||
|
return;
|
||||||
|
|
||||||
com.google.firebase.storage.FirebaseStorage.getInstance()
|
com.google.firebase.storage.FirebaseStorage.getInstance()
|
||||||
.getReference()
|
.getReference()
|
||||||
.child("profile_images/" + user.getUid() + ".jpg")
|
.child("profile_images/" + user.getUid() + ".jpg")
|
||||||
|
|
@ -136,10 +160,86 @@ public class MainActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showChangeProfilePhotoDialog() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle("Alterar Foto de Perfil");
|
||||||
|
String[] options = { "Escolher da Galeria", "Inserir URL" };
|
||||||
|
builder.setItems(options, (dialog, which) -> {
|
||||||
|
if (which == 0) {
|
||||||
|
mGetContent.launch("image/*");
|
||||||
|
} else {
|
||||||
|
showUrlDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showUrlDialog() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle("Inserir URL da Imagem");
|
||||||
|
|
||||||
|
final EditText input = new EditText(this);
|
||||||
|
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
|
||||||
|
input.setHint("https://exemplo.com/foto.jpg");
|
||||||
|
builder.setView(input);
|
||||||
|
|
||||||
|
builder.setPositiveButton("OK", (dialog, which) -> {
|
||||||
|
String url = input.getText().toString();
|
||||||
|
if (!url.isEmpty()) {
|
||||||
|
updateUserProfile(Uri.parse(url));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("Cancelar", (dialog, which) -> dialog.cancel());
|
||||||
|
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uploadImageToStorage(Uri imageUri) {
|
||||||
|
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
StorageReference storageRef = com.google.firebase.storage.FirebaseStorage.getInstance().getReference();
|
||||||
|
StorageReference profileRef = storageRef.child("profile_images/" + user.getUid() + ".jpg");
|
||||||
|
|
||||||
|
Toast.makeText(this, "A carregar imagem...", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
profileRef.putFile(imageUri)
|
||||||
|
.addOnSuccessListener(taskSnapshot -> {
|
||||||
|
profileRef.getDownloadUrl().addOnSuccessListener(uri -> {
|
||||||
|
updateUserProfile(uri);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.addOnFailureListener(e -> {
|
||||||
|
Toast.makeText(MainActivity.this, "Erro ao carregar imagem: " + e.getMessage(), Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateUserProfile(Uri photoUri) {
|
||||||
|
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
|
||||||
|
if (user == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
|
||||||
|
.setPhotoUri(photoUri)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
user.updateProfile(profileUpdates)
|
||||||
|
.addOnCompleteListener(task -> {
|
||||||
|
if (task.isSuccessful()) {
|
||||||
|
Toast.makeText(MainActivity.this, "Foto de perfil atualizada!", Toast.LENGTH_SHORT).show();
|
||||||
|
loadUserDataInNavHeader(); // Refresh UI
|
||||||
|
} else {
|
||||||
|
Toast.makeText(MainActivity.this, "Erro ao atualizar perfil.", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
// getMenuInflater().inflate(R.menu.main, menu);
|
// getMenuInflater().inflate(R.menu.main, menu);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,7 +249,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|
||||||
|| super.onSupportNavigateUp();
|
|| super.onSupportNavigateUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
||||||
|
|
@ -4,31 +4,82 @@ import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.example.vdcscore.databinding.FragmentGalleryBinding;
|
import com.example.vdcscore.databinding.FragmentGalleryBinding;
|
||||||
|
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 GalleryFragment extends Fragment {
|
public class GalleryFragment extends Fragment {
|
||||||
|
|
||||||
private FragmentGalleryBinding binding;
|
private FragmentGalleryBinding binding;
|
||||||
|
private MatchdaysAdapter adapter;
|
||||||
|
private DatabaseReference mDatabase;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
GalleryViewModel galleryViewModel = new ViewModelProvider(this).get(GalleryViewModel.class);
|
|
||||||
|
|
||||||
binding = FragmentGalleryBinding.inflate(inflater, container, false);
|
binding = FragmentGalleryBinding.inflate(inflater, container, false);
|
||||||
View root = binding.getRoot();
|
View root = binding.getRoot();
|
||||||
|
|
||||||
// final TextView textView = binding.textGallery;
|
// Initialize RecyclerView
|
||||||
// galleryViewModel.getText().observe(getViewLifecycleOwner(),
|
adapter = new MatchdaysAdapter();
|
||||||
// textView::setText);
|
binding.recyclerMatchdays.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
binding.recyclerMatchdays.setAdapter(adapter);
|
||||||
|
|
||||||
|
// Initialize Firebase
|
||||||
|
mDatabase = FirebaseDatabase.getInstance().getReference("matchdays");
|
||||||
|
|
||||||
|
// Fetch Data
|
||||||
|
fetchMatchdays();
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fetchMatchdays() {
|
||||||
|
mDatabase.addValueEventListener(new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||||
|
List<Matchday> matchdays = new ArrayList<>();
|
||||||
|
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||||
|
Matchday matchday = new Matchday();
|
||||||
|
matchday.setId(postSnapshot.getKey());
|
||||||
|
matchday.setName(postSnapshot.child("name").getValue(String.class));
|
||||||
|
|
||||||
|
List<Match> matches = new ArrayList<>();
|
||||||
|
for (DataSnapshot matchSnapshot : postSnapshot.child("matches").getChildren()) {
|
||||||
|
Match match = matchSnapshot.getValue(Match.class);
|
||||||
|
if (match != null) {
|
||||||
|
match.setId(matchSnapshot.getKey());
|
||||||
|
matches.add(match);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matchday.setMatches(matches);
|
||||||
|
matchdays.add(matchday);
|
||||||
|
}
|
||||||
|
adapter.setMatchdays(matchdays);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(@NonNull DatabaseError error) {
|
||||||
|
if (getContext() != null) {
|
||||||
|
Toast.makeText(getContext(), "Erro ao carregar jornadas: " + error.getMessage(), Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.example.vdcscore.ui.gallery;
|
||||||
|
|
||||||
|
public class Match {
|
||||||
|
private String id;
|
||||||
|
private String homeTeam;
|
||||||
|
private String awayTeam;
|
||||||
|
private int homeScore;
|
||||||
|
private int awayScore;
|
||||||
|
private String date;
|
||||||
|
private String time;
|
||||||
|
private String status; // "Scheduled", "Finished", "Live"
|
||||||
|
|
||||||
|
public Match() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Match(String homeTeam, String awayTeam, String date, String time) {
|
||||||
|
this.homeTeam = homeTeam;
|
||||||
|
this.awayTeam = awayTeam;
|
||||||
|
this.date = date;
|
||||||
|
this.time = time;
|
||||||
|
this.status = "Scheduled";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHomeTeam() {
|
||||||
|
return homeTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHomeTeam(String homeTeam) {
|
||||||
|
this.homeTeam = homeTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAwayTeam() {
|
||||||
|
return awayTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAwayTeam(String awayTeam) {
|
||||||
|
this.awayTeam = awayTeam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHomeScore() {
|
||||||
|
return homeScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHomeScore(int homeScore) {
|
||||||
|
this.homeScore = homeScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAwayScore() {
|
||||||
|
return awayScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAwayScore(int awayScore) {
|
||||||
|
this.awayScore = awayScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(String time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.example.vdcscore.ui.gallery;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Matchday {
|
||||||
|
private String id;
|
||||||
|
private String name; // e.g., "Jornada 1"
|
||||||
|
private List<Match> matches;
|
||||||
|
|
||||||
|
public Matchday() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Matchday(String name, List<Match> matches) {
|
||||||
|
this.name = name;
|
||||||
|
this.matches = matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 List<Match> getMatches() {
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatches(List<Match> matches) {
|
||||||
|
this.matches = matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.example.vdcscore.ui.gallery;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.example.vdcscore.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MatchdaysAdapter extends RecyclerView.Adapter<MatchdaysAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<Matchday> matchdays = new ArrayList<>();
|
||||||
|
private RecyclerView.RecycledViewPool viewPool = new RecyclerView.RecycledViewPool();
|
||||||
|
|
||||||
|
public void setMatchdays(List<Matchday> matchdays) {
|
||||||
|
this.matchdays = matchdays;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.item_matchday, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
Matchday matchday = matchdays.get(position);
|
||||||
|
holder.textName.setText(matchday.getName());
|
||||||
|
|
||||||
|
// Setup nested RecyclerView
|
||||||
|
LinearLayoutManager layoutManager = new LinearLayoutManager(
|
||||||
|
holder.recyclerMatches.getContext(),
|
||||||
|
LinearLayoutManager.VERTICAL,
|
||||||
|
false);
|
||||||
|
layoutManager.setInitialPrefetchItemCount(matchday.getMatches().size());
|
||||||
|
|
||||||
|
MatchesAdapter matchesAdapter = new MatchesAdapter(matchday.getMatches());
|
||||||
|
holder.recyclerMatches.setLayoutManager(layoutManager);
|
||||||
|
holder.recyclerMatches.setAdapter(matchesAdapter);
|
||||||
|
holder.recyclerMatches.setRecycledViewPool(viewPool);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return matchdays.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public final TextView textName;
|
||||||
|
public final RecyclerView recyclerMatches;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
textName = view.findViewById(R.id.text_matchday_name);
|
||||||
|
recyclerMatches = view.findViewById(R.id.recycler_matches);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.example.vdcscore.ui.gallery;
|
||||||
|
|
||||||
|
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 MatchesAdapter extends RecyclerView.Adapter<MatchesAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<Match> matches;
|
||||||
|
|
||||||
|
public MatchesAdapter(List<Match> matches) {
|
||||||
|
this.matches = matches;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.item_match, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
Match match = matches.get(position);
|
||||||
|
holder.textHomeTeam.setText(match.getHomeTeam());
|
||||||
|
holder.textAwayTeam.setText(match.getAwayTeam());
|
||||||
|
|
||||||
|
if ("Finished".equals(match.getStatus())) {
|
||||||
|
holder.textScore.setText(match.getHomeScore() + " - " + match.getAwayScore());
|
||||||
|
holder.textTime.setText("Final");
|
||||||
|
} else {
|
||||||
|
holder.textScore.setText("Vs");
|
||||||
|
holder.textTime.setText(match.getTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return matches == null ? 0 : matches.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public final TextView textHomeTeam;
|
||||||
|
public final TextView textAwayTeam;
|
||||||
|
public final TextView textScore;
|
||||||
|
public final TextView textTime;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,31 +4,90 @@ import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.example.vdcscore.databinding.FragmentHomeBinding;
|
import com.example.vdcscore.databinding.FragmentHomeBinding;
|
||||||
|
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.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
|
|
||||||
private FragmentHomeBinding binding;
|
private FragmentHomeBinding binding;
|
||||||
|
private StandingsAdapter adapter;
|
||||||
|
private DatabaseReference mDatabase;
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||||
ViewGroup container, Bundle savedInstanceState) {
|
ViewGroup container, Bundle savedInstanceState) {
|
||||||
HomeViewModel homeViewModel =
|
|
||||||
new ViewModelProvider(this).get(HomeViewModel.class);
|
|
||||||
|
|
||||||
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
||||||
View root = binding.getRoot();
|
View root = binding.getRoot();
|
||||||
|
|
||||||
final TextView textView = binding.textHome;
|
// Initialize RecyclerView
|
||||||
homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
|
adapter = new StandingsAdapter();
|
||||||
|
binding.recyclerStandings.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
binding.recyclerStandings.setAdapter(adapter);
|
||||||
|
|
||||||
|
// Initialize Firebase
|
||||||
|
mDatabase = FirebaseDatabase.getInstance().getReference("standings");
|
||||||
|
|
||||||
|
// Fetch Data
|
||||||
|
fetchStandings();
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fetchStandings() {
|
||||||
|
mDatabase.addValueEventListener(new ValueEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||||
|
List<Team> teams = new ArrayList<>();
|
||||||
|
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||||
|
Team team = postSnapshot.getValue(Team.class);
|
||||||
|
if (team != null) {
|
||||||
|
// If ID is missing, set it from the key
|
||||||
|
if (team.getId() == null) {
|
||||||
|
team.setId(postSnapshot.getKey());
|
||||||
|
}
|
||||||
|
teams.add(team);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort by Points (Descending), then Goal Difference, then Goals For
|
||||||
|
Collections.sort(teams, new Comparator<Team>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Team t1, Team t2) {
|
||||||
|
if (t1.getPoints() != t2.getPoints()) {
|
||||||
|
return t2.getPoints() - t1.getPoints(); // Descending points
|
||||||
|
}
|
||||||
|
return t2.getGoalDifference() - t1.getGoalDifference(); // Descending GD
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
adapter.setTeams(teams);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelled(@NonNull DatabaseError error) {
|
||||||
|
if (getContext() != null) {
|
||||||
|
Toast.makeText(getContext(), "Erro ao carregar classificação: " + error.getMessage(),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.example.vdcscore.ui.home;
|
||||||
|
|
||||||
|
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.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class StandingsAdapter extends RecyclerView.Adapter<StandingsAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<Team> mTeams;
|
||||||
|
|
||||||
|
public StandingsAdapter() {
|
||||||
|
this.mTeams = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTeams(List<Team> teams) {
|
||||||
|
this.mTeams = teams;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.item_standing, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
Team team = mTeams.get(position);
|
||||||
|
|
||||||
|
holder.textPosition.setText(String.valueOf(position + 1));
|
||||||
|
holder.textTeamName.setText(team.getName());
|
||||||
|
holder.textPlayed.setText(String.valueOf(team.getPlayed()));
|
||||||
|
holder.textPoints.setText(String.valueOf(team.getPoints()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mTeams.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public final TextView textPosition;
|
||||||
|
public final TextView textTeamName;
|
||||||
|
public final TextView textPlayed;
|
||||||
|
public final TextView textPoints;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
textPosition = view.findViewById(R.id.text_position);
|
||||||
|
textTeamName = view.findViewById(R.id.text_team_name);
|
||||||
|
textPlayed = view.findViewById(R.id.text_played);
|
||||||
|
textPoints = view.findViewById(R.id.text_points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.example.vdcscore.ui.home;
|
||||||
|
|
||||||
|
public class Team {
|
||||||
|
private String id;
|
||||||
|
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() {
|
||||||
|
// Required empty constructor for Firebase
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/primary_color"/>
|
||||||
|
<corners android:radius="8dp"/>
|
||||||
|
</shape>
|
||||||
|
|
@ -1,131 +1,27 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:background="@color/background_light"
|
||||||
tools:context=".ui.gallery.GalleryFragment">
|
tools:context=".ui.gallery.GalleryFragment">
|
||||||
|
|
||||||
<ScrollView
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Jornadas"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/primary_color"
|
||||||
|
android:layout_marginBottom="16dp" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_matchdays"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true">
|
android:clipToPadding="false"
|
||||||
|
android:paddingBottom="16dp"/>
|
||||||
|
|
||||||
<LinearLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Próximas Jornadas"
|
|
||||||
android:textSize="24sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:textColor="#000000"/>
|
|
||||||
|
|
||||||
<!-- Placeholder for Matchdays -->
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
app:cardCornerRadius="8dp"
|
|
||||||
app:cardElevation="4dp">
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Jornada 10 - 15/12/2025"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="VDC vs Rival FC"
|
|
||||||
android:layout_marginTop="4dp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
app:cardCornerRadius="8dp"
|
|
||||||
app:cardElevation="4dp">
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Jornada 11 - 22/12/2025"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Outro Clube vs VDC"
|
|
||||||
android:layout_marginTop="4dp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Classificação"
|
|
||||||
android:textSize="24sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:textColor="#000000"/>
|
|
||||||
|
|
||||||
<!-- Placeholder for Standings Table -->
|
|
||||||
<TableLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:stretchColumns="1">
|
|
||||||
|
|
||||||
<TableRow android:background="#E0E0E0" android:padding="8dp">
|
|
||||||
<TextView android:text="Pos" android:paddingEnd="8dp" android:textStyle="bold"/>
|
|
||||||
<TextView android:text="Clube" android:textStyle="bold"/>
|
|
||||||
<TextView android:text="Pts" android:paddingStart="8dp" android:textStyle="bold"/>
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow android:padding="8dp">
|
|
||||||
<TextView android:text="1" />
|
|
||||||
<TextView android:text="VDC Score" />
|
|
||||||
<TextView android:text="25" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow android:padding="8dp">
|
|
||||||
<TextView android:text="2" />
|
|
||||||
<TextView android:text="Rival FC" />
|
|
||||||
<TextView android:text="22" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow android:padding="8dp">
|
|
||||||
<TextView android:text="3" />
|
|
||||||
<TextView android:text="Outro Clube" />
|
|
||||||
<TextView android:text="18" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow android:padding="8dp">
|
|
||||||
<TextView android:text="4" />
|
|
||||||
<TextView android:text="Clube A" />
|
|
||||||
<TextView android:text="15" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow android:padding="8dp">
|
|
||||||
<TextView android:text="5" />
|
|
||||||
<TextView android:text="Clube B" />
|
|
||||||
<TextView android:text="12" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
</TableLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@ -1,22 +1,69 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:background="@color/background_light"
|
||||||
tools:context=".ui.home.HomeFragment">
|
tools:context=".ui.home.HomeFragment">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_home"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:text="Classificação"
|
||||||
android:layout_marginTop="8dp"
|
android:textSize="24sp"
|
||||||
android:layout_marginEnd="8dp"
|
android:textStyle="bold"
|
||||||
android:textAlignment="center"
|
android:textColor="@color/primary_color"
|
||||||
android:textSize="20sp"
|
android:layout_marginBottom="16dp" />
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
<!-- Table Header -->
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<LinearLayout
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
android:layout_width="match_parent"
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:background="@drawable/header_background">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="#"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Clube"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="J"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:tooltipText="Jogos" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Pts"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_standings"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingTop="8dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<!-- Home Team -->
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<!-- Score / Time -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="12dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:minWidth="60dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_score"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Vs"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/secondary_color"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_time"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="15:00"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/text_secondary" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Away Team -->
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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_marginBottom="16dp"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="4dp"
|
||||||
|
app:contentPadding="0dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_matchday_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/primary_light"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:text="Jornada 1"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<!-- Matches List -->
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_matches"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:nestedScrollingEnabled="false"
|
||||||
|
tools:itemCount="3"
|
||||||
|
tools:listitem="@layout/item_match" xmlns:tools="http://schemas.android.com/tools"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="12dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="?attr/selectableItemBackground">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_position"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="1"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/secondary_color"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_team_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Team Name"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_played"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="P"
|
||||||
|
android:textColor="@color/text_secondary"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_points"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Pts"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/text_primary"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -2,4 +2,21 @@
|
||||||
<resources>
|
<resources>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
|
||||||
|
<!-- Modern Neutral Palette -->
|
||||||
|
<color name="primary_color">#263238</color> <!-- Blue Grey 900 -->
|
||||||
|
<color name="primary_light">#4f5b62</color>
|
||||||
|
<color name="primary_dark">#000a12</color>
|
||||||
|
|
||||||
|
<color name="secondary_color">#009688</color> <!-- Teal 500 -->
|
||||||
|
<color name="secondary_light">#52c7b8</color>
|
||||||
|
<color name="secondary_dark">#00675b</color>
|
||||||
|
|
||||||
|
<color name="background_light">#F5F5F5</color> <!-- Grey 100 -->
|
||||||
|
<color name="surface_light">#FFFFFF</color>
|
||||||
|
|
||||||
|
<color name="text_primary">#212121</color> <!-- Grey 900 -->
|
||||||
|
<color name="text_secondary">#757575</color> <!-- Grey 600 -->
|
||||||
|
|
||||||
|
<color name="divider">#BDBDBD</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -1,14 +1,22 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">VdcScore</string>
|
<string name="app_name">VdcScore</string>
|
||||||
<string name="title_activity_main">MainActivity</string>
|
<string name="title_activity_main">Classificação</string>
|
||||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
<string name="navigation_drawer_open">Abrir menu</string>
|
||||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
<string name="navigation_drawer_close">Fechar menu</string>
|
||||||
<string name="nav_header_title">Android Studio</string>
|
<string name="nav_header_title">VdcScore</string>
|
||||||
<string name="nav_header_subtitle">android.studio@android.com</string>
|
<string name="nav_header_subtitle">O teu clube</string>
|
||||||
<string name="nav_header_desc">Navigation header</string>
|
<string name="nav_header_desc">Cabeçalho de navegação</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Definições</string>
|
||||||
|
|
||||||
<string name="menu_home">Home</string>
|
<string name="menu_home">Classificação</string>
|
||||||
<string name="menu_gallery">Classificação</string>
|
<string name="menu_gallery">Jornadas</string>
|
||||||
<string name="menu_definicoes">Definições</string>
|
<string name="menu_definicoes">Definições</string>
|
||||||
|
|
||||||
|
<!-- Profile Strings -->
|
||||||
|
<string name="change_photo_title">Alterar Foto de Perfil</string>
|
||||||
|
<string name="choose_gallery">Escolher da Galeria</string>
|
||||||
|
<string name="enter_url">Inserir URL</string>
|
||||||
|
<string name="cancel">Cancelar</string>
|
||||||
|
<string name="ok">OK</string>
|
||||||
|
<string name="url_hint">https://exemplo.com/foto.jpg</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -1,8 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Base.Theme.VdcScore" parent="Theme.Material3.DayNight.NoActionBar">
|
<style name="Base.Theme.VdcScore" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<!-- Customize your light theme here. -->
|
<!-- Customize your light theme here. -->
|
||||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
<item name="colorPrimary">@color/primary_color</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/primary_dark</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<item name="colorSecondary">@color/secondary_color</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/secondary_dark</item>
|
||||||
|
<item name="colorOnSecondary">@color/white</item>
|
||||||
|
<item name="android:statusBarColor">@color/primary_dark</item>
|
||||||
|
<item name="android:textColorPrimary">@color/text_primary</item>
|
||||||
|
<item name="android:textColorSecondary">@color/text_secondary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.VdcScore" parent="Base.Theme.VdcScore" />
|
<style name="Theme.VdcScore" parent="Base.Theme.VdcScore" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue