diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..9661ac7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index ee5896a..7e40091 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -38,6 +38,9 @@ android {
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
+ implementation("com.squareup.retrofit2:converter-gson:2.11.0")
+ implementation("com.squareup.retrofit2:retrofit:2.11.0")
implementation(libs.hilt.android)
annotationProcessor(libs.hilt.compiler)
implementation(libs.rxjava)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 48bca8e..8e54420 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,10 +2,35 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
selectedHorses = new ArrayList();
@@ -83,7 +91,7 @@ public class BetValidation extends Fragment {
}
private void setupNumberGrid(GridLayout grid) {
-
+ binding.gridNumbers.removeAllViews();
int columns = 4;
grid.setColumnCount(columns);
@@ -133,28 +141,92 @@ public class BetValidation extends Fragment {
super.onViewCreated(view, savedInstanceState);
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
viewModel = new ViewModelProvider(this).get(BetViewModel.class);
- shared.betId.observe(getViewLifecycleOwner(), id ->{
- this.id = id;
- viewModel.getBetNameById(id - 1);
- viewModel.betName.observe(getViewLifecycleOwner(), name ->{
- binding.horseName.setText(name);
- });
- viewModel.loadHorses(id - 1);
- viewModel.horses.observe(getViewLifecycleOwner(), h->{
- this.totalHorses = h;
- setupNumberGrid(binding.gridNumbers);
- });
+ viewModel.getBetNameById(shared.betId.getValue() - 1);
+ viewModel.betName.observe(getViewLifecycleOwner(), name ->{
+ binding.horseName.setText(name);
+ });
+ viewModel.loadHorses(shared.betId.getValue() - 1);
+ viewModel.horses.observe(getViewLifecycleOwner(), h->{
+ this.totalHorses = h;
+ setupNumberGrid(binding.gridNumbers);
});
shared.typeOfBet.observe(getViewLifecycleOwner(), type ->{
this.typeOfBet = type;
});
- binding.btnValidate.setOnClickListener(v->{
- //Toast.makeText(getContext(), "L'id de bet: "+this.id+" et le type est: "+this.typeOfBet, Toast.LENGTH_SHORT).show();
- printer = new HPRTPrinterUtil(getContext());
- boolean ok = printer.connectBluetooth("02:03:00:00:00:00");
- if (ok) {
- printer.printText("Bonjour");
+ viewModel.loadReunionById(shared.betId.getValue() - 1);
+ reunion = viewModel.reunion.getValue();
+ binding.paymentType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int position, long id) {
+ String selected = binding.paymentType.getSelectedItem().toString();
+
+ if (selected.equals("Orange Money")) {
+ binding.phoneNumber.setVisibility(View.VISIBLE);
+ } else {
+ binding.phoneNumber.setVisibility(View.GONE); // ou GONE
+ binding.phoneNumber.setText(""); // vider le champ si non utilisé
+ }
}
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+ binding.phoneNumber.setVisibility(View.INVISIBLE);
+ }
+ });
+
+
+ binding.betValidateBtn.setOnClickListener(v->{
+ if(binding.paymentType.getSelectedItem().toString().equals("Orange Money") && binding.phoneNumber.getText().toString().isEmpty()){
+ Toast.makeText(getContext(), "Veuillez entrer un numéro de téléphone", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ Integer required = Integer.parseInt(typeOfBet.getNumberOfHorse());
+ if(required == null){
+ Toast.makeText(getContext(), "Erreur de type de pari", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ if(selectedHorses.size() != required){
+ Toast.makeText(getContext(), "Veuillez sélectionner "+required+" chevaux", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ printer = new HPRTPrinterUtil(getContext());
+ boolean ok = printer.autoConnectBluetoothByName();
+ if(ok){
+ StringBuilder tspl = new StringBuilder();
+ tspl.append("PARIS HIPPIQUE (PMU MALI)\n");
+
+ tspl.append(typeOfBet.getName()+"\n");
+ tspl.append("Tel: 555-1234\n");
+ tspl.append("----------------------------\n");
+ tspl.append(reunion.getName()+"/"+reunion.getAddress());
+ tspl.append("----------------------------\n");
+ String combinationText = selectedHorses.stream()
+ .map(h -> String.valueOf(h.getNumber()))
+ .collect(Collectors.joining("-"));
+
+ tspl.append("COMBINAISON : "+combinationText);
+
+ tspl.append("\n----------------------------\n");
+
+ int mise = 300;
+ int total = mise * selectedHorses.size();
+ tspl.append("TOTAL MISE: ").append(total).append(" Fcfa\n");
+ tspl.append("----------------------------\n");
+ tspl.append("Bonne chance !\n\n\n");
+
+ printer.printText(tspl);
+ }
+
+ });
+
+ binding.backBtn.setOnClickListener(v->{
+ getActivity().onBackPressed();
+ });
+
+ binding.deleteBtn.setOnClickListener(v->{
+ selectedHorses.clear();
+ binding.combination.setText(getString(R.string.combination,""));
+ setupNumberGrid(binding.gridNumbers);
});
}
diff --git a/app/src/main/java/com/example/quiz/ListOfTypeOfBets.java b/app/src/main/java/com/example/quiz/ListOfTypeOfBets.java
index 83c5fe4..e376703 100644
--- a/app/src/main/java/com/example/quiz/ListOfTypeOfBets.java
+++ b/app/src/main/java/com/example/quiz/ListOfTypeOfBets.java
@@ -6,19 +6,30 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
+import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.animation.AnimationUtils;
+import android.view.animation.LayoutAnimationController;
+import android.widget.Adapter;
import android.widget.Button;
+import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
+import com.example.quiz.data.adapter.TypeOfBetAdapter;
import com.example.quiz.databinding.FragmentListOfTypeOfBetsBinding;
+import com.example.quiz.viewModel.BetViewModel;
import com.example.quiz.viewModel.SharedViewModel;
+import java.util.ArrayList;
+
import dagger.hilt.android.AndroidEntryPoint;
/**
@@ -34,6 +45,10 @@ public class ListOfTypeOfBets extends Fragment {
private SharedViewModel shared;
+ private BetViewModel viewModel;
+
+ private TypeOfBetAdapter adapter;
+
public ListOfTypeOfBets() {
// Required empty public constructor
}
@@ -58,20 +73,33 @@ public class ListOfTypeOfBets extends Fragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
+ LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(
+ getContext(),
+ R.anim.layout_fad_in
+ );
+ binding.typeOfBetRecyclerView.setLayoutAnimation(controller);
+ binding.typeOfBetRecyclerView.scheduleLayoutAnimation();
+ binding.typeOfBetRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+ // ViewModels
+ viewModel = new ViewModelProvider(this).get(BetViewModel.class);
+ shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
- RadioGroup types = binding.optionsGroup;
+ // ⚡ Initialiser l’adapter UNE SEULE FOIS
+ adapter = new TypeOfBetAdapter(new ArrayList<>());
+ adapter.setOnItemClickListener(type -> shared.setTypeOfBet(type));
+ binding.typeOfBetRecyclerView.setAdapter(adapter);
+
+ // Charger les données
+ viewModel.loadTypes(shared.betId.getValue()-1);
+
+ // Observer les résultats
+ viewModel.types.observe(getViewLifecycleOwner(), types -> {
+ if (types != null) {
+ adapter.setTypes(types);
+ }
+ });
Button btnValidate = binding.btnValidate;
btnValidate.setOnClickListener(v->{
- int selectedId = types.getCheckedRadioButtonId();
- if (selectedId == -1) {
- Toast.makeText(requireContext(), "Veuillez sélectionner une option", Toast.LENGTH_SHORT).show();
- return;
- }
- RadioButton selectedButton = view.findViewById(selectedId);
- String selectedType = selectedButton.getText().toString();
- shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
- shared.setTypeOfBet(selectedType);
FragmentManager fragmentManager = getParentFragmentManager();
BetValidation betValidation = BetValidation.newInstance();
fragmentManager.beginTransaction()
diff --git a/app/src/main/java/com/example/quiz/MainActivity.java b/app/src/main/java/com/example/quiz/MainActivity.java
deleted file mode 100644
index e69de29..0000000
diff --git a/app/src/main/java/com/example/quiz/data/BetsBank.java b/app/src/main/java/com/example/quiz/data/BetsBank.java
index 9b035bb..b9c223d 100644
--- a/app/src/main/java/com/example/quiz/data/BetsBank.java
+++ b/app/src/main/java/com/example/quiz/data/BetsBank.java
@@ -2,6 +2,8 @@ package com.example.quiz.data;
import com.example.quiz.data.model.Bet;
import com.example.quiz.data.model.Horse;
+import com.example.quiz.data.model.Reunion;
+import com.example.quiz.data.model.TypeOfBet;
import java.time.LocalDate;
import java.util.Arrays;
@@ -13,6 +15,16 @@ public class BetsBank {
new Bet(
1,
"Course de chevaux",
+ new Reunion(1,
+ "Réunion ",
+ LocalDate.of(2025,10,1),
+ "Hippodrome Verssaille"
+ ),
+ Arrays.asList(
+ new TypeOfBet(1, "Couplet", "2"),
+ new TypeOfBet(2, "Tierce", "3"),
+ new TypeOfBet(3, "Place", "1")
+ ),
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(1),
@@ -21,20 +33,45 @@ public class BetsBank {
new Horse(4)
)
),
+
new Bet(
2,
"Course de chevaux 2",
+ new Reunion(2,
+ "Réunion 2",
+ LocalDate.of(2025,10,1),
+ "Hippodrome Bordeaux"
+ ),
+ Arrays.asList(
+ new TypeOfBet(1, "Quarte", "4"),
+ new TypeOfBet(2, "Quinte", "5"),
+ new TypeOfBet(3, "Placé", "1")
+ ),
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(4),
new Horse(5),
new Horse(7),
- new Horse(6)
+ new Horse(6),
+ new Horse(8),
+ new Horse(9),
+ new Horse(10),
+ new Horse(11)
)
),
new Bet(
3,
"Course de chevaux 3",
+ new Reunion(2,
+ "Réunion 2",
+ LocalDate.of(2025,10,1),
+ "Hippodrome Bordeaux"
+ ),
+ Arrays.asList(
+ new TypeOfBet(1, "Quarte", "4"),
+ new TypeOfBet(2, "Quinte", "5"),
+ new TypeOfBet(3, "Placé", "1")
+ ),
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(10),
@@ -46,6 +83,16 @@ public class BetsBank {
new Bet(
4,
"Course de chevaux 4",
+ new Reunion(2,
+ "Réunion 2",
+ LocalDate.of(2025,10,1),
+ "Hippodrome Bordeaux"
+ ),
+ Arrays.asList(
+ new TypeOfBet(1, "Couple", "2"),
+ new TypeOfBet(2, "Tierce", "3"),
+ new TypeOfBet(3, "Quarte", "4")
+ ),
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(5),
diff --git a/app/src/main/java/com/example/quiz/data/adapter/TypeOfBetAdapter.java b/app/src/main/java/com/example/quiz/data/adapter/TypeOfBetAdapter.java
new file mode 100644
index 0000000..f9106f4
--- /dev/null
+++ b/app/src/main/java/com/example/quiz/data/adapter/TypeOfBetAdapter.java
@@ -0,0 +1,80 @@
+package com.example.quiz.data.adapter;
+
+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.quiz.R;
+import com.example.quiz.data.model.TypeOfBet;
+
+import java.util.List;
+
+public class TypeOfBetAdapter extends RecyclerView.Adapter {
+ private List types;
+ private onItemClickListener listener;
+
+ private int selectedPosition = -1;
+
+ public interface onItemClickListener{
+ void onItemClick(TypeOfBet type);
+ }
+
+ public void setOnItemClickListener(TypeOfBetAdapter.onItemClickListener listener){
+ this.listener = listener;
+ }
+
+ public TypeOfBetAdapter(List types){
+ this.types = types;
+ }
+
+ public void setTypes(List types){
+ this.types = types;
+ notifyDataSetChanged();
+ }
+
+ @NonNull
+ @Override
+ public TypeOfBetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.type_of_bet_item, parent, false);
+ return new TypeOfBetViewHolder(view);
+ }
+
+
+ @Override
+ public void onBindViewHolder(@NonNull TypeOfBetViewHolder holder, int position) {
+ TypeOfBet type = types.get(position);
+ holder.type_of_bet_name.setText(type.getName());
+ if(selectedPosition != position){
+ holder.itemView.setBackgroundResource(R.drawable.item_gradient_bg);
+ }else{
+ holder.itemView.setBackgroundResource(R.drawable.item_gradient_bg_selected);
+ }
+ holder.itemView.setOnClickListener(v->{
+ if(listener != null){
+ listener.onItemClick(type);
+ }
+ int previousPosition = selectedPosition;
+ selectedPosition = holder.getAdapterPosition();
+ notifyItemChanged(previousPosition);
+ notifyItemChanged(selectedPosition);
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return types.size();
+ }
+
+ public class TypeOfBetViewHolder extends RecyclerView.ViewHolder {
+ TextView type_of_bet_name;
+
+ public TypeOfBetViewHolder(@NonNull View itemView) {
+ super(itemView);
+ type_of_bet_name = itemView.findViewById(R.id.type_of_bet_name);
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/quiz/data/model/Bet.java b/app/src/main/java/com/example/quiz/data/model/Bet.java
index 7fedfd4..d3084c2 100644
--- a/app/src/main/java/com/example/quiz/data/model/Bet.java
+++ b/app/src/main/java/com/example/quiz/data/model/Bet.java
@@ -8,8 +8,28 @@ public class Bet {
private String name;
private LocalDate date;
+ private Reunion reunion;
+
+ List types;
+
private List horses;
+ public Reunion getReunion() {
+ return reunion;
+ }
+
+ public void setReunion(Reunion reunion) {
+ this.reunion = reunion;
+ }
+
+ public List getTypes() {
+ return types;
+ }
+
+ public void setTypes(List types) {
+ this.types = types;
+ }
+
public List getHorses() {
return horses;
}
@@ -43,9 +63,11 @@ public class Bet {
}
- public Bet(int id, String name, LocalDate date, List horses) {
+ public Bet(int id, String name, Reunion reunion, List types, LocalDate date, List horses) {
this.id = id;
this.name = name;
+ this.reunion = reunion;
+ this.types = types;
this.date = date;
this.horses = horses;
}
diff --git a/app/src/main/java/com/example/quiz/data/model/Reunion.java b/app/src/main/java/com/example/quiz/data/model/Reunion.java
new file mode 100644
index 0000000..31494fe
--- /dev/null
+++ b/app/src/main/java/com/example/quiz/data/model/Reunion.java
@@ -0,0 +1,50 @@
+package com.example.quiz.data.model;
+
+import java.time.LocalDate;
+
+public class Reunion {
+ private int id;
+ private String name;
+
+ private LocalDate date;
+ private String address;
+
+ public Reunion(int id, String name,LocalDate date, String address) {
+ this.id = id;
+ this.name = name;
+ this.date = date;
+ this.address = address;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public LocalDate getDate() {
+ return date;
+ }
+
+ public void setDate(LocalDate date) {
+ this.date = date;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+}
diff --git a/app/src/main/java/com/example/quiz/data/model/TypeOfBet.java b/app/src/main/java/com/example/quiz/data/model/TypeOfBet.java
new file mode 100644
index 0000000..f11794e
--- /dev/null
+++ b/app/src/main/java/com/example/quiz/data/model/TypeOfBet.java
@@ -0,0 +1,37 @@
+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;
+ this.name = name;
+ this.numberOfHorse = numberOfHorse;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getNumberOfHorse() {
+ return numberOfHorse;
+ }
+
+ public void setNumberOfHorse(String numberOfHorse) {
+ this.numberOfHorse = numberOfHorse;
+ }
+}
diff --git a/app/src/main/java/com/example/quiz/data/repository/BetRepository.java b/app/src/main/java/com/example/quiz/data/repository/BetRepository.java
index 1492a7e..7300cbb 100644
--- a/app/src/main/java/com/example/quiz/data/repository/BetRepository.java
+++ b/app/src/main/java/com/example/quiz/data/repository/BetRepository.java
@@ -3,6 +3,8 @@ package com.example.quiz.data.repository;
import com.example.quiz.data.BetsBank;
import com.example.quiz.data.model.Bet;
import com.example.quiz.data.model.Horse;
+import com.example.quiz.data.model.Reunion;
+import com.example.quiz.data.model.TypeOfBet;
import java.util.List;
@@ -43,4 +45,11 @@ public class BetRepository {
return getBetById(id).getName();
}
+ public List getTypeOfBetByBetId(int id){
+ return getBetById(id).getTypes();
+ }
+
+ public Reunion getReunionByHorseId(int id){
+ return getBetById(id).getReunion();
+ }
}
diff --git a/app/src/main/java/com/example/quiz/utils/HPRTPrinterUtil.java b/app/src/main/java/com/example/quiz/utils/HPRTPrinterUtil.java
index b5f3624..2a18cf0 100644
--- a/app/src/main/java/com/example/quiz/utils/HPRTPrinterUtil.java
+++ b/app/src/main/java/com/example/quiz/utils/HPRTPrinterUtil.java
@@ -1,9 +1,17 @@
package com.example.quiz.utils;
+import android.annotation.SuppressLint;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.util.Log;
import android.widget.Toast;
+import java.io.InputStream;
+import java.util.Set;
+
import tspl.HPRTPrinterHelper;
public class HPRTPrinterUtil {
@@ -11,15 +19,55 @@ public class HPRTPrinterUtil {
private static final String TAG = "HPRTPrinterUtil";
private Context context;
+ BluetoothAdapter mBluetoothAdapter;
+
public HPRTPrinterUtil(Context context) {
this.context = context;
}
- /**
- * Connecte une imprimante Bluetooth
- * @param btAddress adresse MAC Bluetooth de l'imprimante
- * @return true si connecté, false sinon
- */
+
+
+ @SuppressLint("MissingPermission")
+ public boolean autoConnectBluetoothByName() {
+ try {
+ BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled()) {
+ Toast.makeText(context, "Bluetooth désactivé ou non disponible", Toast.LENGTH_LONG).show();
+ return false;
+ }
+
+ Set pairedDevices = bluetoothAdapter.getBondedDevices();
+ if (pairedDevices != null) {
+ for (BluetoothDevice device : pairedDevices) {
+ if (device.getName() != null && device.getName().contains("MP4P Printer")) {
+ String btAddress = device.getAddress();
+
+ // Connexion via ton SDK HPRT
+ int result = HPRTPrinterHelper.PortOpen("Bluetooth," + btAddress);
+ if (result == 0) {
+ Toast.makeText(context, "Imprimante connectée : " + device.getName(), Toast.LENGTH_SHORT).show();
+ Log.d(TAG, "Connexion réussie : " + device.getName() + " - " + btAddress);
+ return true;
+ } else {
+ Toast.makeText(context, "Erreur connexion imprimante: " + result, Toast.LENGTH_SHORT).show();
+ Log.e(TAG, "Erreur connexion imprimante: " + result);
+ return false;
+ }
+ }
+ }
+ }
+
+ Toast.makeText(context, "Imprimante non trouvée. Veuillez appairer d'abord.", Toast.LENGTH_LONG).show();
+ return false;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Toast.makeText(context, "Erreur auto-connexion : " + e.getMessage(), Toast.LENGTH_LONG).show();
+ return false;
+ }
+ }
+
+
public boolean connectBluetooth(String btAddress) {
try {
HPRTPrinterHelper.PortClose(); // ferme toute connexion existante
@@ -39,7 +87,7 @@ public class HPRTPrinterUtil {
}
}
- public void printText(String text) {
+ public void printText(StringBuilder text) {
try {
if (!HPRTPrinterHelper.IsOpened()) {
Toast.makeText(context, "Imprimante non connectée", Toast.LENGTH_SHORT).show();
diff --git a/app/src/main/java/com/example/quiz/viewModel/BetViewModel.java b/app/src/main/java/com/example/quiz/viewModel/BetViewModel.java
index acc86fe..6369da9 100644
--- a/app/src/main/java/com/example/quiz/viewModel/BetViewModel.java
+++ b/app/src/main/java/com/example/quiz/viewModel/BetViewModel.java
@@ -5,6 +5,8 @@ import androidx.lifecycle.ViewModel;
import com.example.quiz.data.model.Bet;
import com.example.quiz.data.model.Horse;
+import com.example.quiz.data.model.Reunion;
+import com.example.quiz.data.model.TypeOfBet;
import com.example.quiz.data.repository.BetRepository;
import java.util.List;
@@ -24,6 +26,10 @@ public class BetViewModel extends ViewModel {
public MutableLiveData> horses = new MutableLiveData<>();
+ public MutableLiveData> types = new MutableLiveData<>();
+
+ public MutableLiveData reunion = new MutableLiveData();
+
@Inject
@@ -43,4 +49,13 @@ public class BetViewModel extends ViewModel {
betName.setValue(betRepository.getBetNameById(id));
}
+ public void loadTypes(int id){
+ types.setValue(betRepository.getBetById(id).getTypes());
+ }
+
+
+ public void loadReunionById(int id){
+ reunion.setValue(betRepository.getReunionByHorseId(id));
+ }
+
}
diff --git a/app/src/main/java/com/example/quiz/viewModel/SharedViewModel.java b/app/src/main/java/com/example/quiz/viewModel/SharedViewModel.java
index 4db3b73..1e57ee6 100644
--- a/app/src/main/java/com/example/quiz/viewModel/SharedViewModel.java
+++ b/app/src/main/java/com/example/quiz/viewModel/SharedViewModel.java
@@ -3,6 +3,8 @@ package com.example.quiz.viewModel;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
+import com.example.quiz.data.model.TypeOfBet;
+
import javax.inject.Inject;
import dagger.hilt.android.lifecycle.HiltViewModel;
@@ -11,12 +13,12 @@ import dagger.hilt.android.lifecycle.HiltViewModel;
public class SharedViewModel extends ViewModel {
public MutableLiveData betId = new MutableLiveData();
- public MutableLiveData typeOfBet = new MutableLiveData();
+ public MutableLiveData typeOfBet = new MutableLiveData();
public void setBetId(int id){
betId.setValue(id);
}
- public void setTypeOfBet(String type){
+ public void setTypeOfBet(TypeOfBet type){
typeOfBet.setValue(type);
}
}
diff --git a/app/src/main/res/anim/layout_fall_down.xml b/app/src/main/res/anim/layout_fall_down.xml
new file mode 100644
index 0000000..c3f03c5
--- /dev/null
+++ b/app/src/main/res/anim/layout_fall_down.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/app/src/main/res/drawable/circle_primary.xml b/app/src/main/res/drawable/circle_primary.xml
new file mode 100644
index 0000000..13ad651
--- /dev/null
+++ b/app/src/main/res/drawable/circle_primary.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/app/src/main/res/drawable/item_gradient_bg.xml b/app/src/main/res/drawable/item_gradient_bg.xml
new file mode 100644
index 0000000..ce31cc0
--- /dev/null
+++ b/app/src/main/res/drawable/item_gradient_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/item_gradient_bg_selected.xml b/app/src/main/res/drawable/item_gradient_bg_selected.xml
new file mode 100644
index 0000000..9176411
--- /dev/null
+++ b/app/src/main/res/drawable/item_gradient_bg_selected.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/money_integral_line_svgrepo_com.xml b/app/src/main/res/drawable/money_integral_line_svgrepo_com.xml
new file mode 100644
index 0000000..49041d8
--- /dev/null
+++ b/app/src/main/res/drawable/money_integral_line_svgrepo_com.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/rounded_button.xml b/app/src/main/res/drawable/rounded_button.xml
new file mode 100644
index 0000000..36001bf
--- /dev/null
+++ b/app/src/main/res/drawable/rounded_button.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/type_drawable.xml b/app/src/main/res/drawable/type_drawable.xml
new file mode 100644
index 0000000..5cfff37
--- /dev/null
+++ b/app/src/main/res/drawable/type_drawable.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index 16313e0..0000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_bet_validation.xml b/app/src/main/res/layout/fragment_bet_validation.xml
index 42bc1ef..83bee00 100644
--- a/app/src/main/res/layout/fragment_bet_validation.xml
+++ b/app/src/main/res/layout/fragment_bet_validation.xml
@@ -1,69 +1,158 @@
-
-
-
-
-
-
-
-
-
-
+ android:orientation="vertical"
+ tools:ignore="UselessParent">
+
-
-
+ android:textSize="17sp"
+ android:textColor="@color/primary_green"
+ android:layout_marginTop="15dp"
+ android:layout_marginBottom="25dp"
+ android:textFontWeight="300"
+ >
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_list_of_type_of_bets.xml b/app/src/main/res/layout/fragment_list_of_type_of_bets.xml
index 4e2ce8e..ded0d3d 100644
--- a/app/src/main/res/layout/fragment_list_of_type_of_bets.xml
+++ b/app/src/main/res/layout/fragment_list_of_type_of_bets.xml
@@ -3,53 +3,52 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:padding="20dp">
+ android:padding="10dp"
+ android:background="@color/text_hint_color"
+ >
-
+ android:orientation="horizontal"
+ android:gravity="center"
+ >
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+ android:textAllCaps="false"
+ android:text="@string/validate"
+ >
+
+
diff --git a/app/src/main/res/layout/type_of_bet_item.xml b/app/src/main/res/layout/type_of_bet_item.xml
new file mode 100644
index 0000000..7d9a1d8
--- /dev/null
+++ b/app/src/main/res/layout/type_of_bet_item.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml
new file mode 100644
index 0000000..dd6c177
--- /dev/null
+++ b/app/src/main/res/values/array.xml
@@ -0,0 +1,7 @@
+
+
+
+ - Espèce
+ - Orange Money
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 08d7125..131a7ba 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -22,6 +22,9 @@
Tierce
Quarte
Quinte
+ Valider
+ Annuler
+ Supprimer
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam in scelerisque sem. Mauris
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index ad2b93c..c023e19 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,14 +1,23 @@
-
+
+
+
+
+
-
\ No newline at end of file
+