Premier commit - Intégration à git

This commit is contained in:
Mysaa 2021-05-19 19:41:47 +02:00
commit af803440b1
37 changed files with 1484 additions and 0 deletions

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
MCQFormQuizSheetParser/bin/
app/build
MCQFormQuizSheetParser/.settings
gradle/
gradlew
gradlew.bat

19
LaRoueDeLInfortune.iml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="LaRoueDeLInfortune" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

132
app/app.iml Normal file
View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="LaRoueDeLInfortune" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="4.0.0" />
<option name="LAST_KNOWN_AGP_VERSION" value="4.0.0" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res;file://$MODULE_DIR$/build/generated/res/rs/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/androidTest/res;file://$MODULE_DIR$/src/test/res;file://$MODULE_DIR$/src/androidTestDebug/res;file://$MODULE_DIR$/src/testDebug/res;file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.ext:junit:1.1.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-core:3.2.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:runner:1.2.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:core:1.2.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:monitor:1.2.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-idling-resource:3.2.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: io.github.kexanie.library:MathView:0.0.6@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.activity:activity:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.savedstate:savedstate:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
</component>
</module>

43
app/build.gradle Normal file
View File

@ -0,0 +1,43 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.bernard.larouedelinfortune"
minSdkVersion 24
targetSdkVersion 29
versionCode 5
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/COPYING'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'io.github.kexanie.library:MathView:0.0.6'
//implementation 'com.github.judemanutd:katexview:1.0.2'
//implementation 'org.scilab.forge:jlatexmath:1.0.7'
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bernard.larouedelinfortune">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_richard2"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_richard2_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".EditExosActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,154 @@
package com.bernard.larouedelinfortune;
import android.content.Context;
import android.util.Log;
import android.view.Choreographer;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.GridLayout;
import java.util.Random;
public class BanditManchotAnimator implements View.OnTouchListener {
private Choreographer choreographer;
private Random rand;
private QuestionsView[] views;
private JeuDeQuestions jeu;
GridLayout layout;
private int questionCount;
private int[] results;
int rollingMinIndex = -1;
int deceleratingQuestion = -1;
long t00 = -1;
long t0 = -1;
long t1 = -1;
int deltat0 = 1000;
int deltat = 500;
int deltax = 1000;
double epsilon = 0.008;
double omega = 0.02*Math.PI;
public int speed = 511;
public int speedRand = 10;
public BanditManchotAnimator(GridLayout layout, Context ctx,int questionCount, JeuDeQuestions questions, Button triggerer) {
this.questionCount = questionCount;
rand = new Random();
views = null;
results = new int[questionCount];
choreographer = Choreographer.getInstance();
this.layout = layout;
this.jeu = questions;
triggerer.setOnTouchListener(this);
views = new QuestionsView[questionCount];
LayoutInflater inflater = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout.removeAllViews();
layout.setRowCount(questionCount);
layout.setColumnCount(1);
for (int i = 0; i < questionCount; i++) {
views[i] = (QuestionsView)inflater.inflate(R.layout.questionview_element,layout,false);
views[i].setQuestions(questions.getQuestions());
views[i].setLayoutParams(new ViewGroup.LayoutParams(100,100));
GridLayout.Spec rowSpan = GridLayout.spec(i);
GridLayout.Spec colSpan = GridLayout.spec(0);
GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowSpan,colSpan);
layout.addView(views[i],i,lp);
}
layout.postInvalidate();
}
private void onFrameDraw(){
//Log.d("Triggered","Et PAF !!! ");
long t = System.currentTimeMillis();
if(rollingMinIndex<questionCount && t>t00) {
int pos = views[rollingMinIndex].position;
int x0 = views[rollingMinIndex].width * results[rollingMinIndex];
int totalwidth = views[rollingMinIndex].width * views[rollingMinIndex].getQCount();
if ((pos + speed - deltax - x0) % totalwidth < speed) {
deceleratingQuestion = rollingMinIndex;
t00 = Long.MAX_VALUE;
t0 = t;
t1 = t + (long) (Math.log(deltax)/ epsilon) + 1;
rollingMinIndex++;
}
}
if(deceleratingQuestion!=-1) {
int x0 = views[deceleratingQuestion].width * results[deceleratingQuestion];
if(t<=t1) {
//Log.d("Decelerating",deceleratingQuestion+"->"+(x0 + (int) (Math.exp(-epsilon * (t - t0)) * Math.cos(omega * (t - t0)))));
views[deceleratingQuestion].position = x0 + (int) (deltax*Math.exp(-epsilon * (t - t0)) * Math.cos(omega * (t - t0)));
views[deceleratingQuestion].invalidate();
}else {
views[deceleratingQuestion].position = x0;
views[deceleratingQuestion].invalidate();
deceleratingQuestion=-1;
t00=t+deltat;
}
}
for (int i = rollingMinIndex; i < questionCount; i++) {
views[i].position += speed + rand.nextInt(speedRand*2+1)-speedRand;
views[i].invalidate();
}
if(rollingMinIndex!=questionCount || deceleratingQuestion!=-1){
choreographer.postFrameCallback(frameTimeNanos -> onFrameDraw());
}
}
private void amorceFrameUpdate(){
choreographer.postFrameCallback(frameTimeNanos -> onFrameDraw());
}
private void newResults(){
results = jeu.auHasards(rand,questionCount);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
v.performClick();
if(event.getAction()==MotionEvent.ACTION_DOWN){
newResults();
deceleratingQuestion=-1;
rollingMinIndex=0;
t00=Long.MAX_VALUE;
amorceFrameUpdate();
}else if(event.getAction()==MotionEvent.ACTION_UP){
t00 = System.currentTimeMillis()+deltat0;
}
return false;
}
public void clearAnim(){
rollingMinIndex=questionCount;
deceleratingQuestion=-1;
t00=-1;
t0=-1;
t1=-1;
}
public void changeJeu(JeuDeQuestions jeuDeQuestions) {
clearAnim();
this.jeu = jeuDeQuestions;
for (QuestionsView v : views) {
v.setQuestions(jeuDeQuestions.getQuestions());
}
}
}

View File

@ -0,0 +1,221 @@
package com.bernard.larouedelinfortune;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
public class EditExosActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
Spinner jeuSelector;
ArrayAdapter<String> jeuSelectorAdapter;
EditText editingJeu;
String currentJeu;
Button renameJeuButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_exos);
jeuSelector = findViewById(R.id.jeuSeletor);
editingJeu = findViewById(R.id.exoText);
renameJeuButton = findViewById(R.id.renameButton);
jeuSelector.setOnItemSelectedListener(this);
renameJeuButton.setOnClickListener(this);
Set<String> nomDesJeuxDispos = JeuDeQuestions.nomDesJeuxDispos(this);
if(nomDesJeuxDispos.isEmpty())
JeuDeQuestions.getAndSetDefaultQuestions(this);
nomDesJeuxDispos = JeuDeQuestions.nomDesJeuxDispos(this);
jeuSelectorAdapter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item,new ArrayList<String>());
jeuSelector.setAdapter(jeuSelectorAdapter);
updateJeux(nomDesJeuxDispos);
String name = nomDesJeuxDispos.stream().findAny().get();
String jeuToBeSelected = getIntent().getStringExtra(MainActivity.EXTRA_SELECTED_JEU);
if(jeuToBeSelected!=null)jeuSelector.setSelection(jeuSelectorAdapter.getPosition(jeuToBeSelected));
updateJeu(name);
}
@Override
protected void onPause() {
super.onPause();
try {
sauvegarderJeu();
} catch (IOException e) {
Log.e("onPauseAutosave", "Impossible de sauvegarder le jeu",e);
}
}
public void sauvegarderJeu() throws IOException {
String currentText = editingJeu.getText().toString();
ByteArrayInputStream baos = new ByteArrayInputStream(currentText.getBytes());
JeuDeQuestions jdq = JeuDeQuestions.read(baos);
baos.close();
jdq.sauvegarderJeu(this,currentJeu);
}
public void updateJeux(Set<String> jeuxDeQuestion){
List<String> jeuxNamesAlphabetically = new ArrayList<>(jeuxDeQuestion);
jeuxNamesAlphabetically.sort(Comparator.naturalOrder());
String selected = jeuSelector.getSelectedItem()!=null?jeuSelector.getSelectedItem().toString():jeuxNamesAlphabetically.get(0);
jeuSelectorAdapter.clear();
jeuSelectorAdapter.addAll(jeuxNamesAlphabetically);
jeuSelectorAdapter.notifyDataSetChanged();
jeuSelector.setSelection(jeuxNamesAlphabetically.indexOf(selected));
}
public void updateJeu(String name){
Log.d("UpdateJeu","OldJeu : "+currentJeu);
try {
JeuDeQuestions jdq = JeuDeQuestions.lireJeu(this, name);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
jdq.save(baos);
baos.flush();
String jeuText = new String(baos.toByteArray(), StandardCharsets.UTF_8);
baos.close();
Log.i("SelectGameForEditing","Je remplace votre texte par "+ jeuText);
editingJeu.getText().clear();
editingJeu.getText().append(jeuText);
currentJeu = name;
jeuSelector.setSelection(jeuSelectorAdapter.getPosition(currentJeu));
}catch(IOException| NullPointerException e){
Log.e("SelectGameForEditing","Impossible de charger le jeu",e);
e.printStackTrace();
}
Log.d("UpdateJeu","NewJeu : "+currentJeu);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_edition,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.newQuestion:
Log.d("NewJeu","Création d'un jeu");
try{
JeuDeQuestions.lireJeu(this,getString(R.string.jeuParDefaut));
}catch(IllegalArgumentException e){
//Le jeu par défaut n'existe pas
try {
sauvegarderJeu();
JeuDeQuestions.getAndSetDefaultQuestions(this);
updateJeux(JeuDeQuestions.nomDesJeuxDispos(this));
updateJeu(getString(R.string.jeuParDefaut));
return true;
} catch (IOException ex) {
Log.w("UnparsableJeu","Impossible de comprendre le texte",e);
Toast.makeText(this,R.string.cantSaveUnparsable,Toast.LENGTH_SHORT).show();
}
}
Log.i("NewJeu","Le jeu éxistait déjà !");
Toast.makeText(this,getString(R.string.alreadyDefaultJeu,getString(R.string.jeuParDefaut)),Toast.LENGTH_SHORT).show();
updateJeux(JeuDeQuestions.nomDesJeuxDispos(this));
return true;
case R.id.refresh:
new AlertDialog.Builder(this).setTitle(R.string.refresh)
.setMessage(R.string.youWannaSave)
.setCancelable(true)
.setPositiveButton(android.R.string.yes, (dialog,which) -> {
try {
sauvegarderJeu();
}catch (IOException e){
Log.e("RefreshingEdit","Impossible de sauvegarder");
}
updateJeux(JeuDeQuestions.nomDesJeuxDispos(this));
updateJeu(currentJeu);
})
.setNegativeButton(android.R.string.no, (dialog,which) -> updateJeux(JeuDeQuestions.nomDesJeuxDispos(this))).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.d("OnItemSelected","Checking "+parent+"=="+jeuSelector);
if(parent == jeuSelector){
try {
sauvegarderJeu();
updateJeu(jeuSelectorAdapter.getItem(position));
}catch (Exception e){
Log.w("UnparsableJeu","Impossible de comprendre le texte",e);
Toast.makeText(this,R.string.cantSaveUnparsable,Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onClick(View v) {
if(v==renameJeuButton){
final EditText newNameText = new EditText(this);
newNameText.setText(currentJeu);
new AlertDialog.Builder(this)
.setTitle(R.string.nouveauNom)
.setView(newNameText)
.setCancelable(true)
.setPositiveButton(android.R.string.ok,(dialog,which) -> {
String newName = filize(newNameText.getText().toString());
JeuDeQuestions.lireJeu(this,currentJeu).sauvegarderJeu(this,newName);
JeuDeQuestions.detruireJeu(this,currentJeu);
updateJeux(JeuDeQuestions.nomDesJeuxDispos(this));
updateJeu(newName);
})
.show();
}
}
public String filize(String s){
return s.replace(' ','_')
.replace('è','e')
.replace('é','e')
.replace('à','a')
.replace('ù','u')
.replaceAll(JeuDeQuestions.JEUNAME_CHAR_PATTERN,"");
}
}

View File

@ -0,0 +1,248 @@
package com.bernard.larouedelinfortune;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.xml.transform.stream.StreamSource;
public class JeuDeQuestions {
public static final String jeuxSubFolder = "jeux";
private String[] questions;
private double[] poids;
private double somme;
public JeuDeQuestions(String[] questions, double[] poids) {
this.questions = questions;
this.poids = poids;
this.somme = 0;
for (double p : this.poids) this.somme += p;
}
public int auHasard(Random r) {
double resultat = r.nextDouble() * somme;
for (int i = 0; i < poids.length; i++) {
if (resultat < poids[i])
return i;
resultat -= poids[i];
}
return -1;
}
public int[] auHasards(Random r,int qcount){
if(qcount>questions.length){
int[] results = new int[qcount];
for (int i = 0; i < qcount; i++) {
results[i] = this.auHasard(r);
}
return results;
}
int[] results = new int[qcount];
double[] pds = Arrays.copyOf(poids,poids.length);
Arrays.fill(results,-1);
double currentSomme = somme;
for(int i = 0;i<qcount;i++){
double resultat = r.nextDouble() * currentSomme;
int j = 0;
for (; j < poids.length; j++) {
if (resultat < pds[j])
break;
resultat -= pds[j];
}
currentSomme -= pds[j];
pds[j] = 0;
results[i] = j;
}
return results;
}
public String getQuestion(int i) {
return questions[i];
}
public void save(OutputStream os) throws IOException {
BufferedWriter ps = new BufferedWriter(new OutputStreamWriter(os));
for (int i = 0; i < questions.length; i++)
ps.write(toDouble(poids[i]) + " " + questions[i] + "\n");
ps.flush();
}
public static JeuDeQuestions read(InputStream is) throws IOException {
BufferedReader rs = new BufferedReader(new InputStreamReader(is));
List<String> questions = new ArrayList<>();
List<Double> poids = new ArrayList<>();
String pr;
while ((pr = rs.readLine()) != null) {
String[] splitted = pr.split(" ");
double pds = 1;
String qstons = pr;
if(splitted.length>0){
try{
pds = Double.parseDouble(splitted[0]);
qstons = pr.substring(splitted[0].length() + 1);}
catch(NumberFormatException e){}
}
poids.add(pds);
questions.add(qstons);
}
String[] questionsA = new String[questions.size()];
questions.toArray(questionsA);
double[] poidsA = doubleListToDoubleArray(poids);
return new JeuDeQuestions(questionsA, poidsA);
}
public int questionCount() {
return questions.length;
}
public String[] getQuestions() {
return questions;
}
public String toDouble(double d){
if(Math.round(d)==d)
return Integer.toString((int)d);
return Double.toString(d);
}
@Override
@NonNull
public String toString() {
return "JeuDeQuestions{" +
"questions=" + Arrays.toString(questions) +
", poids=" + Arrays.toString(poids) +
'}';
}
public static int[] integerListToIntArray(List<Integer> l) {
int[] out = new int[l.size()];
Iterator<Integer> it = l.iterator();
for (int i = 0; i < out.length; i++)
out[i] = it.next();
return out;
}
public static double[] doubleListToDoubleArray(List<Double> l) {
double[] out = new double[l.size()];
Iterator<Double> it = l.iterator();
for (int i = 0; i < out.length; i++)
out[i] = it.next();
return out;
}
private static Pattern JEUNAME_PATTERN = Pattern.compile("^[0-9a-zA-Z._-]+$");
public static String JEUNAME_CHAR_PATTERN ="[^0-9a-zA-Z._-]+";
public void sauvegarderJeu(Context ctx,String nom){
if(!JEUNAME_PATTERN.matcher(nom).matches()){
Toast.makeText(ctx,R.string.nomInvalide,Toast.LENGTH_LONG).show();
throw new IllegalArgumentException("Le nom est invalide : "+nom);
}
try {
File ffolder = new File(ctx.getApplicationContext().getFilesDir(), jeuxSubFolder);
ffolder.mkdir();
File toSaveTo = new File(ffolder, nom + ".jeuDeQuestions");
toSaveTo.delete();
FileOutputStream fos = new FileOutputStream(toSaveTo);
this.save(fos);
fos.close();
}catch (IOException err){
Log.e("sauvegarderJeu","Le jeu n'a as pu être sauvegardé",err);
}
}
public static boolean detruireJeu(Context ctx,String nom){
File ffolder = new File(ctx.getApplicationContext().getFilesDir(), jeuxSubFolder);
File toDelete = new File(ffolder, nom + ".jeuDeQuestions");
if(!toDelete.exists())return false;
return toDelete.delete();
}
public static JeuDeQuestions lireJeu(Context ctx,String nom){
try {
File ffolder = new File(ctx.getApplicationContext().getFilesDir(), jeuxSubFolder);
File toRead = new File(ffolder, nom + ".jeuDeQuestions");
if(!toRead.exists())throw new IllegalArgumentException("Le jeu n'existe pas : "+nom);
FileInputStream fis = new FileInputStream(toRead);
JeuDeQuestions jeu = JeuDeQuestions.read(fis);
fis.close();
if(jeu.questionCount()==0) {
jeu.questions = new String[]{ctx.getString(R.string.questionParDéfaut)};
jeu.poids = new double[]{1};
}
return jeu;
}catch (IOException err){
Log.e("lireJeu","Le jeu n'a as pu être lu",err);
}
return null;
}
public static void sauvegarderTousLesJeux(Context ctx,Map<String,JeuDeQuestions> jeuxDeQuestions){
for (Map.Entry<String,JeuDeQuestions> entry : jeuxDeQuestions.entrySet()){
entry.getValue().sauvegarderJeu(ctx,entry.getKey());
}
}
public static Map<String,JeuDeQuestions> lireTousLesJeux(Context ctx){
Map<String,JeuDeQuestions> output = new HashMap<>();
for(String nom : nomDesJeuxDispos(ctx)){
output.put(nom,lireJeu(ctx,nom));
}
return output;
}
public static void getAndSetDefaultQuestions(Context ctx){
try {
InputStream fis = ctx.getResources().openRawResource(R.raw.default_infortune);
JeuDeQuestions jeu = JeuDeQuestions.read(fis);
fis.close();
jeu.sauvegarderJeu(ctx,ctx.getString(R.string.jeuParDefaut));
Log.i("DefaultJeu","Le jeu par défaut a été créé !!!");
}catch (IOException err){
Log.e("defaultJeu","Le jeu n'a as pu être lu",err);
}
}
public static final String DOTTED_EXTENSION = ".jeuDeQuestions";
public static Set<String> nomDesJeuxDispos(Context ctx) {
File ffolder = new File(ctx.getApplicationContext().getFilesDir(), jeuxSubFolder);
String[] nomsA = ffolder.list((dir, name) -> name.endsWith(DOTTED_EXTENSION));
Log.i("JeuxDispos",Arrays.toString(nomsA));
if(nomsA==null)return new HashSet<>();
return Arrays.stream(nomsA).map(s->s.substring(0,s.length()-DOTTED_EXTENSION.length())).collect(Collectors.toSet());
}
}

View File

@ -0,0 +1,126 @@
package com.bernard.larouedelinfortune;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.Spinner;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
Button spinbutton;
GridLayout exosGrid;
Spinner jeuSelector;
ArrayAdapter<String> jeuSelectorAdapter;
BanditManchotAnimator animator;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinbutton = findViewById(R.id.spinButton);
exosGrid = findViewById(R.id.exosGrid);
jeuSelector = findViewById(R.id.jeuSeletor);
jeuSelector.setOnItemSelectedListener(this);
Set<String> nomDesJeuxDispos = JeuDeQuestions.nomDesJeuxDispos(this);
if(nomDesJeuxDispos.isEmpty())
JeuDeQuestions.getAndSetDefaultQuestions(this);
nomDesJeuxDispos = JeuDeQuestions.nomDesJeuxDispos(this);
jeuSelectorAdapter = new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item,new ArrayList<>());
jeuSelector.setAdapter(jeuSelectorAdapter);
String name = nomDesJeuxDispos.stream().findAny().get();
JeuDeQuestions jeu = JeuDeQuestions.lireJeu(this,name);
Log.i("MainActivity","Le jeu qui vient d'être chargé : "+name+"->"+jeu);
animator = new BanditManchotAnimator(exosGrid,this,Integer.parseInt(getString(R.string.questionCount)),jeu,spinbutton);
}
@Override
protected void onResume() {
super.onResume();
Set<String> nomDesJeuxDispos = JeuDeQuestions.nomDesJeuxDispos(this);
if(nomDesJeuxDispos.isEmpty())
JeuDeQuestions.getAndSetDefaultQuestions(this);
nomDesJeuxDispos = JeuDeQuestions.nomDesJeuxDispos(this);
updateJeux(nomDesJeuxDispos);
}
public void updateJeux(Set<String> jeuxDeQuestion){
List<String> jeuxNamesAlphabetically = new ArrayList<>(jeuxDeQuestion);
jeuxNamesAlphabetically.sort(Comparator.naturalOrder());
jeuSelectorAdapter.clear();
jeuSelectorAdapter.addAll(jeuxNamesAlphabetically);
jeuSelectorAdapter.notifyDataSetChanged();
if(jeuSelector.getSelectedItem()!=null)
updateJeu(jeuSelector.getSelectedItem().toString());
}
public void updateJeu(String name){
animator.changeJeu(JeuDeQuestions.lireJeu(this,name));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_principal,menu);
return true;
}
public static final String EXTRA_SELECTED_JEU = "extra.selectedJeu";
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.editQuestions:
Intent intent = new Intent(this,EditExosActivity.class);
jeuSelector.getSelectedItem();
intent.putExtra(EXTRA_SELECTED_JEU,jeuSelector.getSelectedItem().toString());
startActivity(intent);
return true;
case R.id.refresh:
updateJeux(JeuDeQuestions.nomDesJeuxDispos(this));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(parent == jeuSelector){
updateJeu(jeuSelector.getSelectedItem().toString());
}
}
}

View File

@ -0,0 +1,150 @@
package com.bernard.larouedelinfortune;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
public class QuestionsView extends View {
String[] questions;
Bitmap[] images;
int position = 100;
int width = 0;
Paint bmpPainter = new Paint(Paint.ANTI_ALIAS_FLAG);
AttributeSet theseAttrs;
public QuestionsView(Context ctx,AttributeSet attrs){
super(ctx,attrs);
Log.d("QuestionView","I have been born");
theseAttrs = attrs;
}
public void setQuestions(String[] questions){
this.questions = questions;
this.position = (int)(Math.random()*questions.length)*width;
this.images = new Bitmap[questions.length];
updateQuestions();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
updateQuestions();
invalidate();
requestLayout();
}
private Rect rectSrc0 = new Rect(0,0,0,0),
rectSrc1 = new Rect(0,0,0,0),
rectDst0 = new Rect(0,0,0,0),
rectDst1 = new Rect(0,0,0,0);
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec,heightMeasureSpec);
int askedWidth = MeasureSpec.getSize(widthMeasureSpec);
int askedHeight = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(askedWidth,askedHeight/3);
//Log.d("QuestionView","Requesting questions to "+MeasureSpec.toString(widthMeasureSpec)+":"+MeasureSpec.toString(heightMeasureSpec)+" but set to "+width);
}
public void updateQuestions(){
width = getWidth();
Log.d("QuestionView","Updating questions to width "+width);
if(width==0)return;
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0; i < questions.length; i++) {
//MathView mv = new MathView(getContext(),theseAttrs);
//MathView mv = findViewById(R.id.questionElement);
//KatexView mv = inflater.inflate(R.layout.question_element,(ViewGroup)this.getRootView(),false).findViewById(R.id.questionElement);
//MathView mv = new MathView(getContext(),theseAttrs);
//mv.setText(questions[i]);
//mv.setTextColor(android.R.color.darker_gray);
//mv.setVisibility(VISIBLE);
TextView mv = new TextView(getContext(),theseAttrs);
mv.setTextSize(20);
mv.setGravity(Gravity.CENTER);
mv.setText(questions[i]);
//mv.setEngine(MathView.Engine.KATEX);
//mv.setBackgroundColor(getResources().getColor(android.R.color.darker_gray));
/*
TeXFormula formula = new TeXFormula(questions[i]);
TeXIcon icon = formula.new TeXIconBuilder().setStyle(TeXConstants.STYLE_DISPLAY).setSize(20).build();
icon.setInsets(Insets.of(5,5,5,5));
*/
mv.measure(MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY),MeasureSpec.makeMeasureSpec(getHeight(),MeasureSpec.EXACTLY));
mv.layout(0,0,mv.getMeasuredWidth(),mv.getMeasuredHeight());
Bitmap bmp = Bitmap.createBitmap(width,getHeight(), Bitmap.Config.ARGB_8888);
Canvas cvas = new Canvas(bmp);
Drawable background = mv.getBackground();
if(background!=null)background.draw(cvas);
mv.layout(0,0,width,getHeight());
mv.draw(cvas);
cvas.save();
images[i] = bmp;
//Log.d("QuestionView","Le bitmap chargé : "+bmp.getWidth()+"*"+bmp.getHeight());
}
rectSrc0.right = rectDst1.right = width;
rectSrc0.bottom = rectSrc1.bottom = rectDst0.bottom = rectDst1.bottom = getHeight();
invalidate();
requestLayout();
}
@Override
protected void onDraw(Canvas canvas) {
if(width != getWidth())
updateQuestions();
//super.onDraw(canvas);
//Log.d("QuestionView","Dessination sur "+width+"*"+getHeight()+" à "+getX()+":"+getY()+" de "+ Arrays.toString(images));
//canvas.drawCircle(50,50,50,bmpPainter);
int position = this.position%(images.length*width);
int bmp0 = position/width;
int bmp1 = (bmp0+1)%images.length;
rectSrc0.left = position%width;
rectDst0.right = width - position%width;
rectSrc1.right = position%width;
rectDst1.left = width - position%width;
//Log.d("QuestionView","TropBien:"+position+"->"+rectSrc0+rectDst0+rectSrc1+rectDst1);
bmpPainter.setColor(getResources().getColor(android.R.color.holo_blue_dark));
//canvas.drawRect(rectDst0,bmpPainter);
bmpPainter.setColor(getResources().getColor(android.R.color.holo_green_dark));
//canvas.drawRect(rectDst1,bmpPainter);
bmpPainter.setColor(getResources().getColor(android.R.color.black));
bmpPainter.setStyle(Paint.Style.STROKE);
canvas.drawRect(rectDst0,bmpPainter);
canvas.drawRect(rectDst1,bmpPainter);
bmpPainter.setColor(getResources().getColor(android.R.color.darker_gray));
bmpPainter.setStyle(Paint.Style.FILL);
bmpPainter.setAntiAlias(true);
canvas.drawBitmap(images[bmp0],rectSrc0,rectDst0,null);
canvas.drawBitmap(images[bmp1],rectSrc1,rectDst1,null);
}
public int getQCount() {
return questions.length;
}
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".EditExosActivity">
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/jeuSeletor"
android:layout_alignParentTop="true"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/jeuSeletor"
android:id="@+id/renameButton"
android:text="@string/renameJeu"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/renameButton"
android:layout_alignParentBottom="true"
android:id="@+id/exoText"
android:inputType="textMultiLine"/>
</RelativeLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".MainActivity">
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="@+id/jeuSeletor"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/spinButton"
android:layout_alignParentBottom="true"
android:text="@string/spinTheWheel"/>
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/exosGrid"
android:layout_below="@id/jeuSeletor"
android:id="@+id/exosGrid"
android:columnCount="1"
android:rowCount="3">
</GridLayout>
</RelativeLayout>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<io.github.kexanie.library.MathView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/questionElement"/>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<com.bernard.larouedelinfortune.QuestionsView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--
<io.github.kexanie.library.MathView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/questionElement" />-->
</com.bernard.larouedelinfortune.QuestionsView>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/newQuestion"
android:title="@string/newJeu"/>
<item android:id="@+id/refresh"
android:title="@string/refresh"/>
</menu>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/editQuestions"
android:title="@string/editQuestions"/>
<item android:id="@+id/refresh"
android:title="@string/refresh"/>
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,137 @@
1 Def théorique et pratique injectif, surjectif, bijectif
1 Coefs binômiaux, Formule du triangle de Pascal, Newton, somme des k, k^2,k^3
1 Inégalités classiques sur sin,exp,ln
1 Trigonométrie
1 Montrer qu'une famille est libre, liée, génératrice
1 Matrices d'endomorphismes et de changement de base
1 Trace
0.4 Déterminant, la totale
1 DLs
1 Formule de Stirling
1 Critère de la borne sup
1 Théorème de Bolzano-Weierstraß
1 Suites arithmético-géométriques
1 Suites réccurentes linéaires d'ordre 2
1 Continuité et limite séquentielle
1 Théorème des valeurs intermédiaires
1 Def convergence uniforme + Heine
1 Dérivée fog et fxg et Leibniz
1 Accroissements finis, Taylor reste intégral
1 IPP et changement de variable
1 Sommes de Riemann
1 EDL1, variation de la constante
1 EDL2cc
1 2 defs de racine d'ordre n
1 Bézout et Gauss polynômes
1 Polynômes interpolateurs de Lagrange
1 Éléments simples de R et C
1 Intégration de la relation de domination
1 Intégration de la relation d'équivalence
1 IPP et changement de variable
1 Intégrale sur R+ de sin(x)/x
1 Def Groupe, Algèbre, monogène, cyclique, ordre d'un élément
1 Def Anneau, Corps, idéal
1 Def Idéaux, ceux de Z et K[X]
1 3 defs du PGCD
1 3 defs du PPCM
1 Bézout et Gauss
1 "Détermination des coéfficients de Bézout: Algo d'Euclide"
1 Théorème chinois
0.3 Indicatrice d'Euler
1 Def familles libre et génératrice + propriétés
1 Def somme directe + théorème
1 Théorèmes de Grassmann et du rang
1 Théorème noyau-image
1 Trace
1 Déterminant- développement et grosse formule
1 PGCD dans R[X]
1 Bézout et Gauss dans R[X]
1 Polynômes irréductibles de R et C et def
1 Polynômes annulateurs
1 Diagonalisation
1 Triangulisation
1 Lemme du Noyau
1 uov=vou linéaires, pol. carac. de u scindé simple, montrez u,v admettent une base de diagonalisation commune
1 uov=vou linéaires, pol. carac. de u scindé, montrez u,v admettent une base de triangulisation commune
1 Montrez uov et vou ont le même polynôme caractéristique
1 Cauchy-Schwarz et Minkovski
1 Définition produit scalaire, norme et distance
1 Caractérisation des formes linéaires
1 Gram-Schmidt
1 Théorème des projections
1 Famille totale
1 Def et CNS orthogonale
1 Caractérisation des matrices orthogonales en dim<=3
1 Endomorphismes symétriques
1 Montrez {(u(x)|x) tq ||x||=1} = [min(Sp),max(Sp)] pour u symétrique
1 Def norme et distance, normes classiques
1 Montrer qu'une partie est ouverte
1 Montrer qu'une partie est fermée
1 Def adhérence, interieur, frontière, dense
1 Normes équivalentes (dev + eve)
1 Caractérisation séquentielle et def de limite
1 Caractérisation séquentielle et def de continuité
1 Continuité uniforme, lipschitzienne
1 Continuité des applications linéaires (et méthode pour bilinéaire)
1 Compacts
1 Connexe par arc
1 Convexe (def, 2 inégalités, CNS D1 et D2)
1 Def dérivée dans E, D(fxg) et D(fog)
1 Leibniz et produit
1 Taylor reste intégral
1 Sommes de Riemann
1 Théorème et inégalité des accroissements finis
1 Def dénombrable, stabilité par opération ensemblistes
1 Différencier les utilisations du symbole somme
1 Lien suite-série
1 Def convergence absolue et propriétés
1 Sommation de la relation de domination
1 Sommation de la relation d'équivalence
1 Règle de D'Alembert
1 Comparaison série/intégrale
1 Séries de Riemann
1 Critère des séries alternées + démo // Exo CCP
1 Famille sommable et somme (sur R+ puis R puis C)
1 Sommation par paquets (+ dessin)
1 Séries doubles
1 Produit de Cauchy
1 Série géométrique dans une algèbre (def et somme)
1 Série exponentielle dans une bonne algèbre (def et propriétés)
1 Différentes convergences de suites et de séries
1 2 théorèmes d'approximation uniforme
1 Convergence uniforme de fonctions bornées + démo // Exo CCP
1 Convergence uniforme de fonctions continues + démo // Exo CCP
1 Convergence uniforme et intégrale sur un intervalle + démo // Exo CCP
1 Théorème de la double limite (suites et séries)
1 Dérivation de séries de fonctions
1 Théorème de convergence dominée suites
1 Théorème de convergence dominée séries
1 Continuité des intégrales à paramètre
1 Limite des intégrales à paramètre
1 Les 2 Leibniz
1 Fonction gamma
1 Propriété fondamentale sur le rayon de convergence + Lemme d'Abel
1 Développement en séries entières
1 Dérivation et primitivations de séries entières
1 Séries entières classiques
1 Exp et binomial de matrices (méthodes)
0.4 Def Tribu, probabilité
1 Continuité croissante, décroissante
1 Def probabilité conditionelle
1 Probabilités totales + Bayes
1 Def indépendants + montrer (B)indep(A)=>(nonB)indep(A) + famille d'indépendants
0.2 Def et pté du wronksien
1 Méthode de réésolution des EDL1 puis 2
1 Def variable aléatoire et P(X=x)
1 Indépendance de variables aléatoires
1 Définition espérance et propriétés
1 Formule de transfer et inégalité de Markov
1 Def moment et variance d'une variable aléatoire
1 Inégalité de Bienaymé-Tchebychev et Covariance
1 Loi faible des grands nombres
1 Fonction génératrice
3 Loi, Espérance, Variance, Génératrice des lois usuelles
1 Différentielle, dérivées partielles
1 CNS C1 et Cinfini
1 Gradient, jacobienne
1 Schwarz

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">La roue de l\'Infortune</string>
<string name="alreadyDefaultJeu">The game %1$s already exists</string>
<string name="areYouSure">Are you sure ?</string>
<string name="cantSaveUnparsable">Cannot save! Your text is not valid</string>
<string name="editQuestions">Edit questions</string>
<string name="goFromAtoA">Fastest path from Clermont to Clermont is not moving at all</string>
<string name="jeuParDefaut">DefaultSet</string>
<string name="newJeu">New set</string>
<string name="nomInvalide">Your set name is not valid ! No spaces or strange characters !</string>
<string name="nouveauNom">New name</string>
<string name="questionParDéfaut">Trigonometry</string>
<string name="refresh">Refresh</string>
<string name="renameJeu">Rename this set</string>
<string name="spinTheWheel">Launch</string>
<string name="youMakLoseModifiedData">You may lose some data you wrote !</string>
<string name="youWannaSave">Save modifications ?</string>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_richard2_background">#20CB00</color>
</resources>

View File

@ -0,0 +1,19 @@
<resources>
<string name="app_name">La roue de l\'Infortune</string>
<string name="spinTheWheel">Lancer</string>
<string name="editQuestions">Éditer les questions</string>
<string name="newJeu">Créer un jeu</string>
<string name="refresh">Rafraîchir</string>
<string name="renameJeu">Renommer ce jeu</string>
<string name="jeuParDefaut">JeuParDefaut</string>
<string name="questionParDéfaut">Trigonométrie</string>
<string name="questionCount" translatable="false">3</string>
<string name="nomInvalide">Votre nom de jeu est invalide : pas d\'espace ou de caractères bizzares</string>
<string name="goFromAtoA">Le chemin le plus rapide de Clermont à Clermont est de ne pas bouger &#8230;</string>
<string name="cantSaveUnparsable">Impossible de sauvegarder, votre texte est invalide</string>
<string name="areYouSure">Vous êtes sur ?</string>
<string name="youMakLoseModifiedData">Vous riquez de perdre les données que vous avez modifiées</string>
<string name="youWannaSave">Voulez vous sauvegarder vos modifications ?</string>
<string name="alreadyDefaultJeu">Il y a dèjà un jeu appelé %1$s</string>
<string name="nouveauNom">Nouveau nom</string>
</resources>

View File

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

View File

@ -0,0 +1,11 @@
questions:
- "Trigonométrie":
-poids: 2
- "Définition d'un espace vectoriel"
- "Théorème fondamental sur les séries entières"
probabilitéBonus: 0.02
bonus:
- "20 minutes de questions de cours"
-poids: 0.2

27
build.gradle Normal file
View File

@ -0,0 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

20
gradle.properties Normal file
View File

@ -0,0 +1,20 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

2
settings.gradle Normal file
View File

@ -0,0 +1,2 @@
include ':app'
rootProject.name='LaRoueDeLInfortune'