break for printer!

This commit is contained in:
OnlyPapy98
2025-11-27 11:54:52 +01:00
parent 8f80492287
commit 1031307b3a
25 changed files with 420 additions and 341 deletions

View File

@@ -11,7 +11,7 @@ android {
defaultConfig { defaultConfig {
applicationId = "com.example.quiz" applicationId = "com.example.quiz"
minSdk = 29 minSdk = 16
targetSdk = 34 targetSdk = 34
versionCode = 1 versionCode = 1
versionName = "1.0" versionName = "1.0"
@@ -29,8 +29,8 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_1_8
} }
buildFeatures { buildFeatures {
viewBinding = true viewBinding = true

Binary file not shown.

View File

@@ -1,9 +1,12 @@
package com.example.quiz; package com.example.quiz;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
@@ -25,16 +28,20 @@ import com.example.quiz.data.model.Course;
import com.example.quiz.data.model.Pari; import com.example.quiz.data.model.Pari;
import com.example.quiz.data.model.Reunion; import com.example.quiz.data.model.Reunion;
import com.example.quiz.data.model.TypeOfBet; import com.example.quiz.data.model.TypeOfBet;
import com.example.quiz.data.model.dtos.PariCourseDto;
import com.example.quiz.data.model.enums.PariStatut; import com.example.quiz.data.model.enums.PariStatut;
import com.example.quiz.databinding.FragmentBetValidationBinding; import com.example.quiz.databinding.FragmentBetValidationBinding;
import com.example.quiz.utils.HPRTPrinterUtil; import com.example.quiz.utils.HPRTPrinterUtil;
import com.example.quiz.utils.Result; import com.example.quiz.utils.Result;
import com.example.quiz.viewModel.PariViewModel; import com.example.quiz.viewModel.PariViewModel;
import com.example.quiz.viewModel.SharedViewModel; import com.example.quiz.viewModel.SharedViewModel;
import com.google.android.material.appbar.MaterialToolbar;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
@@ -55,7 +62,7 @@ public class BetValidation extends Fragment {
private HPRTPrinterUtil printer; private HPRTPrinterUtil printer;
private String typeOfBet; private TypeOfBet typeOfBet;
private Reunion reunion; private Reunion reunion;
@@ -101,7 +108,7 @@ public class BetValidation extends Fragment {
int columns = 7; int columns = 7;
grid.setColumnCount(columns); grid.setColumnCount(columns);
if(shared.selectedCourse.getValue() != null){ if(shared.selectedCourse.getValue() != null){
for (int i = 1; i <= shared.selectedCourse.getValue().getNombreChevauxInscrits(); i++) { for (int i = 1; i <= shared.selectedCourse.getValue().getPartants(); i++) {
createNumberItem(String.valueOf(i)); createNumberItem(String.valueOf(i));
grid.addView(createNumberItem(String.valueOf(i))); grid.addView(createNumberItem(String.valueOf(i)));
} }
@@ -151,15 +158,14 @@ public class BetValidation extends Fragment {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class); shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
pariViewModel = new ViewModelProvider(this).get(PariViewModel.class); pariViewModel = new ViewModelProvider(this).get(PariViewModel.class);
/*viewModel = new ViewModelProvider(this).get(BetViewModel.class); AppCompatActivity activity = (AppCompatActivity) getActivity();
viewModel.getBetNameById(shared.betId.getValue() - 1); if(activity != null){
viewModel.betName.observe(getViewLifecycleOwner(), name ->{ MaterialToolbar toolbar = activity.findViewById(R.id.toolbar);
binding.horseName.setText(name); activity.setSupportActionBar(toolbar);
}); if(activity.getSupportActionBar() != null){
viewModel.loadHorses(shared.betId.getValue() - 1); activity.getSupportActionBar().setTitle("Pari "+shared.selectedCourse.getValue().getNom());
if(viewModel.partant.getValue() != null){ }
this.totalHorses = viewModel.partant.getValue(); }
}*/
setupNumberGrid(binding.gridNumbers); setupNumberGrid(binding.gridNumbers);
binding.paymentType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { binding.paymentType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@@ -183,13 +189,13 @@ public class BetValidation extends Fragment {
binding.order.setOnCheckedChangeListener((buttonView, isChecked) -> { binding.order.setOnCheckedChangeListener((buttonView, isChecked) -> {
order = isChecked; order = isChecked;
calculateMise(selectedHorses.getValue().size(), shared.typeOfBet.getValue()); calculateMise(selectedHorses.getValue().size(), shared.typeOfBet.getValue().getLabel());
}); });
selectedHorses.observe(getViewLifecycleOwner(), new Observer<List<String>>() { selectedHorses.observe(getViewLifecycleOwner(), new Observer<List<String>>() {
@Override @Override
public void onChanged(List<String> horses) { public void onChanged(List<String> horses) {
calculateMise(horses.size(), shared.typeOfBet.getValue()); calculateMise(horses.size(), shared.typeOfBet.getValue().getLabel());
binding.mise.setText(String.valueOf(mise+" CFA")); binding.mise.setText(String.valueOf(mise+" CFA"));
} }
}); });
@@ -207,53 +213,27 @@ public class BetValidation extends Fragment {
reunion = shared.selectedReunion.getValue(); reunion = shared.selectedReunion.getValue();
course = shared.selectedCourse.getValue(); course = shared.selectedCourse.getValue();
int required = 0; int required = typeOfBet.getNumberOfHorse();
if(typeOfBet.toLowerCase().contains("couple")){
required = 2;
}
if(typeOfBet.toLowerCase().contains("tierce")){
required = 3;
}
if(typeOfBet.toLowerCase().contains("quarte")){
required = 4;
}
if(typeOfBet.toLowerCase().contains("quinte")){
required = 5;
}
if(required == 0){
Toast.makeText(getContext(), "Erreur de type de pari", Toast.LENGTH_SHORT).show();
return;
}
if(selectedHorses.getValue().size() < required){ if(selectedHorses.getValue().size() < required){
Toast.makeText(getContext(), "Veuillez sélectionner au moins"+required+" chevaux", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "Veuillez sélectionner au moins"+required+" chevaux", Toast.LENGTH_SHORT).show();
return; return;
} }
Pari pari = new Pari( Pari pari = new Pari(
generate12Digits(), generate12Digits(),
shared.typeOfBet.getValue(), shared.typeOfBet.getValue().getName(),
"QUARTE_PLUS", "GAGNANT",
mise, mise,
"07/11/2025 05:08:00", DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss").format(LocalDateTime.now()),
shared.selectedCourse.getValue().getId(), true,
"123456789", true,
"John Doe", new PariCourseDto(shared.selectedCourse.getValue().getId()),
1, selectedHorses.getValue(),
5, order?selectedHorses.getValue():new ArrayList<String>(),
6,
4,
11,
5,
10,
order?selectedHorses.getValue().stream().map(Integer::parseInt).collect(Collectors.toList()):List.of(),
selectedHorses.getValue().stream().map(Integer::parseInt).collect(Collectors.toList()),
order?selectedHorses.getValue().stream().map(Integer::parseInt).collect(Collectors.toList()):List.of(),
order, order,
shared.typeOfBet.getValue(), "MULTI_4"
PariStatut.PERDANT,
false,
false
); );
pariViewModel.createPari(pari).observe(getViewLifecycleOwner(), new Observer<Result<Pari>>() { pariViewModel.createPari(pari).observe(getViewLifecycleOwner(), new Observer<Result<Pari>>() {
@Override @Override
@@ -288,6 +268,7 @@ public class BetValidation extends Fragment {
printer = new HPRTPrinterUtil(getContext()); printer = new HPRTPrinterUtil(getContext());
boolean ok = printer.autoConnectBluetoothByName(); boolean ok = printer.autoConnectBluetoothByName();
if(ok){ if(ok){
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.pmu_logo);
StringBuilder tspl = new StringBuilder(); StringBuilder tspl = new StringBuilder();
tspl.append("PARIS HIPPIQUE (PMU MALI)\n"); tspl.append("PARIS HIPPIQUE (PMU MALI)\n");
@@ -307,7 +288,7 @@ public class BetValidation extends Fragment {
tspl.append("----------------------------\n"); tspl.append("----------------------------\n");
tspl.append("Bonne chance !\n\n\n"); tspl.append("Bonne chance !\n\n\n");
printer.printText(tspl); printer.printText(bitmap, tspl);
} }
selectedHorses.setValue(List.of()); selectedHorses.setValue(List.of());
binding.combination.setText(getString(R.string.combination,"")); binding.combination.setText(getString(R.string.combination,""));

View File

@@ -80,11 +80,12 @@ public class ListOFBets extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
binding = FragmentListOFBettingBinding.inflate(inflater, container, false); binding = FragmentListOFBettingBinding.inflate(inflater, container, false);
adapter = new BetsAdapter();
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
adapter = new BetsAdapter(shared);
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2)); binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
binding.recyclerView.setAdapter(adapter); binding.recyclerView.setAdapter(adapter);
viewModel = new ViewModelProvider(this).get(CourseViewModel.class); viewModel = new ViewModelProvider(this).get(CourseViewModel.class);
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
@@ -107,7 +108,7 @@ public class ListOFBets extends Fragment {
} }
public void observe(){ public void observe(){
viewModel.getCourses().observe(getViewLifecycleOwner(), new Observer<Result<List<Course>>>() { viewModel.getCourses(String.valueOf(shared.selectedReunion.getValue().getId())).observe(getViewLifecycleOwner(), new Observer<Result<List<Course>>>() {
@Override @Override
public void onChanged(Result<List<Course>> result) { public void onChanged(Result<List<Course>> result) {
switch (result.status){ switch (result.status){

View File

@@ -19,6 +19,7 @@ import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.example.quiz.data.adapter.TypeOfBetAdapter; import com.example.quiz.data.adapter.TypeOfBetAdapter;
import com.example.quiz.data.model.TypeOfBet;
import com.example.quiz.databinding.FragmentListOfTypeOfBetsBinding; import com.example.quiz.databinding.FragmentListOfTypeOfBetsBinding;
import com.example.quiz.viewModel.SharedViewModel; import com.example.quiz.viewModel.SharedViewModel;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
@@ -85,7 +86,43 @@ public class ListOfTypeOfBets extends Fragment {
adapter = new TypeOfBetAdapter(new ArrayList<>()); adapter = new TypeOfBetAdapter(new ArrayList<>());
adapter.setOnItemClickListener(type -> shared.setTypeOfBet(type)); adapter.setOnItemClickListener(type -> shared.setTypeOfBet(type));
binding.typeOfBetRecyclerView.setAdapter(adapter); binding.typeOfBetRecyclerView.setAdapter(adapter);
List<String> types = List.of("Couple Gagnant", "Couple Place", "Tierce", "Quinte"); List<TypeOfBet> types = List.of(
new TypeOfBet(
"Simple",
"SIMPLE",
1
),
new TypeOfBet(
"Jumellé placé",
"JUMELLE_PLACE",
2
),
new TypeOfBet(
"Jumellé gagnant",
"JUMELLE_GAGNANT",
2
),
new TypeOfBet(
"Couple gagnant",
"COUPLE_GAGNANT",
2
),
new TypeOfBet(
"Tierce",
"TRIPLET",
3
),
new TypeOfBet(
"Quarte +",
"QUARTE_PLUS",
4
),
new TypeOfBet(
"Quinte +",
"QUINTE_PLUS",
5
)
);
// Observer les résultats // Observer les résultats
/*viewModel.types.observe(getViewLifecycleOwner(), type -> { /*viewModel.types.observe(getViewLifecycleOwner(), type -> {

View File

@@ -17,9 +17,14 @@ import com.example.quiz.viewModel.SharedViewModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder> { public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder> {
private List<Course> bets = new ArrayList<>(); private List<Course> bets = new ArrayList<>();
private onItemClickListener listener; private onItemClickListener listener;
private SharedViewModel shared;
public BetsAdapter(SharedViewModel shared) {
this.shared = shared;
}
public interface onItemClickListener { public interface onItemClickListener {
void onItemClick(Course bet); void onItemClick(Course bet);
@@ -29,8 +34,6 @@ public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder>
this.listener = listener; this.listener = listener;
} }
public void setBets(List<Course> bets){ public void setBets(List<Course> bets){
this.bets = bets; this.bets = bets;
notifyDataSetChanged(); notifyDataSetChanged();
@@ -39,26 +42,27 @@ public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder>
@NonNull @NonNull
@Override @Override
public BetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public BetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_bet, parent, false); View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_bet, parent, false);
return new BetViewHolder(view); return new BetViewHolder(view);
} }
@Override @Override
public void onBindViewHolder(@NonNull BetViewHolder holder, int position) { public void onBindViewHolder(@NonNull BetViewHolder holder, int position) {
Course bet = bets.get(position); Course bet = bets.get(position);
holder.tvDate.setText(String.valueOf(bet.getDateDepartCourse())); holder.tvDate.setText(String.valueOf(bet.getDateDepartCourse()));
holder.tvName.setText(String.valueOf(bet.getLieu())); holder.tvName.setText(bet.getNom());
holder.tvReunion.setText("Nom de la réunion");
holder.itemView.setOnClickListener(v->{ if (shared != null && shared.selectedReunion.getValue() != null) {
if(listener != null){ holder.tvReunion.setText(shared.selectedReunion.getValue().getNom());
listener.onItemClick(bet); }
}
holder.itemView.setOnClickListener(v -> {
if (listener != null) listener.onItemClick(bet);
}); });
} }
@Override @Override
public int getItemCount(){ public int getItemCount(){
return bets.size(); return bets.size();
@@ -66,13 +70,12 @@ public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder>
static class BetViewHolder extends RecyclerView.ViewHolder{ static class BetViewHolder extends RecyclerView.ViewHolder{
TextView tvName, tvDate, tvReunion; TextView tvName, tvDate, tvReunion;
public BetViewHolder(@NonNull View itemView) { public BetViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
tvName = itemView.findViewById(R.id.tvName); tvName = itemView.findViewById(R.id.tvName);
tvDate = itemView.findViewById(R.id.tvDate); tvDate = itemView.findViewById(R.id.tvDate);
tvReunion = itemView.findViewById(R.id.tvReunion); tvReunion = itemView.findViewById(R.id.tvReunion);
} }
} }
} }

View File

@@ -14,24 +14,24 @@ import com.example.quiz.data.model.TypeOfBet;
import java.util.List; import java.util.List;
public class TypeOfBetAdapter extends RecyclerView.Adapter<TypeOfBetAdapter.TypeOfBetViewHolder> { public class TypeOfBetAdapter extends RecyclerView.Adapter<TypeOfBetAdapter.TypeOfBetViewHolder> {
private List<String> types; private List<TypeOfBet> types;
private onItemClickListener listener; private onItemClickListener listener;
private int selectedPosition = -1; private int selectedPosition = -1;
public interface onItemClickListener{ public interface onItemClickListener{
void onItemClick(String type); void onItemClick(TypeOfBet type);
} }
public void setOnItemClickListener(TypeOfBetAdapter.onItemClickListener listener){ public void setOnItemClickListener(TypeOfBetAdapter.onItemClickListener listener){
this.listener = listener; this.listener = listener;
} }
public TypeOfBetAdapter(List<String> types){ public TypeOfBetAdapter(List<TypeOfBet> types){
this.types = types; this.types = types;
} }
public void setTypes(List<String> types){ public void setTypes(List<TypeOfBet> types){
this.types = types; this.types = types;
notifyDataSetChanged(); notifyDataSetChanged();
} }
@@ -46,8 +46,8 @@ public class TypeOfBetAdapter extends RecyclerView.Adapter<TypeOfBetAdapter.Type
@Override @Override
public void onBindViewHolder(@NonNull TypeOfBetViewHolder holder, int position) { public void onBindViewHolder(@NonNull TypeOfBetViewHolder holder, int position) {
String type = types.get(position); TypeOfBet type = types.get(position);
holder.type_of_bet_name.setText(type); holder.type_of_bet_name.setText(type.getLabel());
if(selectedPosition != position){ if(selectedPosition != position){
holder.itemView.setBackgroundResource(R.drawable.item_gradient_bg); holder.itemView.setBackgroundResource(R.drawable.item_gradient_bg);
}else{ }else{

View File

@@ -9,24 +9,29 @@ import java.util.List;
public class Course { public class Course {
private int id; private int id;
private String stype;
private String numero; private String numero;
private String nom; private String nom;
private String lieu; private String lieu;
private LocalDateTime dateDepartCourse; private String dateDepartCourse;
private String reunion; private int reunionId;
private String particularite;
private int partants;
private String statut;
private int nombreChevauxInscrits; private int nombreChevauxInscrits;
private List<Cheval> chevaux; public Course(int id, String stype, String numero, String nom, String lieu, String dateDepartCourse, int reunionId, String particularite, int partants, String statut, int nombreChevauxInscrits) {
public Course(int id, String numero, String nom, String lieu, LocalDateTime dateDepartCourse, String reunion, int nombreChevauxInscrits, List<Cheval> chevaux) {
this.id = id; this.id = id;
this.stype = stype;
this.numero = numero; this.numero = numero;
this.nom = nom; this.nom = nom;
this.lieu = lieu; this.lieu = lieu;
this.dateDepartCourse = dateDepartCourse; this.dateDepartCourse = dateDepartCourse;
this.reunion = reunion; this.reunionId = reunionId;
this.particularite = particularite;
this.partants = partants;
this.statut = statut;
this.nombreChevauxInscrits = nombreChevauxInscrits; this.nombreChevauxInscrits = nombreChevauxInscrits;
this.chevaux = chevaux;
} }
public int getId() { public int getId() {
@@ -37,6 +42,14 @@ public class Course {
this.id = id; this.id = id;
} }
public String getStype() {
return stype;
}
public void setStype(String stype) {
this.stype = stype;
}
public String getNumero() { public String getNumero() {
return numero; return numero;
} }
@@ -61,20 +74,44 @@ public class Course {
this.lieu = lieu; this.lieu = lieu;
} }
public LocalDateTime getDateDepartCourse() { public String getDateDepartCourse() {
return dateDepartCourse; return dateDepartCourse;
} }
public void setDateDepartCourse(LocalDateTime dateDepartCourse) { public void setDateDepartCourse(String dateDepartCourse) {
this.dateDepartCourse = dateDepartCourse; this.dateDepartCourse = dateDepartCourse;
} }
public String getReunion() { public int getReunionId() {
return reunion; return reunionId;
} }
public void setReunion(String reunion) { public void setReunionId(int reunionId) {
this.reunion = reunion; this.reunionId = reunionId;
}
public String getParticularite() {
return particularite;
}
public void setParticularite(String particularite) {
this.particularite = particularite;
}
public int getPartants() {
return partants;
}
public void setPartants(int partants) {
this.partants = partants;
}
public String getStatut() {
return statut;
}
public void setStatut(String statut) {
this.statut = statut;
} }
public int getNombreChevauxInscrits() { public int getNombreChevauxInscrits() {
@@ -84,12 +121,4 @@ public class Course {
public void setNombreChevauxInscrits(int nombreChevauxInscrits) { public void setNombreChevauxInscrits(int nombreChevauxInscrits) {
this.nombreChevauxInscrits = nombreChevauxInscrits; this.nombreChevauxInscrits = nombreChevauxInscrits;
} }
public List<Cheval> getChevaux() {
return chevaux;
}
public void setChevaux(List<Cheval> chevaux) {
this.chevaux = chevaux;
}
} }

View File

@@ -1,83 +1,36 @@
package com.example.quiz.data.model; package com.example.quiz.data.model;
import com.example.quiz.data.model.dtos.PariCourseDto;
import com.example.quiz.data.model.enums.CourseType;
import com.example.quiz.data.model.enums.PariStatut; import com.example.quiz.data.model.enums.PariStatut;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
public class Pari { public class Pari {
private String numeroTicket; private String numeroTicket;
private String typePari; private String typePari;
private String typeFormule; private String typeFormule;
private int mise; private double mise;
private String datePari; private String datePari;
private int courseId;
private String idParieur;
private String nomParieur;
private int cheval;
private int cheval1;
private int cheval2;
private int cheval3;
private int premier;
private int deuxieme;
private int troisieme;
private List<Integer> chevauxOrdre;
private List<Integer> chevauxSelectionnes;
private List<Integer> ordrePredit;
private boolean validationOrdreExact;
private String typeMulti;
private PariStatut status;
private boolean estPaye; private boolean estPaye;
private boolean estRembourse; private boolean estRembourse;
private PariCourseDto course;
private List<String> chevauxSelectionnes;
private List<String> ordrePredit;
private boolean validationOrdreExact;
private String typeMulti;
public Pari( public Pari(String numeroTicket, String typePari, String typeFormule, double mise, String datePari, boolean estPaye, boolean estRembourse, PariCourseDto course, List<String> chevauxSelectionnes, List<String> ordrePredit, boolean validationOrdreExact, String typeMulti) {
String numeroTicket,
String typePari,
String typeFormule,
int mise,
String datePari,
int courseId,
String idParieur,
String nomParieur,
int cheval,
int cheval1,
int cheval2,
int cheval3,
int premier,
int deuxieme,
int troisieme,
List<Integer> chevauxOrdre,
List<Integer> chevauxSelectionnes,
List<Integer> ordrePredit,
boolean validationOrdreExact,
String typeMulti,
PariStatut status,
boolean estPaye,
boolean estRembourse) {
this.numeroTicket = numeroTicket; this.numeroTicket = numeroTicket;
this.typePari = typePari; this.typePari = typePari;
this.typeFormule = typeFormule; this.typeFormule = typeFormule;
this.mise = mise; this.mise = mise;
this.datePari = datePari; this.datePari = datePari;
this.courseId = courseId; this.estPaye = estPaye;
this.idParieur = idParieur; this.estRembourse = estRembourse;
this.nomParieur = nomParieur; this.course = course;
this.cheval = cheval;
this.cheval1 = cheval1;
this.cheval2 = cheval2;
this.cheval3 = cheval3;
this.premier = premier;
this.deuxieme = deuxieme;
this.troisieme = troisieme;
this.chevauxOrdre = chevauxOrdre;
this.chevauxSelectionnes = chevauxSelectionnes; this.chevauxSelectionnes = chevauxSelectionnes;
this.ordrePredit = ordrePredit; this.ordrePredit = ordrePredit;
this.validationOrdreExact = validationOrdreExact; this.validationOrdreExact = validationOrdreExact;
this.typeMulti = typeMulti; this.typeMulti = typeMulti;
this.status = status;
this.estPaye = estPaye;
this.estRembourse = estRembourse;
} }
public String getNumeroTicket() { public String getNumeroTicket() {
@@ -104,11 +57,11 @@ public class Pari {
this.typeFormule = typeFormule; this.typeFormule = typeFormule;
} }
public int getMise() { public double getMise() {
return mise; return mise;
} }
public void setMise(int mise) { public void setMise(double mise) {
this.mise = mise; this.mise = mise;
} }
@@ -120,107 +73,43 @@ public class Pari {
this.datePari = datePari; this.datePari = datePari;
} }
public int getCourseId() { public boolean isEstPaye() {
return courseId; return estPaye;
} }
public void setCourseId(int courseId) { public void setEstPaye(boolean estPaye) {
this.courseId = courseId; this.estPaye = estPaye;
} }
public String getIdParieur() { public boolean isEstRembourse() {
return idParieur; return estRembourse;
} }
public void setIdParieur(String idParieur) { public void setEstRembourse(boolean estRembourse) {
this.idParieur = idParieur; this.estRembourse = estRembourse;
} }
public String getNomParieur() { public PariCourseDto getCourse() {
return nomParieur; return course;
} }
public void setNomParieur(String nomParieur) { public void setCourse(PariCourseDto course) {
this.nomParieur = nomParieur; this.course = course;
} }
public int getCheval() { public List<String> getChevauxSelectionnes() {
return cheval;
}
public void setCheval(int cheval) {
this.cheval = cheval;
}
public int getCheval1() {
return cheval1;
}
public void setCheval1(int cheval1) {
this.cheval1 = cheval1;
}
public int getCheval2() {
return cheval2;
}
public void setCheval2(int cheval2) {
this.cheval2 = cheval2;
}
public int getCheval3() {
return cheval3;
}
public void setCheval3(int cheval3) {
this.cheval3 = cheval3;
}
public int getPremier() {
return premier;
}
public void setPremier(int premier) {
this.premier = premier;
}
public int getDeuxieme() {
return deuxieme;
}
public void setDeuxieme(int deuxieme) {
this.deuxieme = deuxieme;
}
public int getTroisieme() {
return troisieme;
}
public void setTroisieme(int troisieme) {
this.troisieme = troisieme;
}
public List<Integer> getChevauxOrdre() {
return chevauxOrdre;
}
public void setChevauxOrdre(List<Integer> chevauxOrdre) {
this.chevauxOrdre = chevauxOrdre;
}
public List<Integer> getChevauxSelectionnes() {
return chevauxSelectionnes; return chevauxSelectionnes;
} }
public void setChevauxSelectionnes(List<Integer> chevauxSelectionnes) { public void setChevauxSelectionnes(List<String> chevauxSelectionnes) {
this.chevauxSelectionnes = chevauxSelectionnes; this.chevauxSelectionnes = chevauxSelectionnes;
} }
public List<Integer> getOrdrePredit() { public List<String> getOrdrePredit() {
return ordrePredit; return ordrePredit;
} }
public void setOrdrePredit(List<Integer> ordrePredit) { public void setOrdrePredit(List<String> ordrePredit) {
this.ordrePredit = ordrePredit; this.ordrePredit = ordrePredit;
} }
@@ -239,28 +128,4 @@ public class Pari {
public void setTypeMulti(String typeMulti) { public void setTypeMulti(String typeMulti) {
this.typeMulti = typeMulti; this.typeMulti = typeMulti;
} }
public PariStatut getStatus() {
return status;
}
public void setStatus(PariStatut status) {
this.status = status;
}
public boolean isEstPaye() {
return estPaye;
}
public void setEstPaye(boolean estPaye) {
this.estPaye = estPaye;
}
public boolean isEstRembourse() {
return estRembourse;
}
public void setEstRembourse(boolean estRembourse) {
this.estRembourse = estRembourse;
}
} }

View File

@@ -6,12 +6,12 @@ public class Reunion {
private int id; private int id;
private String code; private String code;
private String nom; private String nom;
private LocalDate date; private String date;
private int numero; private int numero;
private Hippodrome hippodrome; private Hippodrome hippodrome;
private int totalCourses; private int totalCourses;
public Reunion(int id, String code, String nom, LocalDate date, int numero, Hippodrome hippodrome, int totalCourses) { public Reunion(int id, String code, String nom, String date, int numero, Hippodrome hippodrome, int totalCourses) {
this.id = id; this.id = id;
this.code = code; this.code = code;
this.nom = nom; this.nom = nom;
@@ -45,11 +45,11 @@ public class Reunion {
this.nom = nom; this.nom = nom;
} }
public LocalDate getDate() { public String getDate() {
return date; return date;
} }
public void setDate(LocalDate date) { public void setDate(String date) {
this.date = date; this.date = date;
} }

View File

@@ -1,22 +1,23 @@
package com.example.quiz.data.model; package com.example.quiz.data.model;
public class TypeOfBet { public class TypeOfBet {
private int id;
private String name;
private String numberOfHorse;
public TypeOfBet(int id, String name, String numberOfHorse) { private String label;
this.id = id; private String name;
private int numberOfHorse;
public TypeOfBet(String label, String name, int numberOfHorse) {
this.label = label;
this.name = name; this.name = name;
this.numberOfHorse = numberOfHorse; this.numberOfHorse = numberOfHorse;
} }
public int getId() { public String getLabel() {
return id; return label;
} }
public void setId(int id) { public void setLabel(String label) {
this.id = id; this.label = label;
} }
public String getName() { public String getName() {
@@ -27,11 +28,11 @@ public class TypeOfBet {
this.name = name; this.name = name;
} }
public String getNumberOfHorse() { public int getNumberOfHorse() {
return numberOfHorse; return numberOfHorse;
} }
public void setNumberOfHorse(String numberOfHorse) { public void setNumberOfHorse(int numberOfHorse) {
this.numberOfHorse = numberOfHorse; this.numberOfHorse = numberOfHorse;
} }
} }

View File

@@ -0,0 +1,17 @@
package com.example.quiz.data.model.dtos;
public class PariCourseDto {
private int id;
public PariCourseDto(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View File

@@ -20,7 +20,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
@Module @Module
@InstallIn(SingletonComponent.class) @InstallIn(SingletonComponent.class)
public class ApiClient { public class ApiClient {
private static final String BASE_URL = "https://api.pmu.ml/api/v1/"; private static final String BASE_URL = "https://b440a25a7658.ngrok-free.app/api/v1/";
@Provides @Provides
@Singleton @Singleton

View File

@@ -10,14 +10,15 @@ import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Path;
public interface ApiService { public interface ApiService {
@GET("reunions") @GET("reunions")
Call<List<Reunion>> getReunions(); Call<List<Reunion>> getReunions();
@GET("course/avenir") @GET("courses/reunion/{reunionId}")
Call<List<Course>> getCourses(); Call<List<Course>> getCourses(@Path("reunionId") String reunionId);
@POST("/pari") @POST("pari")
Call<Pari> createPari(@Body Pari pari); Call<Pari> createPari(@Body Pari pari);
} }

View File

@@ -1,5 +1,7 @@
package com.example.quiz.data.repository; package com.example.quiz.data.repository;
import android.util.Log;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
@@ -23,10 +25,10 @@ public class CourseRepository {
this.apiService = apiService; this.apiService = apiService;
} }
public LiveData<Result<List<Course>>> getCourses() { public LiveData<Result<List<Course>>> getCourses(String reunionId) {
MutableLiveData<Result<List<Course>>> liveCourses = new MutableLiveData<Result<List<Course>>>(); MutableLiveData<Result<List<Course>>> liveCourses = new MutableLiveData<Result<List<Course>>>();
liveCourses.setValue(Result.loading()); liveCourses.setValue(Result.loading());
apiService.getCourses().enqueue(new Callback<List<Course>>() { apiService.getCourses(reunionId).enqueue(new Callback<List<Course>>() {
@Override @Override
public void onResponse(Call<List<Course>> call, Response<List<Course>> response) { public void onResponse(Call<List<Course>> call, Response<List<Course>> response) {
if(response.isSuccessful()){ if(response.isSuccessful()){

View File

@@ -25,24 +25,37 @@ public class PariRepository {
} }
public LiveData<Result<Pari>> createPari(Pari pari) { public LiveData<Result<Pari>> createPari(Pari pari) {
MutableLiveData<Result<Pari>> pariResponse = new MutableLiveData<Result<Pari>>(); MutableLiveData<Result<Pari>> pariResponse = new MutableLiveData<>();
pariResponse.setValue(Result.loading()); pariResponse.setValue(Result.loading());
apiService.createPari(pari).enqueue(new Callback<Pari>() { apiService.createPari(pari).enqueue(new Callback<Pari>() {
@Override @Override
public void onResponse(Call<Pari> call, Response<Pari> response) { public void onResponse(Call<Pari> call, Response<Pari> response) {
if(response.isSuccessful()){
if (response.isSuccessful() && response.body() != null) {
pariResponse.postValue(Result.success(response.body())); pariResponse.postValue(Result.success(response.body()));
}else { } else {
pariResponse.postValue(Result.error(response.message())); // On récupère l'erreur exacte envoyée par le backend
try {
String errorBody = response.errorBody() != null ?
response.errorBody().string() : "Erreur inconnue";
pariResponse.postValue(Result.error(errorBody));
} catch (Exception e) {
pariResponse.postValue(Result.error("Erreur serveur"));
}
} }
} }
@Override @Override
public void onFailure(Call<Pari> call, Throwable throwable) { public void onFailure(Call<Pari> call, Throwable t) {
pariResponse.postValue(Result.error(throwable.getMessage())); pariResponse.postValue(Result.error(t.getMessage()));
} }
}); });
return pariResponse; return pariResponse;
} }
} }

View File

@@ -6,9 +6,15 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Environment;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Set; import java.util.Set;
@@ -87,18 +93,25 @@ public class HPRTPrinterUtil {
} }
} }
public void printText(StringBuilder text) { public void printText(Bitmap logo, StringBuilder text) {
try { try {
if (!HPRTPrinterHelper.IsOpened()) { if (!HPRTPrinterHelper.IsOpened()) {
Toast.makeText(context, "Imprimante non connectée", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Imprimante non connectée", Toast.LENGTH_SHORT).show();
return; return;
} }
Bitmap resized = resizeForPrinter(logo, 384);
HPRTPrinterHelper.printImage("0", "0", resized, false);
// TSPL pur pour texte simple
String tspl = ""+ text + "\r\n"; String tspl = ""+ text + "\r\n";
// Envoi à l'imprimante // Envoi à l'imprimante
HPRTPrinterHelper.PrintData(tspl); //HPRTPrinterHelper.PrintData(tspl);
Log.d(TAG, "Texte imprimé sur ticket"); // on log seulement le succès Log.d(TAG, "Texte imprimé sur ticket"); // on log seulement le succès
@@ -110,6 +123,7 @@ public class HPRTPrinterUtil {
public void printTSPLTemplate(String tsplTemplate) { public void printTSPLTemplate(String tsplTemplate) {
try { try {
if (!HPRTPrinterHelper.IsOpened()) { if (!HPRTPrinterHelper.IsOpened()) {
@@ -125,6 +139,121 @@ public class HPRTPrinterUtil {
} }
} }
public static Bitmap toMonochrome(Bitmap src) {
int width = src.getWidth();
int height = src.getHeight();
// Bitmap de sortie en ARGB_8888
Bitmap bw = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int pixel = src.getPixel(x, y);
// Calcul de la luminance (grayscale)
int gray = (Color.red(pixel) + Color.green(pixel) + Color.blue(pixel)) / 3;
// Seuil pour décider noir ou blanc
if (gray < 128) {
bw.setPixel(x, y, Color.BLACK);
} else {
bw.setPixel(x, y, Color.WHITE);
}
}
}
return bw;
}
public static byte[] bitmapToEscPos(Bitmap bitmap) throws IOException {
bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, false);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int bytesPerRow = (width + 7) / 8;
byte[] imageBytes = new byte[bytesPerRow * height];
int index = 0;
for (int y = 0; y < height; y++) {
int bitIndex = 0;
byte currentByte = 0;
for (int x = 0; x < width; x++) {
int color = bitmap.getPixel(x, y);
int gray = (Color.red(color) + Color.green(color) + Color.blue(color)) / 3;
currentByte <<= 1;
if (gray < 128) currentByte |= 1;
bitIndex++;
if (bitIndex == 8) {
imageBytes[index++] = currentByte;
currentByte = 0;
bitIndex = 0;
}
}
if (bitIndex > 0) {
currentByte <<= (8 - bitIndex);
imageBytes[index++] = currentByte;
}
}
// Préfixe ESC/POS GS v 0
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(0x1D);
baos.write('v');
baos.write('0');
baos.write(0); // Normal mode
baos.write(bytesPerRow & 0xFF);
baos.write((bytesPerRow >> 8) & 0xFF);
baos.write(height & 0xFF);
baos.write((height >> 8) & 0xFF);
baos.write(imageBytes);
return baos.toByteArray();
}
public static Bitmap resizeForPrinter(Bitmap bmp, int maxWidth){
if(bmp.getWidth() <= maxWidth) return bmp;
int newHeight = bmp.getHeight() * maxWidth / bmp.getWidth();
return Bitmap.createScaledBitmap(bmp, maxWidth, newHeight, false);
}
// 2. Convertir le bitmap monochrome en flux binaire TSPL
public static byte[] bitmapToTsplBinary(Bitmap bmp){
int width = bmp.getWidth();
int height = bmp.getHeight();
int bytesPerRow = (width + 7) / 8;
byte[] data = new byte[bytesPerRow*height];
int index = 0;
for(int y=0;y<height;y++){
int bitIndex = 0;
byte currentByte = 0;
for(int x=0;x<width;x++){
int pixel = bmp.getPixel(x, y);
currentByte <<= 1;
if(pixel == Color.BLACK) currentByte |= 1;
bitIndex++;
if(bitIndex==8){
data[index++] = currentByte;
currentByte = 0;
bitIndex = 0;
}
}
if(bitIndex != 0){
currentByte <<= (8 - bitIndex);
data[index++] = currentByte;
}
}
return data;
}
/** /**
* Déconnecte l'imprimante * Déconnecte l'imprimante
*/ */

View File

@@ -24,9 +24,9 @@ public class CourseViewModel extends ViewModel {
this.courseRepository = courseRepository; this.courseRepository = courseRepository;
} }
public LiveData<Result<List<Course>>> getCourses(){ public LiveData<Result<List<Course>>> getCourses(String reunionId){
if(courses == null){ if(courses == null){
courses = courseRepository.getCourses(); courses = courseRepository.getCourses(reunionId);
} }
return courses; return courses;
} }

View File

@@ -16,7 +16,7 @@ public class SharedViewModel extends ViewModel {
public MutableLiveData<Reunion> selectedReunion = new MutableLiveData<Reunion>(); public MutableLiveData<Reunion> selectedReunion = new MutableLiveData<Reunion>();
public MutableLiveData<Course> selectedCourse = new MutableLiveData<Course>(); public MutableLiveData<Course> selectedCourse = new MutableLiveData<Course>();
public MutableLiveData<String> typeOfBet = new MutableLiveData<String>(); public MutableLiveData<TypeOfBet> typeOfBet = new MutableLiveData<TypeOfBet>();
public void setSelectedReunion(Reunion reunion){ public void setSelectedReunion(Reunion reunion){
@@ -26,7 +26,7 @@ public class SharedViewModel extends ViewModel {
public void setSelectedCourse(Course course){ public void setSelectedCourse(Course course){
selectedCourse.setValue(course); selectedCourse.setValue(course);
} }
public void setTypeOfBet(String type){ public void setTypeOfBet(TypeOfBet type){
typeOfBet.setValue(type); typeOfBet.setValue(type);
} }
} }

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#FFD700"/> <solid android:color="#FFEB3B"/>
</shape> </shape>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="32.75"
android:viewportHeight="32.75">
<path
android:pathData="M31.799,18.963l-9.351,11.012c-0.791,0.932 -1.919,1.409 -3.052,1.409c-0.916,0 -1.834,-0.312 -2.587,-0.949c-1.684,-1.432 -1.889,-3.954 -0.459,-5.64l3.753,-4.42H4c-2.209,0 -4,-1.791 -4,-4c0,-2.208 1.791,-4 4,-4h16.105l-3.754,-4.42c-1.43,-1.684 -1.225,-4.208 0.459,-5.638c1.687,-1.429 4.209,-1.225 5.639,0.459l9.351,11.01C33.066,15.278 33.066,17.472 31.799,18.963z"
android:fillColor="#fff"/>
</vector>

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient <gradient
android:startColor="@color/green_opacity_30" android:startColor="#2e4f32"
android:endColor="@color/primary_green" android:endColor="@color/primary_green"
android:angle="45"/> android:angle="45"/>
<corners android:radius="16dp"/> <corners android:radius="20dp"/>
</shape> </shape>

View File

@@ -4,8 +4,8 @@
<!-- Gradient vibrant pour la sélection --> <!-- Gradient vibrant pour la sélection -->
<gradient <gradient
android:startColor="#4CAF50" android:startColor="#13691e"
android:endColor="#81C784" android:endColor="#224a27"
android:angle="45"/> android:angle="45"/>
<corners android:radius="16dp"/> <corners android:radius="16dp"/>

View File

@@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="10dp" android:padding="10dp"
android:background="@color/text_hint_color" android:background="@color/text_hint_color">
>
<!-- Header -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center" android:gravity="center"
android:paddingTop="10dp" android:paddingTop="10dp">
>
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
@@ -22,35 +20,35 @@
android:fontFamily="@string/LItem" android:fontFamily="@string/LItem"
android:paddingBottom="12dp" android:paddingBottom="12dp"
android:text="@string/bet_type_title" android:text="@string/bet_type_title"
android:textFontWeight="400"
android:textColor="@color/primary_green" android:textColor="@color/primary_green"
android:textSize="22sp" android:textSize="22sp"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<View <View
android:id="@+id/divider" android:id="@+id/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<!-- Les options statiques --> <!-- RecyclerView avec weight pour prendre tout l'espace restant -->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_marginVertical="30dp"
android:id="@+id/typeOfBetRecyclerView" android:id="@+id/typeOfBetRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="0dp"
</androidx.recyclerview.widget.RecyclerView> android:layout_weight="1"
android:clipToPadding="false"
android:paddingVertical="10dp"
android:scrollbars="vertical" />
<!-- Bouton toujours en bas -->
<Button <Button
android:id="@+id/btnValidate" android:id="@+id/btnValidate"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingVertical="2dp" android:paddingVertical="12dp"
android:background="@drawable/rounded_button_green" android:background="@drawable/rounded_button_green"
android:textAllCaps="false" android:textAllCaps="false"
android:text="@string/validate" android:text="@string/validate" />
>
</Button>
</LinearLayout> </LinearLayout>

View File

@@ -1,31 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingVertical="2dp" android:layout_marginVertical="3dp"
xmlns:app="http://schemas.android.com/tools" android:layout_marginHorizontal="12dp"
android:layout_marginVertical="10dp" card_view:cardCornerRadius="20dp"
android:layout_marginHorizontal="10dp" card_view:cardElevation="8dp"
card_view:cardCornerRadius="16dp" android:foreground="?attr/selectableItemBackground">
card_view:cardElevation="6dp"
android:foreground="?attr/selectableItemBackground"
app:ignore="NamespaceTypo">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="60dp"
android:orientation="horizontal" android:orientation="horizontal"
android:padding="16dp" android:padding="16dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:background="@drawable/item_gradient_bg"> android:clipToPadding="false">
<!-- Icône ou cercle coloré --> <!-- Cercle coloré / icône -->
<View <View
android:layout_width="18dp" android:layout_width="20dp"
android:layout_height="18dp" android:layout_height="20dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="@drawable/circle_primary"/> android:background="@drawable/circle_primary" />
<!-- Texte principal --> <!-- Texte principal -->
<TextView <TextView
@@ -38,15 +34,14 @@
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
android:text="Type de pari" android:text="Type de pari"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true"/> android:singleLine="true" />
<!-- Flèche / icône à droite --> <!-- Flèche / icône -->
<ImageView <ImageView
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:src="@drawable/ic_arrow_right" android:src="@drawable/ic_right_arrow"
app:tint="@color/white" card_view:tint="@android:color/white" />
/>
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>