initial commit

This commit is contained in:
OnlyPapy98
2025-10-28 17:31:54 +01:00
commit bd3d8a3d3f
124 changed files with 4805 additions and 0 deletions

15
.gitignore vendored Normal file
View File

@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

3
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
Quiz

6
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>

18
.idea/deploymentTargetSelector.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-09-29T14:58:34.998303700Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\T480\.android\avd\Pixel_7_API_34.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
</project>

20
.idea/gradle.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

10
.idea/migrations.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

9
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

17
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

56
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,56 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.google.android.libraries.mapsplatform.secrets.gradle.plugin)
id("com.google.dagger.hilt.android")
}
android {
namespace = "com.example.quiz"
compileSdk = 34
defaultConfig {
applicationId = "com.example.quiz"
minSdk = 29
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
implementation(libs.hilt.android)
annotationProcessor(libs.hilt.compiler)
implementation(libs.rxjava)
implementation(libs.rxandroid)
implementation(libs.recyclerview.v7)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.constraintlayout)
implementation(libs.navigation.fragment)
implementation(libs.navigation.ui)
implementation(libs.play.services.maps)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
}

Binary file not shown.

BIN
app/libs/TSPL_V1.21.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
app/libs/armeabi/libLZO.so Normal file

Binary file not shown.

Binary file not shown.

BIN
app/libs/lzo_V1.0.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
app/libs/mips/libLZO.so Normal file

Binary file not shown.

BIN
app/libs/mips64/libLZO.so Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
app/libs/x86/libLZO.so Normal file

Binary file not shown.

BIN
app/libs/x86_64/libLZO.so Normal file

Binary file not shown.

21
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,26 @@
package com.example.quiz;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.quiz", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:name=".PmuHorseBetting"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Quiz"
tools:targetApi="31">
<activity
android:name=".PageQuiz"
android:exported="true"
android:theme="@style/Theme.Quiz" />
<!--
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow the directions here:
https://developers.google.com/maps/documentation/android-sdk/get-api-key
Once you have your API key (it starts with "AIza"), define a new property in your
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY" />
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.Quiz">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,27 @@
package com.example.quiz;
import com.example.quiz.data.BetsBank;
import com.example.quiz.data.repository.BetRepository;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
@Module
@InstallIn(SingletonComponent.class)
public class AppModule {
@Provides
@Singleton
public BetsBank provideApiService(){
return BetsBank.getInstance();
}
@Provides
@Singleton
public BetRepository provideBetRepository() {
return new BetRepository();
}
}

View File

@@ -0,0 +1,166 @@
package com.example.quiz;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.quiz.data.model.Horse;
import com.example.quiz.databinding.FragmentBetValidationBinding;
import com.example.quiz.utils.HPRTPrinterUtil;
import com.example.quiz.viewModel.BetViewModel;
import com.example.quiz.viewModel.SharedViewModel;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import dagger.hilt.android.AndroidEntryPoint;
/**
* A simple {@link Fragment} subclass.
* Use the {@link BetValidation#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class BetValidation extends Fragment {
FragmentBetValidationBinding binding;
SharedViewModel shared;
BetViewModel viewModel;
private HPRTPrinterUtil printer;
private Integer id;
private String typeOfBet;
private List<Horse> selectedHorses = new ArrayList<Horse>();
private List<Horse> totalHorses;
public BetValidation() {
// Required empty public constructor
}
public static BetValidation newInstance() {
BetValidation fragment = new BetValidation();
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) {
binding = FragmentBetValidationBinding.inflate(inflater, container, false);
binding.combination.setText(getString(R.string.combination,""));
return binding.getRoot();
}
private void setupNumberGrid(GridLayout grid) {
int columns = 4;
grid.setColumnCount(columns);
if(totalHorses != null){
totalHorses.stream()
.map(this::createNumberItem)
.forEach(grid::addView);
}
}
private TextView createNumberItem(Horse horse) {
TextView textView = new TextView(requireContext());
textView.setText(String.valueOf(horse.getNumber()));
textView.setTextColor(getResources().getColor(R.color.white));
GridLayout.LayoutParams params = new GridLayout.LayoutParams();
params.setMargins(10, 10, 10, 10);
textView.setLayoutParams(params);
textView.setTextSize(21);
textView.setWidth(130);
textView.setHeight(130);
textView.setGravity(Gravity.CENTER);
textView.setBackgroundResource(R.drawable.number_background);
textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
textView.setOnClickListener(v -> {
if (selectedHorses.contains(horse)) {
selectedHorses.remove(horse);
v.setSelected(false);
v.setBackgroundResource(R.drawable.number_background);
} else {
selectedHorses.add(horse);
v.setSelected(true);
v.setBackgroundResource(R.drawable.number_selected_background);
}
String combinationText = selectedHorses.stream()
.map(h -> String.valueOf(h.getNumber()))
.collect(Collectors.joining("-"));
binding.combination.setText(getString(R.string.combination, combinationText));
});
return textView;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
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);
});
});
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");
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,44 @@
package com.example.quiz;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.quiz.databinding.FragmentFirst2Binding;
public class First2Fragment extends Fragment {
private FragmentFirst2Binding binding;
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentFirst2Binding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonFirst.setOnClickListener(v ->
NavHostFragment.findNavController(First2Fragment.this)
.navigate(R.id.action_First2Fragment_to_Second2Fragment)
);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,44 @@
package com.example.quiz;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.quiz.databinding.FragmentFirstBinding;
public class FirstFragment extends Fragment {
private FragmentFirstBinding binding;
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentFirstBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonFirst.setOnClickListener(v ->
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment)
);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,127 @@
package com.example.quiz;
import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ComponentActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import android.service.controls.Control;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LayoutAnimationController;
import android.widget.Toast;
import com.example.quiz.data.adapter.BetsAdapter;
import com.example.quiz.databinding.FragmentListOFBettingBinding;
import com.example.quiz.viewModel.BetViewModel;
import com.example.quiz.viewModel.SharedViewModel;
import dagger.hilt.android.AndroidEntryPoint;
import dagger.hilt.android.internal.lifecycle.HiltViewModelFactory;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ListOFBets#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class ListOFBets extends Fragment {
private String username;
private View view;
FragmentListOFBettingBinding binding;
private BetViewModel viewModel;
private SharedViewModel shared;
private BetsAdapter adapter;
private AppCompatActivity activity;
public static ListOFBets newInstance(String username) {
ListOFBets fragment = new ListOFBets();
Bundle args = new Bundle();
args.putString("ARG_USERNAME", username);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getArguments() != null){
username = getArguments().getString("ARG_USERNAME");
}
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
binding = FragmentListOFBettingBinding.inflate(inflater, container, false);
activity = (AppCompatActivity) getActivity();
if(activity != null){
if(activity.getSupportActionBar() != null){
activity.getSupportActionBar().show();
activity.getSupportActionBar().setTitle("Liste des paris");
}
}
adapter = new BetsAdapter();
binding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
binding.recyclerView.setAdapter(adapter);
LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_fad_in);
binding.recyclerView.setLayoutAnimation(controller);
viewModel = new ViewModelProvider(this).get(BetViewModel.class);
shared = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
viewModel.bets.observe(getViewLifecycleOwner(), bets -> {
adapter.setBets(bets);
adapter.setOnItemClickListener(position -> {
shared.setBetId(position);
FragmentManager fragmentManager = getParentFragmentManager();
ListOfTypeOfBets typeOfBets = ListOfTypeOfBets.newInstance();
fragmentManager.beginTransaction()
.replace(R.id.nav_host_fragment_content_main, typeOfBets)
.addToBackStack(null)
.commit();
});
});
viewModel.loadBets();
return binding.getRoot();
}
@SuppressLint("UseSupportActionBar")
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
if(activity!=null){
Toolbar toolbar = activity.findViewById(R.id.toolbar);
toolbar.setBackgroundColor(getResources().getColor(R.color.primary_green));
toolbar.setTitleTextColor(getResources().getColor(R.color.text_light_grey));
activity.setSupportActionBar(toolbar);
if(activity.getSupportActionBar() != null){
activity.getSupportActionBar().setTitle(username);
}
}
}
}

View File

@@ -0,0 +1,84 @@
package com.example.quiz;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.ViewModelProvider;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import com.example.quiz.databinding.FragmentListOfTypeOfBetsBinding;
import com.example.quiz.viewModel.SharedViewModel;
import dagger.hilt.android.AndroidEntryPoint;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ListOfTypeOfBets#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class ListOfTypeOfBets extends Fragment {
private FragmentListOfTypeOfBetsBinding binding;
private SharedViewModel shared;
public ListOfTypeOfBets() {
// Required empty public constructor
}
public static ListOfTypeOfBets newInstance() {
ListOfTypeOfBets fragment = new ListOfTypeOfBets();
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) {
binding = FragmentListOfTypeOfBetsBinding.inflate(inflater, container, false);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RadioGroup types = binding.optionsGroup;
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()
.replace(R.id.nav_host_fragment_content_main, betValidation)
.addToBackStack(null)
.commit();
});
}
}

View File

@@ -0,0 +1,106 @@
package com.example.quiz;
import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import android.widget.Toolbar;
import com.example.quiz.databinding.FragmentLoginBinding;
import com.example.quiz.utils.SharedPrefsHelper;
/**
* A simple {@link Fragment} subclass.
* Use the {@link Login#newInstance} factory method to
* create an instance of this fragment.
*/
public class Login extends Fragment {
private SharedPrefsHelper prefsHelper;
public Login() {
// Required empty public constructor
}
public static Login newInstance() {
Login fragment = new Login();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
private FragmentLoginBinding binding;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
binding = FragmentLoginBinding.inflate(inflater, container, false);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
if(activity != null){
activity.getSupportActionBar().hide();
}
}
public void onStart(){
super.onStart();
binding.loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(binding.userNameInput.getText().toString().isEmpty()){
binding.userNameInput.setError("Le nom d'utilisateur est obligatoire");
binding.userNameInput.requestFocus();
return;
}
if(binding.passwordInput.getText().toString().isEmpty()){
binding.passwordInput.setError("Le mot de passe est obligatoire");
binding.passwordInput.requestFocus();
return;
}
if(binding.passwordInput.getText().toString().length() < 6){
binding.passwordInput.setError("Le mot de passe doit contenir au moins 6 caractères ");
binding.passwordInput.requestFocus();
return;
}
prefsHelper = SharedPrefsHelper.getInstance(getContext());
prefsHelper.save("username", binding.userNameInput.getText().toString());
FragmentManager fragmentManager = getParentFragmentManager();
ListOFBets bets = ListOFBets.newInstance(binding.userNameInput.getText().toString());
fragmentManager.beginTransaction()
.replace(R.id.nav_host_fragment_content_main, bets)
.commit();
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,57 @@
package com.example.quiz;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsFragment extends Fragment {
private OnMapReadyCallback callback = new OnMapReadyCallback() {
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera.
* In this case, we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to
* install it inside the SupportMapFragment. This method will only be triggered once the
* user has installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
LatLng sydney = new LatLng(-34, 151);
googleMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
};
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_maps, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SupportMapFragment mapFragment =
(SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
if (mapFragment != null) {
mapFragment.getMapAsync(callback);
}
}
}

View File

@@ -0,0 +1,71 @@
package com.example.quiz;
import android.graphics.Color;
import android.os.Bundle;
import com.example.quiz.utils.SharedPrefsHelper;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import androidx.fragment.app.FragmentManager;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.example.quiz.databinding.ActivityPageQuizBinding;
import dagger.hilt.android.AndroidEntryPoint;
@AndroidEntryPoint
public class PageQuiz extends AppCompatActivity {
private AppBarConfiguration appBarConfiguration;
private ActivityPageQuizBinding binding;
private SharedPrefsHelper prefsHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityPageQuizBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
binding.toolbar.setBackgroundColor(Color.parseColor("#501C5A29"));
binding.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAnchorView(R.id.fab)
.setAction("Action", null).show();
}
});
prefsHelper = SharedPrefsHelper.getInstance(getApplicationContext());
FragmentManager fragmentManager = getSupportFragmentManager();
if(prefsHelper.get("username") != null){
ListOFBets bets = ListOFBets.newInstance(prefsHelper.get("username"));
fragmentManager
.beginTransaction()
.replace(R.id.nav_host_fragment_content_main, bets)
.commit();
}else{
Login login = Login.newInstance();
fragmentManager
.beginTransaction()
.replace(R.id.nav_host_fragment_content_main, login)
.commit();
}
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_page_quiz);
return NavigationUI.navigateUp(navController, appBarConfiguration)
|| super.onSupportNavigateUp();
}
}

View File

@@ -0,0 +1,11 @@
package com.example.quiz;
import android.app.Application;
import com.example.quiz.utils.SharedPrefsHelper;
import dagger.hilt.android.HiltAndroidApp;
@HiltAndroidApp
public class PmuHorseBetting extends Application {
}

View File

@@ -0,0 +1,80 @@
package com.example.quiz;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.quiz.data.model.Question;
import com.example.quiz.databinding.FragmentQuestionsBinding;
import com.example.quiz.injection.QuestionViewModelFactory;
import com.example.quiz.viewModel.QuestionViewModel;
public class Questions extends Fragment {
private FragmentQuestionsBinding binding;
private QuestionViewModel viewModel;
public Questions() {
// Required empty public constructor
}
public static Questions newInstance(String username) {
Questions fragment = new Questions();
Bundle args = new Bundle();
args.putString("ARG_USERNAME", username);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewModel = new ViewModelProvider(this, QuestionViewModelFactory.getInstance()).get(QuestionViewModel.class);
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
binding = FragmentQuestionsBinding.inflate(inflater, container, false);
// Inflate the layout for this fragment
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
viewModel.startQuiz();
viewModel.currentQuestion.observe(getViewLifecycleOwner(), new Observer<Question>() {
@Override
public void onChanged(Question question) {
binding.questionText.setText(question.getQuestion());
binding.answer1.setText(question.getAnswers().get(0));
binding.answer2.setText(question.getAnswers().get(1));
binding.answer3.setText(question.getAnswers().get(2));
binding.answer4.setText(question.getAnswers().get(3));
}
});
}
@Override
public void onStart() {
super.onStart();
binding.nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewModel.nextQuestion();
}
});
}
}

View File

@@ -0,0 +1,44 @@
package com.example.quiz;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.quiz.databinding.FragmentSecond2Binding;
public class Second2Fragment extends Fragment {
private FragmentSecond2Binding binding;
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentSecond2Binding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonSecond.setOnClickListener(v ->
NavHostFragment.findNavController(Second2Fragment.this)
.navigate(R.id.action_Second2Fragment_to_First2Fragment)
);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,44 @@
package com.example.quiz;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.quiz.databinding.FragmentSecondBinding;
public class SecondFragment extends Fragment {
private FragmentSecondBinding binding;
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentSecondBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonSecond.setOnClickListener(v ->
NavHostFragment.findNavController(SecondFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment)
);
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

View File

@@ -0,0 +1,72 @@
package com.example.quiz.data;
import com.example.quiz.data.model.Bet;
import com.example.quiz.data.model.Horse;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
public class BetsBank {
public List<Bet> getBet() {
return Arrays.asList(
new Bet(
1,
"Course de chevaux",
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(1),
new Horse(2),
new Horse(3),
new Horse(4)
)
),
new Bet(
2,
"Course de chevaux 2",
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(4),
new Horse(5),
new Horse(7),
new Horse(6)
)
),
new Bet(
3,
"Course de chevaux 3",
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(10),
new Horse(90),
new Horse(45),
new Horse(9)
)
),
new Bet(
4,
"Course de chevaux 4",
LocalDate.of(2025,10,1),
Arrays.asList(
new Horse(5),
new Horse(33),
new Horse(26),
new Horse(99),
new Horse(100),
new Horse(101),
new Horse(102),
new Horse(103),
new Horse(104),
new Horse(105)
)
)
);
}
public static BetsBank instance;
public static BetsBank getInstance(){
if(instance == null){
instance = new BetsBank();
}
return instance;
}
}

View File

@@ -0,0 +1,69 @@
package com.example.quiz.data;
import com.example.quiz.data.model.Question;
import java.util.Arrays;
import java.util.List;
public class QuestionsBank {
public List<Question> getQuestions() {
return Arrays.asList(
new Question(
"Who is the creator of Android?",
Arrays.asList(
"Andy Rubin",
"Steve Wozniak",
"Jake Wharton",
"Paul Smith"
),
0
),
new Question(
"When did the first man land on the moon?",
Arrays.asList(
"1958",
"1962",
"1967",
"1969"
),
3
),
new Question(
"What is the house number of The Simpsons?",
Arrays.asList(
"42",
"101",
"666",
"742"
),
3
),
new Question(
"Who painteddid the Mona Lisa paint?",
Arrays.asList(
"Michelangelo",
"Leonardo Da Vinci",
"Raphael",
"Caravaggio"
),
1
),
new Question(
"What is the country top-level domain of Belgium?",
Arrays.asList(
".bg",
".bm",
".bl",
".be"
),
3
)
);
}
private static QuestionsBank instance;
public static QuestionsBank getInstance() {
if (instance == null) {
instance = new QuestionsBank();
}
return instance;
}
}

View File

@@ -0,0 +1,75 @@
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.Bet;
import java.util.ArrayList;
import java.util.List;
public class BetsAdapter extends RecyclerView.Adapter<BetsAdapter.BetViewHolder> {
private List<Bet> bets = new ArrayList<>();
private onItemClickListener listener;
public interface onItemClickListener {
void onItemClick(int position);
}
public void setOnItemClickListener(onItemClickListener listener){
this.listener = listener;
}
public void setBets(List<Bet> bets){
this.bets = bets;
notifyDataSetChanged();
}
@NonNull
@Override
public BetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
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) {
Bet bet = bets.get(position);
holder.tvDate.setText(String.valueOf(bet.getDate()));
holder.tvName.setText(String.valueOf(bet.getName()));
holder.itemView.setOnClickListener(v->{
if(listener != null){
listener.onItemClick(bet.getId());
}
});
}
@Override
public int getItemCount(){
return bets.size();
}
static class BetViewHolder extends RecyclerView.ViewHolder{
TextView tvName, tvDate;
public BetViewHolder(@NonNull View itemView) {
super(itemView);
tvName = itemView.findViewById(R.id.tvName);
tvDate = itemView.findViewById(R.id.tvDate);
}
}
}

View File

@@ -0,0 +1,52 @@
package com.example.quiz.data.model;
import java.time.LocalDate;
import java.util.List;
public class Bet {
private int id;
private String name;
private LocalDate date;
private List<Horse> horses;
public List<Horse> getHorses() {
return horses;
}
public void setHorses(List<Horse> horses) {
this.horses = horses;
}
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 LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Bet(int id, String name, LocalDate date, List<Horse> horses) {
this.id = id;
this.name = name;
this.date = date;
this.horses = horses;
}
}

View File

@@ -0,0 +1,18 @@
package com.example.quiz.data.model;
public class Horse {
private Integer number;
public Horse(Integer number) {
this.number = number;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
}

View File

@@ -0,0 +1,39 @@
package com.example.quiz.data.model;
import java.util.List;
public class Question {
private String question;
private List<String> answers;
private Integer indexAnswer;
public Question(String question, List<String> answers, int indexAnswer){
this.question = question;
this.answers = answers;
this.indexAnswer = indexAnswer;
}
public int getIndexAnswer() {
return indexAnswer;
}
public void setIndexAnswer(int indexAnswer) {
this.indexAnswer = indexAnswer;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public List<String> getAnswers() {
return answers;
}
public void setAnswers(List<String> answers) {
this.answers = answers;
}
}

View File

@@ -0,0 +1,46 @@
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 java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class BetRepository {
private BetsBank betsBank;
@Inject
public BetRepository(BetsBank betsBank){
this.betsBank = betsBank;
}
public BetRepository(){
this.betsBank = BetsBank.getInstance();
}
public List<Bet> getAllBets(){
return betsBank.getBet();
}
public Bet getBetById(int id){
return betsBank.getBet().get(id);
}
public List<Horse> getHorsesById(int id){
return getBetById(id).getHorses();
}
public BetRepository getInstance(){
return new BetRepository();
}
public String getBetNameById(int id){
return getBetById(id).getName();
}
}

View File

@@ -0,0 +1,31 @@
package com.example.quiz.data.repository;
import com.example.quiz.data.QuestionsBank;
import com.example.quiz.data.model.Question;
import java.util.List;
import java.util.Map;
public class QuestionRepository {
private QuestionsBank questionsBank;
public QuestionRepository(){
this.questionsBank = QuestionsBank.getInstance();
}
public List<Question> getQuestions(){
return questionsBank.getQuestions();
}
public Object updateQuestionById(int id, Question question){
Question myQuestion = questionsBank.getQuestions().get(id);
if(question == null) return Map.of("error", "Cette question n'existe pas!");
myQuestion.setQuestion(question.getQuestion()!=null?question.getQuestion():myQuestion.getQuestion());
myQuestion.setAnswers(!question.getAnswers().isEmpty()?question.getAnswers():myQuestion.getAnswers());
myQuestion.setIndexAnswer(question.getIndexAnswer() > 3?question.getIndexAnswer():myQuestion.getIndexAnswer());
return Map.of("success", true);
}
public QuestionRepository getInstance(){
return new QuestionRepository();
}
}

View File

@@ -0,0 +1,38 @@
package com.example.quiz.injection;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import com.example.quiz.data.repository.QuestionRepository;
import com.example.quiz.viewModel.QuestionViewModel;
public class QuestionViewModelFactory implements ViewModelProvider.Factory {
private QuestionRepository questionRepository;
private static QuestionViewModelFactory factory;
public static QuestionViewModelFactory getInstance(){
if(factory == null){
synchronized (QuestionViewModel.class){
if(factory == null){
factory = new QuestionViewModelFactory();
}
}
}
return factory;
}
private QuestionViewModelFactory(){
this.questionRepository = new QuestionRepository();
}
@Override
@NonNull
public <T extends ViewModel> T create(@NonNull Class<T> modelClass){
if(modelClass.isAssignableFrom(QuestionViewModel.class)){
return (T) new QuestionViewModel(questionRepository);
}
throw new IllegalArgumentException("Unknown ViewModel class");
}
}

View File

@@ -0,0 +1,91 @@
package com.example.quiz.utils;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import tspl.HPRTPrinterHelper;
public class HPRTPrinterUtil {
private static final String TAG = "HPRTPrinterUtil";
private Context context;
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
*/
public boolean connectBluetooth(String btAddress) {
try {
HPRTPrinterHelper.PortClose(); // ferme toute connexion existante
int result = HPRTPrinterHelper.PortOpen("Bluetooth," + btAddress);
if (result == 0) {
Log.d(TAG, "Connexion réussie");
Toast.makeText(context, "Imprimante connectée", Toast.LENGTH_SHORT).show();
return true;
} else {
Log.e(TAG, "Erreur connexion: " + result);
Toast.makeText(context, "Erreur connexion imprimante: " + result, Toast.LENGTH_SHORT).show();
return false;
}
} catch (Exception e) {
Log.e(TAG, "Erreur connexion: " + e.getMessage());
return false;
}
}
public void printText(String text) {
try {
if (!HPRTPrinterHelper.IsOpened()) {
Toast.makeText(context, "Imprimante non connectée", Toast.LENGTH_SHORT).show();
return;
}
// TSPL pur pour texte simple
String tspl = ""+ text + "\r\n";
// Envoi à l'imprimante
HPRTPrinterHelper.PrintData(tspl);
Log.d(TAG, "Texte imprimé sur ticket"); // on log seulement le succès
} catch (Exception e) {
Log.e(TAG, "Erreur impression TSPL: " + e.getMessage());
Toast.makeText(context, "Erreur impression TSPL", Toast.LENGTH_SHORT).show();
}
}
public void printTSPLTemplate(String tsplTemplate) {
try {
if (!HPRTPrinterHelper.IsOpened()) {
Toast.makeText(context, "Imprimante non connectée", Toast.LENGTH_SHORT).show();
return;
}
HPRTPrinterHelper.PrintData(tsplTemplate);
Log.d(TAG, "Template imprimé");
} catch (Exception e) {
Log.e(TAG, "Erreur impression TSPL: " + e.getMessage());
Toast.makeText(context, "Erreur impression TSPL", Toast.LENGTH_SHORT).show();
}
}
/**
* Déconnecte l'imprimante
*/
public void disconnect() {
try {
HPRTPrinterHelper.PortClose();
Toast.makeText(context, "Imprimante déconnectée", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Erreur déconnexion: " + e.getMessage());
}
}
}

View File

@@ -0,0 +1,34 @@
package com.example.quiz.utils;
import android.content.Context;
import android.content.SharedPreferences;
public class SharedPrefsHelper {
private static final String PREF_NAME = "quiz_prefs";
private static SharedPrefsHelper instance;
private SharedPreferences prefs;
private SharedPrefsHelper(Context context) {
prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
public static SharedPrefsHelper getInstance(Context context) {
if (instance == null) {
instance = new SharedPrefsHelper(context.getApplicationContext());
}
return instance;
}
public void save(String key, String value) {
prefs.edit().putString(key, value).apply();
}
public String get(String key) {
return prefs.getString(key, null);
}
public void clear() {
prefs.edit().clear().apply();
}
}

View File

@@ -0,0 +1,46 @@
package com.example.quiz.viewModel;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.quiz.data.model.Bet;
import com.example.quiz.data.model.Horse;
import com.example.quiz.data.repository.BetRepository;
import java.util.List;
import javax.inject.Inject;
import dagger.hilt.android.lifecycle.HiltViewModel;
@HiltViewModel
public class BetViewModel extends ViewModel {
private BetRepository betRepository;
public MutableLiveData<List<Bet>> bets = new MutableLiveData<List<Bet>>();
public MutableLiveData<String> betName = new MutableLiveData<String>();
public MutableLiveData<List<Horse>> horses = new MutableLiveData<>();
@Inject
public BetViewModel(BetRepository betRepository){
this.betRepository = betRepository;
}
public void loadBets(){
bets.setValue(betRepository.getAllBets());
}
public void loadHorses(int id){
horses.setValue(betRepository.getHorsesById(id));
}
public void getBetNameById(int id){
betName.setValue(betRepository.getBetNameById(id));
}
}

View File

@@ -0,0 +1,41 @@
package com.example.quiz.viewModel;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.quiz.data.model.Question;
import com.example.quiz.data.repository.QuestionRepository;
import java.util.Objects;
public class QuestionViewModel extends ViewModel {
private QuestionRepository questionRepository;
public MutableLiveData<Question> currentQuestion = new MutableLiveData<Question>();
public MutableLiveData<Integer> score = new MutableLiveData<Integer>();
public MutableLiveData<Boolean> isLastQuestion = new MutableLiveData<Boolean>(false);
public QuestionViewModel(QuestionRepository questionRepository){
this.questionRepository = questionRepository;
}
public void startQuiz(){
currentQuestion.setValue(questionRepository.getQuestions().get(0));
score.setValue(0);
}
public Boolean isAnswerValid(int answerIndex){
return answerIndex == Objects.requireNonNull(currentQuestion.getValue()).getIndexAnswer();
}
public void nextQuestion(){
int currentQuestionIndex = questionRepository.getQuestions().indexOf(currentQuestion.getValue());
if(currentQuestionIndex == questionRepository.getQuestions().size()-1){
isLastQuestion.setValue(true);
}else{
currentQuestion.setValue(questionRepository.getQuestions().get(currentQuestionIndex+1));
}
}
}

View File

@@ -0,0 +1,22 @@
package com.example.quiz.viewModel;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import javax.inject.Inject;
import dagger.hilt.android.lifecycle.HiltViewModel;
public class SharedViewModel extends ViewModel {
public MutableLiveData<Integer> betId = new MutableLiveData<Integer>();
public MutableLiveData<String> typeOfBet = new MutableLiveData<String>();
public void setBetId(int id){
betId.setValue(id);
}
public void setTypeOfBet(String type){
typeOfBet.setValue(type);
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="1700" />

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/item_fad_in"
android:delay="20%"
android:order="@integer/google_play_services_version" />

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/cardview_shadow_end_color"
>
</solid>
<stroke
android:width="2sp"
android:color="@color/cardview_shadow_start_color">
</stroke>
<corners android:radius="1000dp" />
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp"
>
</padding>
</shape>

View File

@@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:id="@+id/gradient"
android:startColor="?attr/greenOpacity30"
android:endColor="?attr/redOpacity10"
android:angle="270"
>
</gradient>
</shape>

View 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="@color/green_opacity_30"/>
<stroke android:width="2dp" android:color="#2E7D32"/>
<corners android:radius="12dp"/>
</shape>

View File

@@ -0,0 +1,10 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/white" />
<stroke android:width="1dp" android:color="@color/text_light_grey" />
<corners android:radius="12dp" />
<padding
android:left="8dp"
android:top="2dp"
android:right="8dp"
android:bottom="2dp" />
</shape>

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="36"
android:viewportHeight="36">
<path
android:pathData="M23.283,23.275s1.374,1.635 2.733,10.047c0.143,0.883 0.201,1.775 0.217,2.678H36V7.448C31.613,3.975 25.601,3.259 18.322,5.69c0,0 -5.408,-3 -6.147,-3.739c-0.719,-0.72 -1.857,-1.556 -1.235,0.35c0.364,1.112 0.764,2.373 2.358,4.862c-3.436,2.036 -4.513,4.68 -8.558,13.341C1.652,27.12 0.08,29.269 0.937,31.797c1.13,3.337 5.316,5.595 8.844,3.021c1.919,-1.4 2.246,-3.913 6.225,-6.223c3.653,-0.065 7.277,-1.604 7.277,-5.32z"
android:fillColor="#C1694F"/>
<path
android:pathData="M36,6.012C27.665,0.301 14.354,1.473 15.909,6.19C25.51,4.328 31.77,7.731 36,13.358V6.012z"
android:fillColor="#292F33"/>
<path
android:pathData="M19.663,5.763c-2.878,0.233 -7.157,1.595 -9.296,3.967c0,0 -0.129,-5.147 3.566,-5.614c6.172,-0.779 5.809,0.363 5.809,0.363l-0.079,1.284z"
android:fillColor="#292F33"/>
<path
android:pathData="M16.357,1.056c0.558,1.155 4.006,1.79 5.056,6.029c1.051,4.24 -3.134,2.951 -4.356,0.855c-1.361,-2.334 -1.828,-4.162 -1.867,-5.679c-0.021,-0.801 0.039,-3.538 1.167,-1.205z"
android:fillColor="#C1694F"/>
<path
android:pathData="M16.596,2.838c1.103,0.968 2.448,2.472 2.65,3.955c0.202,1.483 -1.125,0.988 -1.736,-0.372c-0.612,-1.359 -0.753,-2.779 -1.134,-3.233c-0.38,-0.454 0.22,-0.35 0.22,-0.35z"
android:fillColor="#662113"/>
<path
android:pathData="M16.94,15.525a1.244,1.244 0,1 1,-2.489 0a1.244,1.244 0,0 1,2.489 0z"
android:fillColor="#292F33"/>
<path
android:pathData="M4.222,29.917c0,0.881 -0.532,1.594 -1.187,1.594s-1.187,-0.713 -1.187,-1.594c0,-0.882 0.532,-1.596 1.187,-1.596s1.187,0.714 1.187,1.596z"
android:fillColor="#662113"/>
<path
android:pathData="M10.354,9.924c-0.033,-0.017 -0.075,-0.014 -0.111,-0.024c-1.543,2.033 -2.92,5.102 -5.49,10.604c-1.356,2.903 -2.42,4.946 -3.116,6.538c1.628,0.226 3.285,-1.442 3.945,-3.271c0.673,-1.866 3.215,-5.652 4.927,-7.778c1.712,-2.127 1.561,-5.144 -0.155,-6.069z"
android:fillColor="#D99E82"/>
</vector>

View File

@@ -0,0 +1,16 @@
<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="M0,0h24v24h-24z"
android:fillColor="#ffffff"/>
<path
android:strokeWidth="1"
android:pathData="M6,12H18M18,12L13,7M18,12L13,17"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:strokeLineCap="round"/>
</vector>

View File

@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0,0h24v24h-24z"
android:fillColor="#ffffff"/>
<path
android:strokeWidth="1"
android:pathData="M9.5,7L14.5,12L9.5,17"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:strokeLineCap="round"/>
</vector>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,20 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- Fond transparent -->
<solid android:color="@color/transparent" />
<!-- Bordure -->
<stroke
android:width="1dp"
android:color="@color/red_opacity_10" />
<!-- Coins arrondis -->
<corners android:radius="5dp" />
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp" />
</shape>

View File

@@ -0,0 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/primary_green" />
<stroke android:width="2dp" android:color="@color/primary_green" />
</shape>

View File

@@ -0,0 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#4CAF50" />
<stroke android:width="2dp" android:color="#2E7D32" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

View File

@@ -0,0 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/primary_green"/> <!-- couleur verte -->
<corners android:radius="12dp"/> <!-- coins arrondis -->
</shape>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="16dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".PageQuiz">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_main" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="16dp"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment_content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.quiz.Login"
/>
<!-- <fragment
android:id="@+id/nav_host_fragment_content_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph" />-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<fragment
android:id="@+id/nav_host_fragment_content_page_quiz"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph2" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="15dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:text="@string/hors_choice"
android:textStyle="bold"
android:textSize="25sp"
android:layout_marginTop="35dp"
android:textColor="@color/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/horseName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:textColor="@color/primary_green"
android:layout_marginTop="15dp"
android:layout_marginBottom="40dp"
android:textFontWeight="300"
>
</TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal"
>
<GridLayout
android:id="@+id/grid_numbers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:useDefaultMargins="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="30dp"
android:orientation="horizontal"
android:gravity="start">
<TextView
android:id="@+id/combination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:textSize="21sp"
android:text="@string/combination"
android:textColor="@color/primary_green">
</TextView>
</LinearLayout>
<Button
android:id="@+id/btn_validate"
android:text="Valider"
android:paddingVertical="8dp"
android:paddingHorizontal="13dp"
android:background="@color/primary_green"
android:backgroundTint="@color/primary_green"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</LinearLayout>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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"
tools:context=".FirstFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<Button
android:id="@+id/button_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next"
app:layout_constraintBottom_toTopOf="@id/textview_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textview_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/lorem_ipsum"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_first" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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"
tools:context=".First2Fragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<Button
android:id="@+id/button_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next"
app:layout_constraintBottom_toTopOf="@id/textview_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textview_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/lorem_ipsum"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_first" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:paddingTop="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ListOFBets">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp"
android:background="@color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sélectionnez la course"
android:textSize="22sp"
android:textColor="#333333"
android:layout_marginBottom="16dp"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif-medium"/>
<!-- History button -->
<Button
android:id="@+id/btnHistory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Voir l'historique"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:padding="12dp"
android:backgroundTint="#4CAF50"
android:textColor="#FFFFFF"
android:textAllCaps="false"/>
<androidx.recyclerview.widget.RecyclerView
android:paddingTop="40dp"
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</FrameLayout>

View File

@@ -0,0 +1,55 @@
<?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="20dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bet_type_title"
android:textSize="18sp"
android:textStyle="bold"
android:paddingBottom="12dp" />
<!-- Les options statiques -->
<RadioGroup
android:id="@+id/optionsGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/option1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/couplet" />
<RadioButton
android:id="@+id/option2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/tierce" />
<RadioButton
android:id="@+id/option3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/quarte" />
<RadioButton
android:id="@+id/option4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/quinte" />
</RadioGroup>
<!-- Bouton valider -->
<Button
android:id="@+id/btnValidate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/rounded_button_green"
android:text="Valider" />
</LinearLayout>

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="100dp"
android:visibility="visible"
android:background="@color/login_background"
android:id="@+id/login_container"
tools:context=".Login">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingHorizontal="24dp"
android:gravity="center_vertical"
android:orientation="vertical"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="48dp"
android:layout_marginBottom="32dp"
android:layout_marginVertical="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginBottom="24dp"
android:contentDescription="@string/logo"
android:scaleType="fitCenter"
android:src="@drawable/pmu_logo" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible"
android:paddingTop="12dp"
android:gravity="center_horizontal">
<EditText
android:id="@+id/userNameInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:autofillHints="username"
android:drawableStart="@android:drawable/ic_menu_myplaces"
android:textColorHint="@color/text_hint_color"
android:textColor="@color/text_color"
android:background="@drawable/edittext_border"
android:inputType="text"
android:hint="@string/username_message" />
<EditText
android:id="@+id/passwordInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:autofillHints="password"
android:textColorHint="@color/text_hint_color"
android:textColor="@color/text_color"
android:layout_marginVertical="19dp"
android:drawableStart="@android:drawable/ic_lock_idle_lock"
android:background="@drawable/edittext_border"
android:inputType="textPassword"
android:hint="@string/password_message" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:background="@drawable/rounded_button_green"
android:fontFamily="sans-serif-medium"
android:backgroundTint="@color/primary_green"
android:padding="14dp"
android:text="@string/log_in"
android:textAllCaps="false"
android:textColor="#FFFFFF" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsFragment" />

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:background="@color/cardview_shadow_start_color">
<!-- Question -->
<TextView
android:id="@+id/questionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="@color/cardview_light_background"
android:gravity="center"
android:paddingBottom="24dp" />
<!-- Réponses -->
<RadioGroup
android:id="@+id/answersGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="32dp">
<RadioButton
android:id="@+id/answer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:padding="8dp" />
<RadioButton
android:id="@+id/answer2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:padding="8dp" />
<RadioButton
android:id="@+id/answer3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:padding="8dp" />
<RadioButton
android:id="@+id/answer4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:padding="8dp" />
</RadioGroup>
<!-- Bouton Suivant -->
<Button
android:id="@+id/nextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Question suivante"
android:backgroundTint="@color/purple"
android:textColor="@android:color/white"
android:padding="12dp" />
</LinearLayout>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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"
tools:context=".SecondFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<Button
android:id="@+id/button_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/previous"
app:layout_constraintBottom_toTopOf="@id/textview_second"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textview_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/lorem_ipsum"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_second" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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"
tools:context=".Second2Fragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<Button
android:id="@+id/button_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/previous"
app:layout_constraintBottom_toTopOf="@id/textview_second"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textview_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/lorem_ipsum"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_second" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:background="@color/green_opacity_30"
android:layout_margin="5dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="18dp"
android:background="@drawable/course_item_border">
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="@color/text_color"
android:fontFamily="sans-serif-medium">
</TextView>
<TextView
android:id="@+id/tvDate"
android:layout_width="wrap_content"
android:layout_marginTop="5dp"
android:textFontWeight="400"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/text_color"
android:fontFamily="sans-serif-medium">
</TextView>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -0,0 +1,10 @@
<menu 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"
tools:context="com.example.quiz.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Some files were not shown because too many files have changed in this diff Show More