correction on mise calculation
This commit is contained in:
@@ -159,7 +159,7 @@ public class BetValidation extends Fragment {
|
||||
|
||||
private void setupNumberGrid(GridLayout grid) {
|
||||
binding.gridNumbers.removeAllViews();
|
||||
int columns = 7;
|
||||
int columns = 8;
|
||||
grid.setColumnCount(columns);
|
||||
if(shared.selectedCourse.getValue() != null){
|
||||
for (int i = 1; i <= shared.selectedCourse.getValue().getPartants(); i++) {
|
||||
@@ -238,6 +238,7 @@ public class BetValidation extends Fragment {
|
||||
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
||||
if(activity != null){
|
||||
MaterialToolbar toolbar = activity.findViewById(R.id.toolbar);
|
||||
toolbar.setBackgroundColor( getResources().getColor(R.color.primary_green));
|
||||
activity.setSupportActionBar(toolbar);
|
||||
if(activity.getSupportActionBar() != null){
|
||||
activity.getSupportActionBar().setTitle("Pari "+shared.selectedCourse.getValue().getNom());
|
||||
@@ -268,16 +269,30 @@ public class BetValidation extends Fragment {
|
||||
@Override
|
||||
public void onChanged(List<String> horses) {
|
||||
calculateMise(horses);
|
||||
if(horses.size() > shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
binding.elargie.setVisibility(View.GONE);
|
||||
}
|
||||
if(shared.typeOfBet.getValue().getNumberOfHorse() > 2 && horses.size() >= shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.order.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
binding.order.setVisibility(View.GONE);
|
||||
}
|
||||
if(horses.contains("X")){
|
||||
if(selectedHorses.getValue().size() == shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
binding.elargie.setText("Champ total");
|
||||
return;
|
||||
}else{
|
||||
if(selectedHorses.getValue().size() > shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
binding.elargie.setText("Champ partiel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(horses.size() > shared.typeOfBet.getValue().getNumberOfHorse()){
|
||||
binding.elargie.setVisibility(View.VISIBLE);
|
||||
binding.elargie.setText("Elargi");
|
||||
}else{
|
||||
binding.elargie.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
binding.order.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
@@ -302,6 +317,10 @@ public class BetValidation extends Fragment {
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.mise == 0){
|
||||
Toast.makeText(getContext(), "Pari non valide", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Pari pari = new Pari(
|
||||
@@ -486,6 +505,12 @@ public class BetValidation extends Fragment {
|
||||
}
|
||||
mise = mise * coeff;
|
||||
if(nombreX>0){
|
||||
if(nombreChevauxSelectionnes - typeOfBetHorses == 1){
|
||||
mise = 0;
|
||||
this.mise = mise;
|
||||
binding.mise.setText(mise+" CFA");
|
||||
return;
|
||||
}
|
||||
if(nombreChevauxSelectionnes == typeOfBetHorses){
|
||||
mise = mise * _calculateArrangement((partants - (typeOfBetHorses-nombreX)), nombreX);
|
||||
}else{
|
||||
@@ -498,8 +523,9 @@ public class BetValidation extends Fragment {
|
||||
binding.mise.setText(mise+" CFA");
|
||||
return;
|
||||
}
|
||||
if(!order){
|
||||
mise = mise * _calculateCombinaison(nombreChevauxSelectionnes, typeOfBetHorses);
|
||||
if(order){
|
||||
}else{
|
||||
mise = mise * _calculateArrangement(nombreChevauxSelectionnes, typeOfBetHorses);
|
||||
}
|
||||
this.mise = mise;
|
||||
|
||||
@@ -12,27 +12,27 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray"
|
||||
android:paddingHorizontal="5dp"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:layout_above="@+id/bottom_buttons">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="30dp">
|
||||
android:paddingBottom="10dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_type_of_bet"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="90dp" />
|
||||
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/ic_tierce"
|
||||
/>
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
@@ -73,11 +73,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginVertical="13dp">
|
||||
android:layout_marginVertical="5dp">
|
||||
|
||||
<GridLayout
|
||||
android:id="@+id/grid_numbers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:useDefaultMargins="true" />
|
||||
</LinearLayout>
|
||||
@@ -87,8 +87,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
android:layout_marginBottom="10dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user