create pari
This commit is contained in:
@@ -42,6 +42,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
|
||||||
|
implementation(libs.swiperefreshlayout)
|
||||||
implementation(libs.retrofit)
|
implementation(libs.retrofit)
|
||||||
implementation(libs.okhttp)
|
implementation(libs.okhttp)
|
||||||
implementation(libs.logging.interceptor)
|
implementation(libs.logging.interceptor)
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import android.os.Bundle;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -18,10 +22,17 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.example.quiz.data.model.Course;
|
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.Reunion;
|
||||||
|
import com.example.quiz.data.model.TypeOfBet;
|
||||||
|
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.viewModel.PariViewModel;
|
||||||
import com.example.quiz.viewModel.SharedViewModel;
|
import com.example.quiz.viewModel.SharedViewModel;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -50,9 +61,14 @@ public class BetValidation extends Fragment {
|
|||||||
|
|
||||||
private Course course;
|
private Course course;
|
||||||
|
|
||||||
private List<String> selectedHorses = new ArrayList<String>();
|
private int mise;
|
||||||
|
|
||||||
|
private final MutableLiveData<List<String>> selectedHorses = new MutableLiveData<>(List.of());
|
||||||
|
|
||||||
|
PariViewModel pariViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
boolean order = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -107,22 +123,25 @@ public class BetValidation extends Fragment {
|
|||||||
textView.setGravity(Gravity.CENTER);
|
textView.setGravity(Gravity.CENTER);
|
||||||
textView.setBackgroundResource(R.drawable.number_background);
|
textView.setBackgroundResource(R.drawable.number_background);
|
||||||
textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||||
|
|
||||||
textView.setOnClickListener(v -> {
|
textView.setOnClickListener(v -> {
|
||||||
if (selectedHorses.contains(horse)) {
|
final List<String> horses = new ArrayList<>(selectedHorses.getValue());
|
||||||
selectedHorses.remove(horse);
|
if (horses.contains(horse)) {
|
||||||
v.setSelected(false);
|
horses.remove(horse);
|
||||||
v.setBackgroundResource(R.drawable.number_background);
|
selectedHorses.setValue(horses);
|
||||||
} else {
|
v.setSelected(false);
|
||||||
selectedHorses.add(horse);
|
v.setBackgroundResource(R.drawable.number_background);
|
||||||
v.setSelected(true);
|
} else {
|
||||||
v.setBackgroundResource(R.drawable.number_selected_background);
|
horses.add(horse);
|
||||||
}
|
selectedHorses.setValue(horses);
|
||||||
String combinationText = selectedHorses.stream()
|
v.setSelected(true);
|
||||||
.map(h -> h)
|
v.setBackgroundResource(R.drawable.number_selected_background);
|
||||||
.collect(Collectors.joining("-"));
|
}
|
||||||
binding.combination.setText(getString(R.string.combination, combinationText));
|
String combinationText = selectedHorses.getValue().stream()
|
||||||
});
|
.map(h -> h)
|
||||||
|
.collect(Collectors.joining("-"));
|
||||||
|
binding.combination.setText(getString(R.string.combination, combinationText));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return textView;
|
return textView;
|
||||||
}
|
}
|
||||||
@@ -131,6 +150,7 @@ public class BetValidation extends Fragment {
|
|||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
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);
|
||||||
/*viewModel = new ViewModelProvider(this).get(BetViewModel.class);
|
/*viewModel = new ViewModelProvider(this).get(BetViewModel.class);
|
||||||
viewModel.getBetNameById(shared.betId.getValue() - 1);
|
viewModel.getBetNameById(shared.betId.getValue() - 1);
|
||||||
viewModel.betName.observe(getViewLifecycleOwner(), name ->{
|
viewModel.betName.observe(getViewLifecycleOwner(), name ->{
|
||||||
@@ -161,6 +181,18 @@ public class BetValidation extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
binding.order.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
order = isChecked;
|
||||||
|
calculateMise(selectedHorses.getValue().size(), shared.typeOfBet.getValue());
|
||||||
|
});
|
||||||
|
|
||||||
|
selectedHorses.observe(getViewLifecycleOwner(), new Observer<List<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<String> horses) {
|
||||||
|
calculateMise(horses.size(), shared.typeOfBet.getValue());
|
||||||
|
binding.mise.setText(String.valueOf(mise+" CFA"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
binding.betValidateBtn.setOnClickListener(v->{
|
binding.betValidateBtn.setOnClickListener(v->{
|
||||||
if(binding.paymentType.getSelectedItem().toString().equals("Orange Money") && binding.phoneNumber.getText().toString().isEmpty()){
|
if(binding.paymentType.getSelectedItem().toString().equals("Orange Money") && binding.phoneNumber.getText().toString().isEmpty()){
|
||||||
@@ -193,40 +225,52 @@ public class BetValidation extends Fragment {
|
|||||||
Toast.makeText(getContext(), "Erreur de type de pari", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "Erreur de type de pari", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(selectedHorses.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;
|
||||||
}
|
}
|
||||||
printer = new HPRTPrinterUtil(getContext());
|
|
||||||
boolean ok = printer.autoConnectBluetoothByName();
|
|
||||||
if(ok){
|
|
||||||
StringBuilder tspl = new StringBuilder();
|
|
||||||
tspl.append("PARIS HIPPIQUE (PMU MALI)\n");
|
|
||||||
|
|
||||||
tspl.append(typeOfBet).append("\n");
|
Pari pari = new Pari(
|
||||||
tspl.append("Tel: 555-1234\n");
|
generate12Digits(),
|
||||||
tspl.append("----------------------------\n");
|
shared.typeOfBet.getValue(),
|
||||||
tspl.append(reunion.getNom()).append("/").append(course.getLieu());
|
"QUARTE_PLUS",
|
||||||
tspl.append("----------------------------\n");
|
mise,
|
||||||
String combinationText = selectedHorses.stream()
|
"07/11/2025 05:08:00",
|
||||||
.map(String::valueOf)
|
shared.selectedCourse.getValue().getId(),
|
||||||
.collect(Collectors.joining("-"));
|
"123456789",
|
||||||
|
"John Doe",
|
||||||
tspl.append("COMBINAISON : ").append(combinationText);
|
1,
|
||||||
|
5,
|
||||||
tspl.append("\n----------------------------\n");
|
6,
|
||||||
|
4,
|
||||||
int mise = 300;
|
11,
|
||||||
int total = mise * selectedHorses.size();
|
5,
|
||||||
tspl.append("TOTAL MISE: ").append(total).append(" Fcfa\n");
|
10,
|
||||||
tspl.append("----------------------------\n");
|
order?selectedHorses.getValue().stream().map(Integer::parseInt).collect(Collectors.toList()):List.of(),
|
||||||
tspl.append("Bonne chance !\n\n\n");
|
selectedHorses.getValue().stream().map(Integer::parseInt).collect(Collectors.toList()),
|
||||||
|
order?selectedHorses.getValue().stream().map(Integer::parseInt).collect(Collectors.toList()):List.of(),
|
||||||
printer.printText(tspl);
|
order,
|
||||||
}
|
shared.typeOfBet.getValue(),
|
||||||
selectedHorses = List.of();
|
PariStatut.PERDANT,
|
||||||
binding.combination.setText(getString(R.string.combination,""));
|
false,
|
||||||
setupNumberGrid(binding.gridNumbers);
|
false
|
||||||
|
);
|
||||||
|
pariViewModel.createPari(pari).observe(getViewLifecycleOwner(), new Observer<Result<Pari>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(Result<Pari> pariResult) {
|
||||||
|
switch (pariResult.status){
|
||||||
|
case ERROR:
|
||||||
|
Toast.makeText(getContext(), pariResult.message, Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case LOADING:
|
||||||
|
Toast.makeText(getContext(), "En cours", Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case SUCCESS:
|
||||||
|
printPari();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.backBtn.setOnClickListener(v->{
|
binding.backBtn.setOnClickListener(v->{
|
||||||
@@ -234,12 +278,87 @@ public class BetValidation extends Fragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
binding.deleteBtn.setOnClickListener(v->{
|
binding.deleteBtn.setOnClickListener(v->{
|
||||||
selectedHorses.clear();
|
selectedHorses.setValue(List.of());
|
||||||
binding.combination.setText(getString(R.string.combination,""));
|
binding.combination.setText(getString(R.string.combination,""));
|
||||||
setupNumberGrid(binding.gridNumbers);
|
setupNumberGrid(binding.gridNumbers);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void printPari(){
|
||||||
|
printer = new HPRTPrinterUtil(getContext());
|
||||||
|
boolean ok = printer.autoConnectBluetoothByName();
|
||||||
|
if(ok){
|
||||||
|
StringBuilder tspl = new StringBuilder();
|
||||||
|
tspl.append("PARIS HIPPIQUE (PMU MALI)\n");
|
||||||
|
|
||||||
|
tspl.append(typeOfBet).append("\n");
|
||||||
|
tspl.append("Tel: 555-1234\n");
|
||||||
|
tspl.append("----------------------------\n");
|
||||||
|
tspl.append(reunion.getNom()).append("/").append(course.getLieu());
|
||||||
|
tspl.append("----------------------------\n");
|
||||||
|
String combinationText = selectedHorses.getValue().stream()
|
||||||
|
.map(String::valueOf)
|
||||||
|
.collect(Collectors.joining("-"));
|
||||||
|
|
||||||
|
tspl.append("COMBINAISON : ").append(combinationText);
|
||||||
|
|
||||||
|
tspl.append("\n----------------------------\n");
|
||||||
|
tspl.append("TOTAL MISE: ").append(mise).append(" Fcfa\n");
|
||||||
|
tspl.append("----------------------------\n");
|
||||||
|
tspl.append("Bonne chance !\n\n\n");
|
||||||
|
|
||||||
|
printer.printText(tspl);
|
||||||
|
}
|
||||||
|
selectedHorses.setValue(List.of());
|
||||||
|
binding.combination.setText(getString(R.string.combination,""));
|
||||||
|
setupNumberGrid(binding.gridNumbers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void calculateMise(int nombreChevauxSelectionnes, String typeOfBet){
|
||||||
|
if(typeOfBet.toString().toLowerCase().contains("couple")){
|
||||||
|
if(nombreChevauxSelectionnes == 2){
|
||||||
|
mise = 300;
|
||||||
|
}
|
||||||
|
if(nombreChevauxSelectionnes > 2){
|
||||||
|
mise = 300 + (nombreChevauxSelectionnes - 3)*300;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(typeOfBet.toString().toLowerCase().contains("tierce")){
|
||||||
|
if(nombreChevauxSelectionnes == 3){
|
||||||
|
mise = 400;
|
||||||
|
}
|
||||||
|
if(nombreChevauxSelectionnes > 3){
|
||||||
|
mise = 400 + (nombreChevauxSelectionnes - 3)*400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(typeOfBet.toString().toLowerCase().contains("quarte")){
|
||||||
|
if(nombreChevauxSelectionnes == 3){
|
||||||
|
mise = 500;
|
||||||
|
}
|
||||||
|
if(nombreChevauxSelectionnes > 3){
|
||||||
|
mise = 500 + (nombreChevauxSelectionnes - 3)*500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(typeOfBet.toString().toLowerCase().contains("quinte")){
|
||||||
|
if(nombreChevauxSelectionnes == 3){
|
||||||
|
mise = 1000;
|
||||||
|
}
|
||||||
|
if(nombreChevauxSelectionnes > 3){
|
||||||
|
mise = 1000 + (nombreChevauxSelectionnes - 3)*1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generate12Digits() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
int digit = (int) (Math.random() * 10); // 0 à 9
|
||||||
|
sb.append(digit);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
|||||||
@@ -6,14 +6,20 @@ 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.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.view.MenuHost;
|
||||||
|
import androidx.core.view.MenuProvider;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.lifecycle.Lifecycle;
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -130,5 +136,37 @@ public class ListOFBets extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
MenuHost menuHost = requireActivity();
|
||||||
|
|
||||||
|
// 🔹 On enlève d'abord les anciens menu providers si ce fragment est recréé
|
||||||
|
menuHost.invalidateMenu();
|
||||||
|
|
||||||
|
// 🔹 Ajout du menu spécifique à ce fragment
|
||||||
|
menuHost.addMenuProvider(new MenuProvider() {
|
||||||
|
@Override
|
||||||
|
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
|
||||||
|
// Nettoyer avant d'inflater
|
||||||
|
menu.clear();
|
||||||
|
menuInflater.inflate(R.menu.menu_main, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
|
||||||
|
int id = menuItem.getItemId();
|
||||||
|
|
||||||
|
if (id == R.id.action_sold) {
|
||||||
|
FragmentManager fragmentManager = getParentFragmentManager();
|
||||||
|
Sold sold = Sold.newInstance();
|
||||||
|
|
||||||
|
fragmentManager.beginTransaction()
|
||||||
|
.replace(R.id.nav_host_fragment_content_main, sold)
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, getViewLifecycleOwner(), Lifecycle.State.RESUMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@ 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.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.view.MenuHost;
|
||||||
|
import androidx.core.view.MenuProvider;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
@@ -13,6 +15,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -73,6 +78,10 @@ public class ListOfReunions extends Fragment {
|
|||||||
binding.reunionsList.setAdapter(adapter);
|
binding.reunionsList.setAdapter(adapter);
|
||||||
reunionViewModel = new ViewModelProvider(this).get(ReunionViewModel.class);
|
reunionViewModel = new ViewModelProvider(this).get(ReunionViewModel.class);
|
||||||
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
binding.reunionsLayout.setOnRefreshListener(()->{
|
||||||
|
observeReunions();
|
||||||
|
binding.reunionsLayout.setRefreshing(false);
|
||||||
|
});
|
||||||
observeReunions();
|
observeReunions();
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|||||||
105
app/src/main/java/com/example/quiz/Sold.java
Normal file
105
app/src/main/java/com/example/quiz/Sold.java
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
package com.example.quiz;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.quiz.databinding.FragmentSoldBinding;
|
||||||
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Use the {@link Sold#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class Sold extends Fragment {
|
||||||
|
|
||||||
|
FragmentSoldBinding binding;
|
||||||
|
|
||||||
|
public Sold() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static Sold newInstance() {
|
||||||
|
Sold fragment = new Sold();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||||
|
if(activity != null){
|
||||||
|
MaterialToolbar toolbar = activity.findViewById(R.id.toolbar);
|
||||||
|
activity.setSupportActionBar(toolbar);
|
||||||
|
if(activity.getSupportActionBar() != null){
|
||||||
|
activity.getSupportActionBar().setTitle("Soldes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
binding = FragmentSoldBinding.inflate(inflater, container, false);
|
||||||
|
return binding.getRoot();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
binding.btnByCourse.setOnClickListener(v -> {
|
||||||
|
FragmentManager fragmentManager = getParentFragmentManager();
|
||||||
|
SoldByCourse soldByCourse = SoldByCourse.newInstance();
|
||||||
|
fragmentManager.beginTransaction()
|
||||||
|
.replace(R.id.nav_host_fragment_content_main, soldByCourse)
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit();
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.btnByDay.setOnClickListener(v->{
|
||||||
|
_showCalendar();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showCalendar(){
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
|
||||||
|
DatePickerDialog datePickerDialog = new DatePickerDialog(
|
||||||
|
getContext(),
|
||||||
|
(view, year, month, dayOfMonth) -> {
|
||||||
|
String date = dayOfMonth + "/" + (month + 1) + "/" + year;
|
||||||
|
//Toast.makeText(getContext(), date, Toast.LENGTH_SHORT).show();
|
||||||
|
new AlertDialog.Builder(getContext())
|
||||||
|
.setTitle("Solde")
|
||||||
|
.setMessage("Solde la course 3000CFA")
|
||||||
|
.setPositiveButton("Ok", (dialog, which)->{
|
||||||
|
dialog.dismiss();
|
||||||
|
}).show();
|
||||||
|
},
|
||||||
|
calendar.get(Calendar.YEAR),
|
||||||
|
calendar.get(Calendar.MONTH),
|
||||||
|
calendar.get(Calendar.DAY_OF_MONTH)
|
||||||
|
);
|
||||||
|
|
||||||
|
datePickerDialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
70
app/src/main/java/com/example/quiz/SoldByCourse.java
Normal file
70
app/src/main/java/com/example/quiz/SoldByCourse.java
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
package com.example.quiz;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.example.quiz.databinding.FragmentSoldByCourseBinding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Use the {@link SoldByCourse#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class SoldByCourse extends Fragment {
|
||||||
|
|
||||||
|
FragmentSoldByCourseBinding binding;
|
||||||
|
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
|
||||||
|
public static SoldByCourse newInstance() {
|
||||||
|
SoldByCourse fragment = new SoldByCourse();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
binding = FragmentSoldByCourseBinding.inflate(inflater, container, false);
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
binding.btnCheckBalance.setOnClickListener(v -> {
|
||||||
|
if(binding.etRaceNumber.getText().toString().isEmpty()){
|
||||||
|
binding.etRaceNumber.setError("Veuillez entrer un numéro de course");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
new AlertDialog.Builder(getContext())
|
||||||
|
.setTitle("Solde")
|
||||||
|
.setMessage("Solde la course 3000CFA")
|
||||||
|
.setPositiveButton("Ok", (dialog, which) -> {
|
||||||
|
binding.etRaceNumber.setText("");
|
||||||
|
dialog.dismiss();
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
266
app/src/main/java/com/example/quiz/data/model/Pari.java
Normal file
266
app/src/main/java/com/example/quiz/data/model/Pari.java
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
package com.example.quiz.data.model;
|
||||||
|
|
||||||
|
import com.example.quiz.data.model.enums.CourseType;
|
||||||
|
import com.example.quiz.data.model.enums.PariStatut;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Pari {
|
||||||
|
private String numeroTicket;
|
||||||
|
private String typePari;
|
||||||
|
private String typeFormule;
|
||||||
|
private int 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;
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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.chevauxSelectionnes = chevauxSelectionnes;
|
||||||
|
this.ordrePredit = ordrePredit;
|
||||||
|
this.validationOrdreExact = validationOrdreExact;
|
||||||
|
this.typeMulti = typeMulti;
|
||||||
|
this.status = status;
|
||||||
|
this.estPaye = estPaye;
|
||||||
|
this.estRembourse = estRembourse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumeroTicket() {
|
||||||
|
return numeroTicket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumeroTicket(String numeroTicket) {
|
||||||
|
this.numeroTicket = numeroTicket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypePari() {
|
||||||
|
return typePari;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypePari(String typePari) {
|
||||||
|
this.typePari = typePari;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeFormule() {
|
||||||
|
return typeFormule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeFormule(String typeFormule) {
|
||||||
|
this.typeFormule = typeFormule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMise() {
|
||||||
|
return mise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMise(int mise) {
|
||||||
|
this.mise = mise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatePari() {
|
||||||
|
return datePari;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatePari(String datePari) {
|
||||||
|
this.datePari = datePari;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCourseId() {
|
||||||
|
return courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseId(int courseId) {
|
||||||
|
this.courseId = courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdParieur() {
|
||||||
|
return idParieur;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdParieur(String idParieur) {
|
||||||
|
this.idParieur = idParieur;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNomParieur() {
|
||||||
|
return nomParieur;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNomParieur(String nomParieur) {
|
||||||
|
this.nomParieur = nomParieur;
|
||||||
|
}
|
||||||
|
|
||||||
|
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() {
|
||||||
|
return chevauxSelectionnes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChevauxSelectionnes(List<Integer> chevauxSelectionnes) {
|
||||||
|
this.chevauxSelectionnes = chevauxSelectionnes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getOrdrePredit() {
|
||||||
|
return ordrePredit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrdrePredit(List<Integer> ordrePredit) {
|
||||||
|
this.ordrePredit = ordrePredit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValidationOrdreExact() {
|
||||||
|
return validationOrdreExact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidationOrdreExact(boolean validationOrdreExact) {
|
||||||
|
this.validationOrdreExact = validationOrdreExact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeMulti() {
|
||||||
|
return typeMulti;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.example.quiz.data.model.enums;
|
||||||
|
|
||||||
|
public enum PariStatut {
|
||||||
|
EN_ATTENTE,
|
||||||
|
PERDANT,
|
||||||
|
VALIDEE
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.example.quiz.data.remote;
|
package com.example.quiz.data.remote;
|
||||||
|
|
||||||
import com.example.quiz.data.model.Course;
|
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.Reunion;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.Body;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
|
||||||
public interface ApiService {
|
public interface ApiService {
|
||||||
@GET("reunions")
|
@GET("reunions")
|
||||||
@@ -14,4 +17,7 @@ public interface ApiService {
|
|||||||
|
|
||||||
@GET("course/avenir")
|
@GET("course/avenir")
|
||||||
Call<List<Course>> getCourses();
|
Call<List<Course>> getCourses();
|
||||||
|
|
||||||
|
@POST("/pari")
|
||||||
|
Call<Pari> createPari(@Body Pari pari);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.example.quiz.data.repository;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
|
||||||
|
import com.example.quiz.data.model.Pari;
|
||||||
|
import com.example.quiz.data.remote.ApiService;
|
||||||
|
import com.example.quiz.utils.Result;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
public class PariRepository {
|
||||||
|
private ApiService apiService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PariRepository(ApiService apiService) {
|
||||||
|
this.apiService = apiService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Result<Pari>> createPari(Pari pari) {
|
||||||
|
MutableLiveData<Result<Pari>> pariResponse = new MutableLiveData<Result<Pari>>();
|
||||||
|
pariResponse.setValue(Result.loading());
|
||||||
|
apiService.createPari(pari).enqueue(new Callback<Pari>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<Pari> call, Response<Pari> response) {
|
||||||
|
if(response.isSuccessful()){
|
||||||
|
pariResponse.postValue(Result.success(response.body()));
|
||||||
|
}else {
|
||||||
|
pariResponse.postValue(Result.error(response.message()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<Pari> call, Throwable throwable) {
|
||||||
|
pariResponse.postValue(Result.error(throwable.getMessage()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return pariResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.example.quiz.viewModel;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.example.quiz.data.model.Pari;
|
||||||
|
import com.example.quiz.data.repository.PariRepository;
|
||||||
|
import com.example.quiz.utils.Result;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
public class PariViewModel extends ViewModel {
|
||||||
|
private final PariRepository pariRepository;
|
||||||
|
private LiveData<Result<Pari>> pari;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PariViewModel(PariRepository repository){
|
||||||
|
this.pariRepository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Result<Pari>> createPari(Pari pari){
|
||||||
|
if(this.pari == null){
|
||||||
|
this.pari = pariRepository.createPari(pari);
|
||||||
|
}
|
||||||
|
return this.pari;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
app/src/main/res/drawable/bg_button_fantasy.xml
Normal file
16
app/src/main/res/drawable/bg_button_fantasy.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="#66FFFFFF">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:startColor="@color/red_opacity_10"
|
||||||
|
android:endColor="@color/green_opacity_30"
|
||||||
|
android:angle="90" />
|
||||||
|
<corners android:radius="20dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="1.5dp"
|
||||||
|
android:color="@color/white" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
||||||
13
app/src/main/res/drawable/bg_fantasy_gradient.xml
Normal file
13
app/src/main/res/drawable/bg_fantasy_gradient.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="135"
|
||||||
|
android:startColor="@color/text_color"
|
||||||
|
android:centerColor="@color/primary_green"
|
||||||
|
android:endColor="@color/green_opacity_30"
|
||||||
|
android:type="linear" />
|
||||||
|
|
||||||
|
<corners android:radius="0dp" />
|
||||||
|
</shape>
|
||||||
14
app/src/main/res/drawable/bg_input_fantasy.xml
Normal file
14
app/src/main/res/drawable/bg_input_fantasy.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/green_opacity_30" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="1.5dp"
|
||||||
|
android:color="#9FA8DA" />
|
||||||
|
<padding
|
||||||
|
android:left="12dp"
|
||||||
|
android:right="12dp"
|
||||||
|
android:top="8dp"
|
||||||
|
android:bottom="8dp" />
|
||||||
|
</shape>
|
||||||
10
app/src/main/res/drawable/ic_calendar.xml
Normal file
10
app/src/main/res/drawable/ic_calendar.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="800dp"
|
||||||
|
android:height="800dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M7,1C6.448,1 6,1.448 6,2V3H5C3.343,3 2,4.343 2,6V20C2,21.657 3.343,23 5,23H19C20.657,23 22,21.657 22,20V6C22,4.343 20.657,3 19,3H18V2C18,1.448 17.552,1 17,1C16.448,1 16,1.448 16,2V3H8V2C8,1.448 7.552,1 7,1ZM16,6V5H8V6C8,6.552 7.552,7 7,7C6.448,7 6,6.552 6,6V5H5C4.448,5 4,5.448 4,6V9H20V6C20,5.448 19.552,5 19,5H18V6C18,6.552 17.552,7 17,7C16.448,7 16,6.552 16,6ZM4,15V11H8V15H4ZM4,17V20C4,20.552 4.448,21 5,21H8V17H4ZM10,17V21H14V17H10ZM16,17V21H19C19.552,21 20,20.552 20,20V17H16ZM20,15H16V11H20V15ZM14,15H10V11H14V15Z"
|
||||||
|
android:fillColor="#0F0F0F"
|
||||||
|
android:fillType="evenOdd"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_course.xml
Normal file
9
app/src/main/res/drawable/ic_course.xml
Normal file
File diff suppressed because one or more lines are too long
7
app/src/main/res/drawable/sold_drawable.xml
Normal file
7
app/src/main/res/drawable/sold_drawable.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#4CAF50" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
<stroke android:width="1dp" android:color="#43A047" />
|
||||||
|
</shape>
|
||||||
7
app/src/main/res/drawable/sold_drawable_alt.xml
Normal file
7
app/src/main/res/drawable/sold_drawable_alt.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#2196F3" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
<stroke android:width="1dp" android:color="#1976D2" />
|
||||||
|
</shape>
|
||||||
@@ -76,7 +76,31 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:useDefaultMargins="true"/>
|
android:useDefaultMargins="true"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:padding="12dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/mise"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textColor="@color/primary_green"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="0" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/order"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:text="Ordre" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -4,18 +4,24 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".ListOfReunions">
|
tools:context=".ListOfReunions">
|
||||||
<LinearLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_horizontal"
|
android:id="@+id/reunions_layout"
|
||||||
android:orientation="vertical"
|
>
|
||||||
android:paddingTop="15dp"
|
<LinearLayout
|
||||||
android:paddingHorizontal="20dp"
|
|
||||||
tools:ignore="UselessParent">
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/reunionsList"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
/>
|
android:gravity="center_horizontal"
|
||||||
</LinearLayout>
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingHorizontal="20dp"
|
||||||
|
tools:ignore="UselessParent">
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/reunionsList"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
75
app/src/main/res/layout/fragment_sold.xml
Normal file
75
app/src/main/res/layout/fragment_sold.xml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:background="#F5F5F5"
|
||||||
|
tools:context=".Sold">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center"
|
||||||
|
android:spacing="16dp">
|
||||||
|
|
||||||
|
<!-- Bloc 1 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/btnByCourse"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:background="@drawable/sold_drawable"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:src="@drawable/ic_course"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/by_course"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Bloc 2 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/btnByDay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:background="@drawable/sold_drawable_alt"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:src="@drawable/ic_calendar"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/by_day"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
85
app/src/main/res/layout/fragment_sold_by_course.xml
Normal file
85
app/src/main/res/layout/fragment_sold_by_course.xml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/bg_fantasy_gradient"
|
||||||
|
android:padding="24dp"
|
||||||
|
tools:context=".SoldByCourse">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="top|center_horizontal"
|
||||||
|
android:spacing="24dp">
|
||||||
|
|
||||||
|
<!-- Icône décorative -->
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="96dp"
|
||||||
|
android:src="@drawable/horse_face_svgrepo_com"
|
||||||
|
android:contentDescription="@string/app_name"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:alpha="0.9"
|
||||||
|
app:tint="@android:color/white" />
|
||||||
|
|
||||||
|
<!-- Titre -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Vérifier le solde"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="22sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:letterSpacing="0.05"
|
||||||
|
android:layout_marginBottom="30dp" />
|
||||||
|
|
||||||
|
<!-- Input Fantasy -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:background="@drawable/bg_input_fantasy"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/horse_with_creative_hair_raising_feet_right_side_view_svgrepo_com"
|
||||||
|
android:tint="#C5CAE9"
|
||||||
|
android:layout_marginEnd="8dp" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/etRaceNumber"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:hint="Entrez le numéro de course"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textColorHint="#B0BEC5"
|
||||||
|
android:inputType="number"
|
||||||
|
android:background="@null"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:imeOptions="actionDone" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Bouton Vérifier -->
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnCheckBalance"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:text="🔮 Vérifier le solde"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:background="@drawable/bg_button_fantasy"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:elevation="6dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
4
app/src/main/res/menu/course_menu.xml
Normal file
4
app/src/main/res/menu/course_menu.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
</menu>
|
||||||
@@ -3,8 +3,18 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="com.example.quiz.MainActivity">
|
tools:context="com.example.quiz.MainActivity">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_sold"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="@string/action_settings"
|
android:title="@string/sold"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/last_bets"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/last_bets"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/others"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/others"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">PMU</string>
|
<string name="app_name">PMU</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="sold">Solde</string>
|
||||||
|
<string name="last_bets">Derniers paris</string>
|
||||||
|
<string name="others">Autres</string>
|
||||||
|
<string name="by_course">Solde par course</string>
|
||||||
|
<string name="by_day">Solde par jour</string>
|
||||||
<!-- Strings used for fragments for navigation -->
|
<!-- Strings used for fragments for navigation -->
|
||||||
<string name="first_fragment_label">First Fragment</string>
|
<string name="first_fragment_label">First Fragment</string>
|
||||||
<string name="second_fragment_label">Second Fragment</string>
|
<string name="second_fragment_label">Second Fragment</string>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ rxandroid = "1.2.1"
|
|||||||
rxjava = "1.3.8"
|
rxjava = "1.3.8"
|
||||||
kotlin = "1.9.24"
|
kotlin = "1.9.24"
|
||||||
coreKtx = "1.17.0"
|
coreKtx = "1.17.0"
|
||||||
|
swiperefreshlayout = "1.1.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
|
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
|
||||||
@@ -41,6 +42,7 @@ retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit
|
|||||||
rxandroid = { module = "io.reactivex:rxandroid", version.ref = "rxandroid" }
|
rxandroid = { module = "io.reactivex:rxandroid", version.ref = "rxandroid" }
|
||||||
rxjava = { module = "io.reactivex:rxjava", version.ref = "rxjava" }
|
rxjava = { module = "io.reactivex:rxjava", version.ref = "rxjava" }
|
||||||
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "swiperefreshlayout" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|||||||
Reference in New Issue
Block a user