Skip to content

Commit b1b15dd

Browse files
committed
Singleton de la classe Jeu
Suppression de tous les intents. Restructuration de l'arborescence
1 parent dfb4a66 commit b1b15dd

File tree

16 files changed

+161
-115
lines changed

16 files changed

+161
-115
lines changed

AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
android:name="com.example.tiptopformation2.Quizz"
3131
android:label="@string/title_activity_quizz" >
3232
</activity>
33+
<activity
34+
android:name="com.example.tiptopformation2.Testctivite"
35+
android:label="@string/title_activity_testctivite" >
36+
</activity>
3337
</application>
3438

3539
</manifest>

gen/com/example/tiptopformation2/R.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ public static final class menu {
4444
public static final int home=0x7f070000;
4545
public static final int quizz=0x7f070001;
4646
public static final int selectionner_level=0x7f070002;
47+
public static final int testctivite=0x7f070003;
4748
}
4849
public static final class string {
4950
public static final int action_settings=0x7f050001;
5051
public static final int app_name=0x7f050000;
5152
public static final int hello_world=0x7f050002;
5253
public static final int title_activity_quizz=0x7f050004;
5354
public static final int title_activity_selectionner_level=0x7f050003;
55+
public static final int title_activity_testctivite=0x7f050005;
5456
}
5557
public static final class style {
5658
/**

res/menu/testctivite.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2+
3+
<item
4+
android:id="@+id/action_settings"
5+
android:orderInCategory="100"
6+
android:showAsAction="never"
7+
android:title="@string/action_settings"/>
8+
9+
</menu>

res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<string name="hello_world">Hello world!</string>
77
<string name="title_activity_selectionner_level">SelectionnerLevel</string>
88
<string name="title_activity_quizz">Quizz</string>
9+
<string name="title_activity_testctivite">Testctivite</string>
910

1011
</resources>

src/Core/DangerousJeu.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Core/EXERCICES.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
public enum EXERCICES {
44

5-
SYNONYME, DANGEROUS, TRICHOIX;
5+
SYNONYME, SUPERCHOIX, TRICHOIX, MULTICHOIX;
66

77
public String toString() {
88
switch(this) {
99
case SYNONYME: return "Synonyme";
10-
case DANGEROUS: return "Dangerous";
10+
case SUPERCHOIX: return "SuperChoix";
1111
case TRICHOIX: return "TriChoix";
12+
case MULTICHOIX: return "MultiChoix";
1213
default: return "inconnu";
1314
}
1415
}

src/Core/Jeu.java

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,48 @@
33
import android.os.Parcel;
44
import android.os.Parcelable;
55

6-
public class Jeu implements Parcelable {
6+
7+
/*
8+
* Jeu est un Singleton. Cela évite d'utiliser des intents. Moins de code. Plus simple
9+
*/
10+
public class Jeu {
11+
12+
private static Jeu instance;
713
private User user;
14+
private THEMES themeChoisi;
15+
private int levelChoisi;
816
//private Quizz quizzCurrent;
917

10-
public Jeu (){
18+
19+
private Jeu (){
1120
user = new User();
1221
}
1322

23+
public static Jeu getInstance() {
24+
if (null == instance) { // Premier appel
25+
instance = new Jeu();
26+
}
27+
return instance;
28+
}
29+
30+
public THEMES getThemeChoisi() {
31+
return themeChoisi;
32+
}
33+
34+
public int getLevelChoisi() {
35+
return levelChoisi;
36+
}
37+
38+
public void setLevelChoisi(int levelChoisi) {
39+
this.levelChoisi = levelChoisi;
40+
}
41+
42+
public void setThemeChoisi(THEMES themeChoisi) {
43+
this.themeChoisi = themeChoisi;
44+
}
45+
46+
47+
1448
public User getUser() {
1549
return user;
1650
}
@@ -20,16 +54,8 @@ public int getLevelByTheme (THEMES theme){
2054
return user.getLevelByTheme(theme);
2155
}
2256

23-
@Override
24-
public int describeContents() {
25-
// TODO Auto-generated method stub
26-
return 0;
27-
}
28-
29-
@Override
30-
public void writeToParcel(Parcel dest, int flags) {
31-
// TODO Auto-generated method stub
32-
33-
}
3457

58+
59+
60+
3561
}

src/Core/TriChoixJeu.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Exercices/MultiChoix.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package Exercices;
2+
3+
public class MultiChoix extends QuestionReponse {
4+
5+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package Core;
1+
package Exercices;
22

33
import android.content.res.Resources.Theme;
44

0 commit comments

Comments
 (0)