break for printer!
This commit is contained in:
@@ -11,7 +11,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.example.quiz"
|
||||
minSdk = 29
|
||||
minSdk = 16
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
@@ -29,8 +29,8 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
|
||||
Binary file not shown.
@@ -1,9 +1,12 @@
|
||||
package com.example.quiz;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
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.Reunion;
|
||||
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.databinding.FragmentBetValidationBinding;
|
||||
import com.example.quiz.utils.HPRTPrinterUtil;
|
||||
import com.example.quiz.utils.Result;
|
||||
import com.example.quiz.viewModel.PariViewModel;
|
||||
import com.example.quiz.viewModel.SharedViewModel;
|
||||
import com.google.android.material.appbar.MaterialToolbar;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import dagger.hilt.android.AndroidEntryPoint;
|
||||
|
||||
@@ -55,7 +62,7 @@ public class BetValidation extends Fragment {
|
||||
|
||||
private HPRTPrinterUtil printer;
|
||||
|
||||
private String typeOfBet;
|
||||
private TypeOfBet typeOfBet;
|
||||
|
||||
private Reunion reunion;
|
||||
|
||||
@@ -101,7 +108,7 @@ public class BetValidation extends Fragment {
|
||||
int columns = 7;
|
||||
grid.setColumnCount(columns);
|
||||
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));
|
||||
grid.addView(createNumberItem(String.valueOf(i)));
|
||||
}
|
||||
@@ -151,15 +158,14 @@ public class BetValidation extends Fragment {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
pariViewModel = new ViewModelProvider(this).get(PariViewModel.class);
|
||||
/*viewModel = new ViewModelProvider(this).get(BetViewModel.class);
|
||||
viewModel.getBetNameById(shared.betId.getValue() - 1);
|
||||
viewModel.betName.observe(getViewLifecycleOwner(), name ->{
|
||||
binding.horseName.setText(name);
|
||||
});
|
||||
viewModel.loadHorses(shared.betId.getValue() - 1);
|
||||
if(viewModel.partant.getValue() != null){
|
||||
this.totalHorses = viewModel.partant.getValue();
|
||||
}*/
|
||||
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||
if(activity != null){
|
||||
MaterialToolbar toolbar = activity.findViewById(R.id.toolbar);
|
||||
activity.setSupportActionBar(toolbar);
|
||||
if(activity.getSupportActionBar() != null){
|
||||
activity.getSupportActionBar().setTitle("Pari "+shared.selectedCourse.getValue().getNom());
|
||||
}
|
||||
}
|
||||
|
||||
setupNumberGrid(binding.gridNumbers);
|
||||
binding.paymentType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@@ -183,13 +189,13 @@ public class BetValidation extends Fragment {
|
||||
|
||||
binding.order.setOnCheckedChangeListener((buttonView, 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>>() {
|
||||
@Override
|
||||
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"));
|
||||
}
|
||||
});
|
||||
@@ -207,53 +213,27 @@ public class BetValidation extends Fragment {
|
||||
reunion = shared.selectedReunion.getValue();
|
||||
course = shared.selectedCourse.getValue();
|
||||
|
||||
int required = 0;
|
||||
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;
|
||||
}
|
||||
int required = typeOfBet.getNumberOfHorse();
|
||||
|
||||
if(required == 0){
|
||||
Toast.makeText(getContext(), "Erreur de type de pari", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if(selectedHorses.getValue().size() < required){
|
||||
Toast.makeText(getContext(), "Veuillez sélectionner au moins"+required+" chevaux", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Pari pari = new Pari(
|
||||
generate12Digits(),
|
||||
shared.typeOfBet.getValue(),
|
||||
"QUARTE_PLUS",
|
||||
shared.typeOfBet.getValue().getName(),
|
||||
"GAGNANT",
|
||||
mise,
|
||||
"07/11/2025 05:08:00",
|
||||
shared.selectedCourse.getValue().getId(),
|
||||
"123456789",
|
||||
"John Doe",
|
||||
1,
|
||||
5,
|
||||
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(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss").format(LocalDateTime.now()),
|
||||
true,
|
||||
true,
|
||||
new PariCourseDto(shared.selectedCourse.getValue().getId()),
|
||||
selectedHorses.getValue(),
|
||||
order?selectedHorses.getValue():new ArrayList<String>(),
|
||||
order,
|
||||
shared.typeOfBet.getValue(),
|
||||
PariStatut.PERDANT,
|
||||
false,
|
||||
false
|
||||
"MULTI_4"
|
||||
);
|
||||
pariViewModel.createPari(pari).observe(getViewLifecycleOwner(), new Observer<Result<Pari>>() {
|
||||
@Override
|
||||
@@ -288,6 +268,7 @@ public class BetValidation extends Fragment {
|
||||
printer = new HPRTPrinterUtil(getContext());
|
||||
boolean ok = printer.autoConnectBluetoothByName();
|
||||
if(ok){
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.pmu_logo);
|
||||
StringBuilder tspl = new StringBuilder();
|
||||
tspl.append("PARIS HIPPIQUE (PMU MALI)\n");
|
||||
|
||||
@@ -307,7 +288,7 @@ public class BetValidation extends Fragment {
|
||||
tspl.append("----------------------------\n");
|
||||
tspl.append("Bonne chance !\n\n\n");
|
||||
|
||||
printer.printText(tspl);
|
||||
printer.printText(bitmap, tspl);
|
||||
}
|
||||
selectedHorses.setValue(List.of());
|
||||
binding.combination.setText(getString(R.string.combination,""));
|
||||
|
||||
@@ -80,11 +80,12 @@ public class ListOFBets extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
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.setAdapter(adapter);
|
||||
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(){
|
||||
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
|
||||
public void onChanged(Result<List<Course>> result) {
|
||||
switch (result.status){
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.quiz.data.adapter.TypeOfBetAdapter;
|
||||
import com.example.quiz.data.model.TypeOfBet;
|
||||
import com.example.quiz.databinding.FragmentListOfTypeOfBetsBinding;
|
||||
import com.example.quiz.viewModel.SharedViewModel;
|
||||
import com.google.android.material.appbar.MaterialToolbar;
|
||||
@@ -85,7 +86,43 @@ public class ListOfTypeOfBets extends Fragment {
|
||||
adapter = new TypeOfBetAdapter(new ArrayList<>());
|
||||
adapter.setOnItemClickListener(type -> shared.setTypeOfBet(type));
|
||||
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
|
||||
/*viewModel.types.observe(getViewLifecycleOwner(), type -> {
|
||||
|
||||
@@ -17,9 +17,14 @@ import com.example.quiz.viewModel.SharedViewModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder> {
|
||||
|
||||
private List<Course> bets = new ArrayList<>();
|
||||
private onItemClickListener listener;
|
||||
private SharedViewModel shared;
|
||||
|
||||
public BetsAdapter(SharedViewModel shared) {
|
||||
this.shared = shared;
|
||||
}
|
||||
|
||||
public interface onItemClickListener {
|
||||
void onItemClick(Course bet);
|
||||
@@ -29,8 +34,6 @@ public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder>
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setBets(List<Course> bets){
|
||||
this.bets = bets;
|
||||
notifyDataSetChanged();
|
||||
@@ -39,26 +42,27 @@ public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder>
|
||||
@NonNull
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull BetViewHolder holder, int position) {
|
||||
Course bet = bets.get(position);
|
||||
|
||||
holder.tvDate.setText(String.valueOf(bet.getDateDepartCourse()));
|
||||
holder.tvName.setText(String.valueOf(bet.getLieu()));
|
||||
holder.tvReunion.setText("Nom de la réunion");
|
||||
holder.itemView.setOnClickListener(v->{
|
||||
if(listener != null){
|
||||
listener.onItemClick(bet);
|
||||
}
|
||||
holder.tvName.setText(bet.getNom());
|
||||
|
||||
if (shared != null && shared.selectedReunion.getValue() != null) {
|
||||
holder.tvReunion.setText(shared.selectedReunion.getValue().getNom());
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onItemClick(bet);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount(){
|
||||
return bets.size();
|
||||
@@ -66,13 +70,12 @@ public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder>
|
||||
|
||||
static class BetViewHolder extends RecyclerView.ViewHolder{
|
||||
TextView tvName, tvDate, tvReunion;
|
||||
|
||||
public BetViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvName = itemView.findViewById(R.id.tvName);
|
||||
tvDate = itemView.findViewById(R.id.tvDate);
|
||||
tvReunion = itemView.findViewById(R.id.tvReunion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,24 +14,24 @@ import com.example.quiz.data.model.TypeOfBet;
|
||||
import java.util.List;
|
||||
|
||||
public class TypeOfBetAdapter extends RecyclerView.Adapter<TypeOfBetAdapter.TypeOfBetViewHolder> {
|
||||
private List<String> types;
|
||||
private List<TypeOfBet> types;
|
||||
private onItemClickListener listener;
|
||||
|
||||
private int selectedPosition = -1;
|
||||
|
||||
public interface onItemClickListener{
|
||||
void onItemClick(String type);
|
||||
void onItemClick(TypeOfBet type);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(TypeOfBetAdapter.onItemClickListener listener){
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public TypeOfBetAdapter(List<String> types){
|
||||
public TypeOfBetAdapter(List<TypeOfBet> types){
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public void setTypes(List<String> types){
|
||||
public void setTypes(List<TypeOfBet> types){
|
||||
this.types = types;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
@@ -46,8 +46,8 @@ public class TypeOfBetAdapter extends RecyclerView.Adapter<TypeOfBetAdapter.Type
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull TypeOfBetViewHolder holder, int position) {
|
||||
String type = types.get(position);
|
||||
holder.type_of_bet_name.setText(type);
|
||||
TypeOfBet type = types.get(position);
|
||||
holder.type_of_bet_name.setText(type.getLabel());
|
||||
if(selectedPosition != position){
|
||||
holder.itemView.setBackgroundResource(R.drawable.item_gradient_bg);
|
||||
}else{
|
||||
|
||||
@@ -9,24 +9,29 @@ import java.util.List;
|
||||
|
||||
public class Course {
|
||||
private int id;
|
||||
private String stype;
|
||||
private String numero;
|
||||
private String nom;
|
||||
private String lieu;
|
||||
private LocalDateTime dateDepartCourse;
|
||||
private String reunion;
|
||||
private String dateDepartCourse;
|
||||
private int reunionId;
|
||||
private String particularite;
|
||||
private int partants;
|
||||
private String statut;
|
||||
private int nombreChevauxInscrits;
|
||||
|
||||
private List<Cheval> chevaux;
|
||||
|
||||
public Course(int id, String numero, String nom, String lieu, LocalDateTime dateDepartCourse, String reunion, int nombreChevauxInscrits, 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) {
|
||||
this.id = id;
|
||||
this.stype = stype;
|
||||
this.numero = numero;
|
||||
this.nom = nom;
|
||||
this.lieu = lieu;
|
||||
this.dateDepartCourse = dateDepartCourse;
|
||||
this.reunion = reunion;
|
||||
this.reunionId = reunionId;
|
||||
this.particularite = particularite;
|
||||
this.partants = partants;
|
||||
this.statut = statut;
|
||||
this.nombreChevauxInscrits = nombreChevauxInscrits;
|
||||
this.chevaux = chevaux;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
@@ -37,6 +42,14 @@ public class Course {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStype() {
|
||||
return stype;
|
||||
}
|
||||
|
||||
public void setStype(String stype) {
|
||||
this.stype = stype;
|
||||
}
|
||||
|
||||
public String getNumero() {
|
||||
return numero;
|
||||
}
|
||||
@@ -61,20 +74,44 @@ public class Course {
|
||||
this.lieu = lieu;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateDepartCourse() {
|
||||
public String getDateDepartCourse() {
|
||||
return dateDepartCourse;
|
||||
}
|
||||
|
||||
public void setDateDepartCourse(LocalDateTime dateDepartCourse) {
|
||||
public void setDateDepartCourse(String dateDepartCourse) {
|
||||
this.dateDepartCourse = dateDepartCourse;
|
||||
}
|
||||
|
||||
public String getReunion() {
|
||||
return reunion;
|
||||
public int getReunionId() {
|
||||
return reunionId;
|
||||
}
|
||||
|
||||
public void setReunion(String reunion) {
|
||||
this.reunion = reunion;
|
||||
public void setReunionId(int reunionId) {
|
||||
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() {
|
||||
@@ -84,12 +121,4 @@ public class Course {
|
||||
public void setNombreChevauxInscrits(int nombreChevauxInscrits) {
|
||||
this.nombreChevauxInscrits = nombreChevauxInscrits;
|
||||
}
|
||||
|
||||
public List<Cheval> getChevaux() {
|
||||
return chevaux;
|
||||
}
|
||||
|
||||
public void setChevaux(List<Cheval> chevaux) {
|
||||
this.chevaux = chevaux;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +1,36 @@
|
||||
package com.example.quiz.data.model;
|
||||
|
||||
import com.example.quiz.data.model.enums.CourseType;
|
||||
import com.example.quiz.data.model.dtos.PariCourseDto;
|
||||
import com.example.quiz.data.model.enums.PariStatut;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Pari {
|
||||
private String numeroTicket;
|
||||
private String typePari;
|
||||
private String typeFormule;
|
||||
private int mise;
|
||||
private double mise;
|
||||
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 estRembourse;
|
||||
private PariCourseDto course;
|
||||
private List<String> chevauxSelectionnes;
|
||||
private List<String> ordrePredit;
|
||||
private boolean validationOrdreExact;
|
||||
private String typeMulti;
|
||||
|
||||
public Pari(
|
||||
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) {
|
||||
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) {
|
||||
this.numeroTicket = numeroTicket;
|
||||
this.typePari = typePari;
|
||||
this.typeFormule = typeFormule;
|
||||
this.mise = mise;
|
||||
this.datePari = datePari;
|
||||
this.courseId = courseId;
|
||||
this.idParieur = idParieur;
|
||||
this.nomParieur = nomParieur;
|
||||
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.estPaye = estPaye;
|
||||
this.estRembourse = estRembourse;
|
||||
this.course = course;
|
||||
this.chevauxSelectionnes = chevauxSelectionnes;
|
||||
this.ordrePredit = ordrePredit;
|
||||
this.validationOrdreExact = validationOrdreExact;
|
||||
this.typeMulti = typeMulti;
|
||||
this.status = status;
|
||||
this.estPaye = estPaye;
|
||||
this.estRembourse = estRembourse;
|
||||
}
|
||||
|
||||
public String getNumeroTicket() {
|
||||
@@ -104,11 +57,11 @@ public class Pari {
|
||||
this.typeFormule = typeFormule;
|
||||
}
|
||||
|
||||
public int getMise() {
|
||||
public double getMise() {
|
||||
return mise;
|
||||
}
|
||||
|
||||
public void setMise(int mise) {
|
||||
public void setMise(double mise) {
|
||||
this.mise = mise;
|
||||
}
|
||||
|
||||
@@ -120,107 +73,43 @@ public class Pari {
|
||||
this.datePari = datePari;
|
||||
}
|
||||
|
||||
public int getCourseId() {
|
||||
return courseId;
|
||||
public boolean isEstPaye() {
|
||||
return estPaye;
|
||||
}
|
||||
|
||||
public void setCourseId(int courseId) {
|
||||
this.courseId = courseId;
|
||||
public void setEstPaye(boolean estPaye) {
|
||||
this.estPaye = estPaye;
|
||||
}
|
||||
|
||||
public String getIdParieur() {
|
||||
return idParieur;
|
||||
public boolean isEstRembourse() {
|
||||
return estRembourse;
|
||||
}
|
||||
|
||||
public void setIdParieur(String idParieur) {
|
||||
this.idParieur = idParieur;
|
||||
public void setEstRembourse(boolean estRembourse) {
|
||||
this.estRembourse = estRembourse;
|
||||
}
|
||||
|
||||
public String getNomParieur() {
|
||||
return nomParieur;
|
||||
public PariCourseDto getCourse() {
|
||||
return course;
|
||||
}
|
||||
|
||||
public void setNomParieur(String nomParieur) {
|
||||
this.nomParieur = nomParieur;
|
||||
public void setCourse(PariCourseDto course) {
|
||||
this.course = course;
|
||||
}
|
||||
|
||||
public int getCheval() {
|
||||
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() {
|
||||
public List<String> getChevauxSelectionnes() {
|
||||
return chevauxSelectionnes;
|
||||
}
|
||||
|
||||
public void setChevauxSelectionnes(List<Integer> chevauxSelectionnes) {
|
||||
public void setChevauxSelectionnes(List<String> chevauxSelectionnes) {
|
||||
this.chevauxSelectionnes = chevauxSelectionnes;
|
||||
}
|
||||
|
||||
public List<Integer> getOrdrePredit() {
|
||||
public List<String> getOrdrePredit() {
|
||||
return ordrePredit;
|
||||
}
|
||||
|
||||
public void setOrdrePredit(List<Integer> ordrePredit) {
|
||||
public void setOrdrePredit(List<String> ordrePredit) {
|
||||
this.ordrePredit = ordrePredit;
|
||||
}
|
||||
|
||||
@@ -239,28 +128,4 @@ public class Pari {
|
||||
public void setTypeMulti(String 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ public class Reunion {
|
||||
private int id;
|
||||
private String code;
|
||||
private String nom;
|
||||
private LocalDate date;
|
||||
private String date;
|
||||
private int numero;
|
||||
private Hippodrome hippodrome;
|
||||
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.code = code;
|
||||
this.nom = nom;
|
||||
@@ -45,11 +45,11 @@ public class Reunion {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
package com.example.quiz.data.model;
|
||||
|
||||
public class TypeOfBet {
|
||||
private int id;
|
||||
private String name;
|
||||
private String numberOfHorse;
|
||||
|
||||
public TypeOfBet(int id, String name, String numberOfHorse) {
|
||||
this.id = id;
|
||||
private String label;
|
||||
private String name;
|
||||
private int numberOfHorse;
|
||||
|
||||
public TypeOfBet(String label, String name, int numberOfHorse) {
|
||||
this.label = label;
|
||||
this.name = name;
|
||||
this.numberOfHorse = numberOfHorse;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -27,11 +28,11 @@ public class TypeOfBet {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getNumberOfHorse() {
|
||||
public int getNumberOfHorse() {
|
||||
return numberOfHorse;
|
||||
}
|
||||
|
||||
public void setNumberOfHorse(String numberOfHorse) {
|
||||
public void setNumberOfHorse(int numberOfHorse) {
|
||||
this.numberOfHorse = numberOfHorse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||
@Module
|
||||
@InstallIn(SingletonComponent.class)
|
||||
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
|
||||
@Singleton
|
||||
|
||||
@@ -10,14 +10,15 @@ import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
|
||||
public interface ApiService {
|
||||
@GET("reunions")
|
||||
Call<List<Reunion>> getReunions();
|
||||
|
||||
@GET("course/avenir")
|
||||
Call<List<Course>> getCourses();
|
||||
@GET("courses/reunion/{reunionId}")
|
||||
Call<List<Course>> getCourses(@Path("reunionId") String reunionId);
|
||||
|
||||
@POST("/pari")
|
||||
@POST("pari")
|
||||
Call<Pari> createPari(@Body Pari pari);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.example.quiz.data.repository;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
@@ -23,10 +25,10 @@ public class CourseRepository {
|
||||
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>>>();
|
||||
liveCourses.setValue(Result.loading());
|
||||
apiService.getCourses().enqueue(new Callback<List<Course>>() {
|
||||
apiService.getCourses(reunionId).enqueue(new Callback<List<Course>>() {
|
||||
@Override
|
||||
public void onResponse(Call<List<Course>> call, Response<List<Course>> response) {
|
||||
if(response.isSuccessful()){
|
||||
|
||||
@@ -25,24 +25,37 @@ public class PariRepository {
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
apiService.createPari(pari).enqueue(new Callback<Pari>() {
|
||||
@Override
|
||||
public void onResponse(Call<Pari> call, Response<Pari> response) {
|
||||
if(response.isSuccessful()){
|
||||
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
pariResponse.postValue(Result.success(response.body()));
|
||||
}else {
|
||||
pariResponse.postValue(Result.error(response.message()));
|
||||
} else {
|
||||
// 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
|
||||
public void onFailure(Call<Pari> call, Throwable throwable) {
|
||||
pariResponse.postValue(Result.error(throwable.getMessage()));
|
||||
public void onFailure(Call<Pari> call, Throwable t) {
|
||||
pariResponse.postValue(Result.error(t.getMessage()));
|
||||
}
|
||||
});
|
||||
|
||||
return pariResponse;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,15 @@ import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
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.util.Set;
|
||||
|
||||
@@ -87,18 +93,25 @@ public class HPRTPrinterUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public void printText(StringBuilder text) {
|
||||
public void printText(Bitmap logo, StringBuilder text) {
|
||||
try {
|
||||
if (!HPRTPrinterHelper.IsOpened()) {
|
||||
Toast.makeText(context, "Imprimante non connectée", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Bitmap resized = resizeForPrinter(logo, 384);
|
||||
|
||||
HPRTPrinterHelper.printImage("0", "0", resized, false);
|
||||
|
||||
// TSPL pur pour texte simple
|
||||
String tspl = ""+ text + "\r\n";
|
||||
|
||||
|
||||
|
||||
|
||||
// Envoi à l'imprimante
|
||||
HPRTPrinterHelper.PrintData(tspl);
|
||||
//HPRTPrinterHelper.PrintData(tspl);
|
||||
|
||||
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) {
|
||||
try {
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -24,9 +24,9 @@ public class CourseViewModel extends ViewModel {
|
||||
this.courseRepository = courseRepository;
|
||||
}
|
||||
|
||||
public LiveData<Result<List<Course>>> getCourses(){
|
||||
public LiveData<Result<List<Course>>> getCourses(String reunionId){
|
||||
if(courses == null){
|
||||
courses = courseRepository.getCourses();
|
||||
courses = courseRepository.getCourses(reunionId);
|
||||
}
|
||||
return courses;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SharedViewModel extends ViewModel {
|
||||
|
||||
public MutableLiveData<Reunion> selectedReunion = new MutableLiveData<Reunion>();
|
||||
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){
|
||||
@@ -26,7 +26,7 @@ public class SharedViewModel extends ViewModel {
|
||||
public void setSelectedCourse(Course course){
|
||||
selectedCourse.setValue(course);
|
||||
}
|
||||
public void setTypeOfBet(String type){
|
||||
public void setTypeOfBet(TypeOfBet type){
|
||||
typeOfBet.setValue(type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||
<solid android:color="#FFD700"/>
|
||||
<solid android:color="#FFEB3B"/>
|
||||
</shape>
|
||||
|
||||
9
app/src/main/res/drawable/ic_right_arrow.xml
Normal file
9
app/src/main/res/drawable/ic_right_arrow.xml
Normal 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>
|
||||
@@ -1,8 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="@color/green_opacity_30"
|
||||
android:startColor="#2e4f32"
|
||||
android:endColor="@color/primary_green"
|
||||
android:angle="45"/>
|
||||
<corners android:radius="16dp"/>
|
||||
<corners android:radius="20dp"/>
|
||||
</shape>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
<!-- Gradient vibrant pour la sélection -->
|
||||
<gradient
|
||||
android:startColor="#4CAF50"
|
||||
android:endColor="#81C784"
|
||||
android:startColor="#13691e"
|
||||
android:endColor="#224a27"
|
||||
android:angle="45"/>
|
||||
|
||||
<corners android:radius="16dp"/>
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp"
|
||||
android:background="@color/text_hint_color"
|
||||
>
|
||||
android:background="@color/text_hint_color">
|
||||
|
||||
<!-- Header -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
>
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
@@ -22,35 +20,35 @@
|
||||
android:fontFamily="@string/LItem"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="@string/bet_type_title"
|
||||
android:textFontWeight="400"
|
||||
android:textColor="@color/primary_green"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<!-- Les options statiques -->
|
||||
<!-- RecyclerView avec weight pour prendre tout l'espace restant -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_marginVertical="30dp"
|
||||
android:id="@+id/typeOfBetRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:paddingVertical="10dp"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
<!-- Bouton toujours en bas -->
|
||||
<Button
|
||||
android:id="@+id/btnValidate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="2dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:background="@drawable/rounded_button_green"
|
||||
android:textAllCaps="false"
|
||||
android:text="@string/validate"
|
||||
>
|
||||
android:text="@string/validate" />
|
||||
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="2dp"
|
||||
xmlns:app="http://schemas.android.com/tools"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
card_view:cardCornerRadius="16dp"
|
||||
card_view:cardElevation="6dp"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
app:ignore="NamespaceTypo">
|
||||
android:layout_marginVertical="3dp"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
card_view:cardCornerRadius="20dp"
|
||||
card_view:cardElevation="8dp"
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/item_gradient_bg">
|
||||
android:clipToPadding="false">
|
||||
|
||||
<!-- Icône ou cercle coloré -->
|
||||
<!-- Cercle coloré / icône -->
|
||||
<View
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/circle_primary"/>
|
||||
android:background="@drawable/circle_primary" />
|
||||
|
||||
<!-- Texte principal -->
|
||||
<TextView
|
||||
@@ -38,15 +34,14 @@
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="Type de pari"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"/>
|
||||
android:singleLine="true" />
|
||||
|
||||
<!-- Flèche / icône à droite -->
|
||||
<!-- Flèche / icône -->
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
app:tint="@color/white"
|
||||
/>
|
||||
android:src="@drawable/ic_right_arrow"
|
||||
card_view:tint="@android:color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
Reference in New Issue
Block a user