Bladeren bron

modifs mineures

François Gautrais 7 jaren geleden
bovenliggende
commit
92bb81e162
40 gewijzigde bestanden met toevoegingen van 1265 en 238 verwijderingen
  1. 4 0
      app/src/main/AndroidManifest.xml
  2. 12 12
      app/src/main/assets/game_medium
  3. 328 0
      app/src/main/assets/game_medium2
  4. 166 0
      app/src/main/java/app/mar/activities/BombActivity.java
  5. 4 1
      app/src/main/java/app/mar/activities/ChallengeDriver.java
  6. 15 12
      app/src/main/java/app/mar/activities/ChallengeFragment.java
  7. 5 1
      app/src/main/java/app/mar/activities/CreditsActivity.java
  8. 66 18
      app/src/main/java/app/mar/activities/HostActivity.java
  9. 1 0
      app/src/main/java/app/mar/activities/ImageViewerActivity.java
  10. 2 0
      app/src/main/java/app/mar/activities/MediaViewerAcitvity.java
  11. 1 1
      app/src/main/java/app/mar/activities/ModelViewerActivity.java
  12. 37 3
      app/src/main/java/app/mar/activities/PermissionActivity.java
  13. 17 10
      app/src/main/java/app/mar/activities/QRCodeFragment.java
  14. 2 0
      app/src/main/java/app/mar/activities/ResourceListActivity.java
  15. 1 0
      app/src/main/java/app/mar/activities/TestVideoActivity.java
  16. 16 3
      app/src/main/java/app/mar/game/Bomb.java
  17. 2 2
      app/src/main/java/app/mar/game/Event.java
  18. 17 9
      app/src/main/java/app/mar/game/Game.java
  19. 3 1
      app/src/main/java/app/mar/game/QRCodeReturn.java
  20. 7 1
      app/src/main/java/app/mar/game/Resource.java
  21. 2 0
      app/src/main/java/app/mar/game/ResourceManager.java
  22. 3 1
      app/src/main/java/app/mar/game/challenges/Indice.java
  23. 0 42
      app/src/main/java/app/mar/game/scheduler/EndTask.java
  24. 1 1
      app/src/main/java/app/mar/game/scheduler/EventTask.java
  25. 44 6
      app/src/main/java/app/mar/game/scheduler/Scheduler.java
  26. 51 0
      app/src/main/java/app/mar/game/scheduler/SpecialTask.java
  27. 2 2
      app/src/main/java/app/mar/game/scheduler/Task.java
  28. 1 1
      app/src/main/java/app/mar/ui/ResourceArrayAdapter.java
  29. 11 1
      app/src/main/java/app/mar/utils/AndroidResources.java
  30. 288 0
      app/src/main/res/layout/activity_bomb.xml
  31. 2 1
      app/src/main/res/layout/activity_host.xml
  32. 0 1
      app/src/main/res/layout/activity_media.xml
  33. 1 2
      app/src/main/res/layout/activity_resource_list.xml
  34. 8 10
      app/src/main/res/layout/activity_test_video.xml
  35. 23 26
      app/src/main/res/layout/activity_viewer.xml
  36. 16 8
      app/src/main/res/layout/fragment_qcm.xml
  37. 36 21
      app/src/main/res/layout/fragment_qrcode.xml
  38. 68 41
      app/src/main/res/layout/fragment_question.xml
  39. 1 0
      app/src/main/res/values/dimens.xml
  40. 1 0
      app/src/main/res/values/strings.xml

+ 4 - 0
app/src/main/AndroidManifest.xml

@@ -63,6 +63,10 @@
         <activity
             android:name=".TestVideoActivity"
             android:label="@string/title_activity_test_video"
+            android:theme="@style/AppTheme.NoActionBar" />
+        <activity
+            android:name=".BombActivity"
+            android:label="@string/title_activity_bomb"
             android:theme="@style/AppTheme.NoActionBar"></activity>
     </application>
 

+ 12 - 12
app/src/main/assets/game_medium

@@ -25,12 +25,12 @@
 					{
 						"type" : "text",
 						"text" : "Entre le 0 et le 2",
-						"penality": 1
+						"penality": 5
 					},
 					{
 						"type" : "text",
 						"text" : "sqrt(x) = x",
-						 "penality": 5
+						 "penality": 4
 					}
 				],
 				"area" : {
@@ -96,12 +96,12 @@
                          {
                              "type" : "text",
                              "text" : "Un italien",
-                                "penality": 1
+                                "penality": 5
                          },
                          {
                              "type" : "text",
                              "text" : "Un vieu !",
-                                 "penality": 1
+                                 "penality": 5
                          }
                      ],
 					 "penality": 3,
@@ -120,12 +120,12 @@
                          {
                              "type" : "text",
                              "text" : "Il a été inventé par Linus Torvalds",
-                                "penality": 1
+                                "penality": 4
                          },
                          {
                              "type" : "text",
                              "text" : "Il est de la famille des UNIX",
-                                 "penality": 1
+                                 "penality": 5
                          }
                      ],
 					 "penality": 3,
@@ -136,9 +136,9 @@
                     "name" : "RA",
                     "question" : "Qu'est ce que la réalité augmentée ?",
                     "answer" : "Une technologie qui permet d'ajouter virtuellement des éléments à la réalité",
-                    "choices" : ["Une technologie qui permet d'ajouter virtuellement des éléments à la réalité", 
-								"Des jeux vidéos sur PC ou consoles qui sont très réalistes", 
-								"Une technique de médium", 
+                    "choices" : ["Une technologie qui permet d'ajouter virtuellement des éléments à la réalité",
+								"Des jeux vidéos sur PC ou consoles qui sont très réalistes",
+								"Une technique de médium",
 								"Une Fake News"],
                     "good_message" : "Bien joué !",
                     "bad_message" : "T'es nul !",
@@ -158,9 +158,9 @@
                     "name" : "Question conne",
                     "question" : "Combien fait 10 / (10-10) ?",
                     "answer" : "C'est impossible",
-                    "choices" : ["10", 
-								"1", 
-								"C'est impossible", 
+                    "choices" : ["10",
+								"1",
+								"C'est impossible",
 								"0"],
                     "good_message" : "Bien joué !",
                     "bad_message" : "T'es nul !",

+ 328 - 0
app/src/main/assets/game_medium2

@@ -0,0 +1,328 @@
+{
+    "password" : "12345678",
+    "max_time" : 30,
+	"stages" : [{
+	"name" : "Intro",
+	"challenges" : [],
+	"resources" : ["intro"],
+	"event_end" : { "method" : "armBomb" }
+},
+{
+	"name" : "QrCode",
+	"challenges" :
+		[
+			{
+				"type" : "QRCodeGeoTreasure",
+				"name" : "A trouver 0",
+				"bad_message" : "Essaye encore",
+				"qr_value" : "1",
+				"resource" : "bib",
+				"indices" : [
+					{
+						"type" : "geo",
+						"penality": 1
+					},
+					{
+						"type" : "text",
+						"text" : "Entre le 0 et le 2",
+						"penality": 5
+					},
+					{
+						"type" : "text",
+						"text" : "sqrt(x) = x",
+						 "penality": 4
+					}
+				],
+				"area" : {
+					"coordinates": [
+							[
+							  0.1493293046951294,
+							  45.62988696308149
+							],
+							[
+							  0.14950096607208252,
+							  45.62975941918258
+							],
+							[
+							  0.1496753096580505,
+							  45.629898216940994
+							],
+							[
+							  0.14950096607208252,
+							  45.63003888999412
+							],
+							[
+							  0.14934271574020386,
+							  45.63002951180155
+							],
+							[
+							  0.1493293046951294,
+							  45.62988696308149
+							]
+						  ],
+					"name" : "a",
+					"point" :
+						{
+							"angle" : 180.0,
+							"coordinates" :
+							[
+							  0.14950096607208252,
+							  45.629875709219725
+							],
+							"field" : 90.0,
+							"radius" : 100.0,
+							"useAngle" : false
+						}
+				}
+			}
+		],
+	"resources" : [],
+	"charIndex" : 0
+},
+{
+	"name" : "QrCode",
+	"challenges" :
+		[
+			{
+                    "type" : "QCM",
+                    "name" : "Joconde",
+                    "question" : "Qui a peint la Joconde ?",
+                    "answer" : "Léonard De Vinci",
+                    "choices" : ["Léonard De Vinci", "Jean Ferrat", "Patrick Timsit", "BHL"],
+                    "good_message" : "Bien joué !",
+                    "bad_message" : "T'es nul !",
+					"resource" : "question",
+                     "indices" : [
+                         {
+                             "type" : "text",
+                             "text" : "Un italien",
+                                "penality": 5
+                         },
+                         {
+                             "type" : "text",
+                             "text" : "Un vieu !",
+                                 "penality": 5
+                         }
+                     ],
+					 "penality": 3,
+                     "charIndex" : 1
+                 },
+                 {
+                     "type" : "QCM",
+                    "name" : "OS",
+                    "question" : "Windows 7 et 10 sont des systèmes d'explploitation, parmi ces proposition lequel en est un ?",
+                    "answer" : "Linux",
+                    "choices" : ["Apple", "Linux", "Microsoft Word", "Mozilla La réponse D"],
+                    "good_message" : "Bien joué !",
+                    "bad_message" : "T'es nul !",
+					"resource" : "question",
+                     "indices" : [
+                         {
+                             "type" : "text",
+                             "text" : "Il a été inventé par Linus Torvalds",
+                                "penality": 4
+                         },
+                         {
+                             "type" : "text",
+                             "text" : "Il est de la famille des UNIX",
+                                 "penality": 5
+                         }
+                     ],
+					 "penality": 3,
+                     "charIndex" : 2
+                 },
+                 {
+                     "type" : "QCM",
+                    "name" : "RA",
+                    "question" : "Qu'est ce que la réalité augmentée ?",
+                    "answer" : "Une technologie qui permet d'ajouter virtuellement des éléments à la réalité",
+                    "choices" : ["Une technologie qui permet d'ajouter virtuellement des éléments à la réalité", 
+								"Des jeux vidéos sur PC ou consoles qui sont très réalistes", 
+								"Une technique de médium", 
+								"Une Fake News"],
+                    "good_message" : "Bien joué !",
+                    "bad_message" : "T'es nul !",
+					"resource" : "question",
+                     "indices" : [
+                         {
+                             "type" : "text",
+                             "text" : "Pokemon GO est une application en réalité augmentée",
+                                "penality": 1
+                         }
+                     ],
+					 "penality": 3,
+                     "charIndex" : 3
+                 },
+                 {
+                     "type" : "QCM",
+                    "name" : "Question conne",
+                    "question" : "Combien fait 10 / (10-10) ?",
+                    "answer" : "C'est impossible",
+                    "choices" : ["10", 
+								"1", 
+								"C'est impossible", 
+								"0"],
+                    "good_message" : "Bien joué !",
+                    "bad_message" : "T'es nul !",
+					"resource" : "question",
+                     "indices" : [
+                         {
+                             "type" : "text",
+                             "text" : "Ce calcul peut provoquer des erreurs sur les ordinateurs",
+                                "penality": 1
+                         }
+                     ],
+					 "penality": 3,
+                     "charIndex" : 4
+                 }
+		]
+},
+{
+	"name" : "QrCode",
+	"challenges" :
+		[
+			{
+				"type" : "QRCodeGeoTreasure",
+				"name" : "A trouver 1",
+				"bad_message" : "Essaye encore",
+				"qr_value" : "1",
+				"resource" : "mjc",
+				"indices" : [
+					{
+						"type" : "geo",
+						"penality": 1
+					},
+					{
+						"type" : "text",
+						"text" : "Entre le 0 et le 2",
+						"penality": 1
+					},
+					{
+						"type" : "text",
+						"text" : "sqrt(x) = x",
+						 "penality": 5
+					}
+				],
+				"area" : {
+					"coordinates": [
+						[
+						  0.1493293046951294,
+						  45.62988696308149
+						],
+						[
+						  0.14950096607208252,
+						  45.62975941918258
+						],
+						[
+						  0.1496753096580505,
+						  45.629898216940994
+						],
+						[
+						  0.14950096607208252,
+						  45.63003888999412
+						],
+						[
+						  0.14934271574020386,
+						  45.63002951180155
+						],
+						[
+						  0.1493293046951294,
+						  45.62988696308149
+						]
+					  ],
+					"name" : "a",
+					"point" :
+						{
+							"angle" : 180.0,
+							"coordinates" :
+							[
+								0.1493561267852783,
+								45.62970127407351
+							],
+							"field" : 90.0,
+							"radius" : 100.0,
+							"useAngle" : false
+						}
+				}
+			}
+		],
+	"resources" : ["milieu"],
+	"event_end" : { "method" : "setTimerTo", "args" : [15] },
+	"charIndex" : 5
+},
+{
+	"name" : "QrCode",
+	"challenges" :
+		[
+			{
+				"type" : "QRCodeGeoTreasure",
+				"name" : "A trouver 2",
+				"bad_message" : "Essaye encore",
+				"qr_value" : "1",
+				"resource" : "creche",
+				"indices" : [
+					{
+						"type" : "geo",
+						"penality": 1
+					},
+					{
+						"type" : "text",
+						"text" : "Entre le 0 et le 2",
+						"penality": 1
+					},
+					{
+						"type" : "text",
+						"text" : "sqrt(x) = x",
+						 "penality": 5
+					}
+				],
+				"area" : {
+					"coordinates": [
+						[
+						  0.14973163604736328,
+						  45.62980068341694
+						],
+						[
+						  0.14937490224838257,
+						  45.62957185409808
+						],
+						[
+						  0.14950096607208252,
+						  45.6294705686915
+						],
+						[
+						  0.14989793300628662,
+						  45.62966376106791
+						],
+						[
+						  0.14973163604736328,
+						  45.62980068341694
+						]
+					  ],
+					"name" : "a",
+					"point" :
+						{
+							"angle" : 180.0,
+							"coordinates" :
+							[
+							  0.14959752559661865,
+							  45.62963937760083
+							],
+							"field" : 90.0,
+							"radius" : 100.0,
+							"useAngle" : false
+						}
+				}
+			}
+		],
+	"resources" : ["fin"],
+	"charIndex" : 6
+}	],
+	"credits" : 
+	{
+		"text" : "Par Fran\u00e7ois Gautrais !",
+		"useHtml" : true
+	},
+	"map" : "/home/ptitcois/Documents/Angouleme/DemoRA/ressources/carte.png",
+	"name" : "game_medium"
+}

+ 166 - 0
app/src/main/java/app/mar/activities/BombActivity.java

@@ -0,0 +1,166 @@
+package app.mar.activities;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.design.widget.FloatingActionButton;
+import android.support.design.widget.Snackbar;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import app.mar.game.Bomb;
+import app.mar.game.Game;
+import app.mar.game.scheduler.SpecialTask;
+
+public class BombActivity extends AppCompatActivity {
+
+    protected Bomb mBomb;
+    protected Game mGame;
+    protected int mLength;
+    protected String mTyped;
+    protected TextView mTvPassword;
+    protected TextView mTvCar;
+
+
+    /**
+     * Si vrai, c'est que c'est la fin du jeu
+     * sinon c'est un essai sans avoir tout
+     */
+    protected boolean mIsEnd = false;
+
+    public static final int KEY_ERASE=-1;
+    public static final int KEY_OK=10;
+
+
+    private Timer mTimer;
+    private Runnable mTimerTick = new Runnable() {
+        public void run() {
+            if(!mGame.getBomb().hasExplosed())
+            {
+                mTvCar.setText(mGame.getBomb().getTimeBeforeBoom());
+            }else
+            {
+                mTvCar.setText("BOOM !");
+                mGame.getScheduler().clear();
+                mGame.getScheduler().append(SpecialTask.FINISHED_FAILED);
+                mTimer.cancel();
+                finish();
+            }
+        }
+    };
+
+    private void timerCallback()
+    {
+        this.runOnUiThread(mTimerTick);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_bomb);
+        mGame = Game.game();
+        mBomb = mGame.getBomb();
+        mLength=mBomb.getPasswordLength();
+        mTyped="";
+        mTvPassword= findViewById(R.id.tv_code);
+        mTvCar= findViewById(R.id.tv_car);
+
+
+        mTimer = new Timer();
+        mTimer.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                timerCallback();
+            }
+
+        }, 0, 1000);
+    }
+
+    protected String completeTypedString()
+    {
+        String t = "";
+        for(int i=0; i<mLength; i++)
+            t+=(i<mTyped.length())?mTyped.charAt(i):'#';
+
+        return t;
+    }
+
+    protected void updatePassword()
+    {
+        String str = completeTypedString();
+        mTvPassword.setText(str);
+    }
+
+    protected void erase()
+    {
+        if(mTyped.length()<1) return;
+        String nouveau = "";
+        for(int i=0; i<mTyped.length()-1; i++)
+            nouveau+=mTyped.charAt(i);
+        mTyped=nouveau;
+        updatePassword();
+    }
+
+    protected void valid()
+    {
+        if(mLength == mTyped.length())
+        {
+            if(mBomb.disarm(mTyped))
+            { //code bon
+                mGame.getScheduler().append(SpecialTask.FINISHED_SUCESS);
+                setResult(0);
+                finish();
+                Toast.makeText(this, "OK !", Toast.LENGTH_LONG).show();
+            }else
+            { //code mauvais
+                Toast.makeText(this, "Raté !", Toast.LENGTH_LONG).show();
+            }
+        }else
+        Toast.makeText(this, "Mauvaise longeur !", Toast.LENGTH_SHORT).show();
+    }
+
+    @Override
+    public void onBackPressed()
+    {
+        setResult(0);
+        finish();
+    }
+
+    protected void enterKey(char c)
+    {
+        if(mTyped.length()<mLength)
+            mTyped+=c;
+        updatePassword();
+    }
+
+
+    private void onButton(int k)
+    {
+        String cc ="0123456789";
+        if(k>=0 && k<=9) enterKey(cc.charAt(k));
+        else if(k==KEY_ERASE) erase();
+        else if(k==KEY_OK) valid();
+    }
+
+    public void onButton0(View v) {onButton(0);}
+    public void onButton1(View v) {onButton(1);}
+    public void onButton2(View v) {onButton(2);}
+    public void onButton3(View v) {onButton(3);}
+    public void onButton4(View v) {onButton(4);}
+    public void onButton5(View v) {onButton(5);}
+    public void onButton6(View v) {onButton(6);}
+    public void onButton7(View v) {onButton(7);}
+    public void onButton8(View v) {onButton(8);}
+    public void onButton9(View v) {onButton(9);}
+    public void onButtonEff(View v) {onButton(KEY_ERASE);}
+    public void onButtonOk(View v) {onButton(KEY_OK);}
+    public static final int REQUEST_CODE = 24;
+
+}
+
+

+ 4 - 1
app/src/main/java/app/mar/activities/ChallengeDriver.java

@@ -1,5 +1,6 @@
 package app.mar.activities;
 
+import android.app.Activity;
 import android.net.Uri;
 import android.view.View;
 
@@ -30,8 +31,10 @@ public interface ChallengeDriver extends ChallengeFragment.OnFragmentInteraction
 
     public void setFinished();
     public void setFailed();
+    public Activity getActivity();
 
 
-
+    public void load();
+    public void save();
     //TODO: Sauvegarde dans le prototype
 }

+ 15 - 12
app/src/main/java/app/mar/activities/ChallengeFragment.java

@@ -5,6 +5,7 @@ import android.app.Fragment;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Color;
+import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
@@ -14,6 +15,7 @@ import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.textclassifier.TextClassifier;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -95,6 +97,7 @@ public abstract class ChallengeFragment extends Fragment {
 
     public void resetUi()
     {
+        getDriver().setVisibilityView(R.id.btn_indice, View.VISIBLE);
         if(mUIGeoIndice!=null)
         {
             mUIGeoIndice.setVisibility(View.GONE);
@@ -110,6 +113,16 @@ public abstract class ChallengeFragment extends Fragment {
         onResetUi();
     }
 
+    protected TextView createTextView(Indice ind, int indInd)
+    {
+        TextView tv = new TextView(getActivity());
+        tv.setTextColor(0xff70e030);
+        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
+        tv.setText("  Indice "+(indInd+1)+" : "+((TextIndice) ind).getText());
+        tv.setTypeface(null, Typeface.BOLD);
+        return  tv;
+    }
+
     private void updateIndices()
     {
         ArrayList<Indice> inds = mChallenge.getIndices();
@@ -126,12 +139,7 @@ public abstract class ChallengeFragment extends Fragment {
                 startGeoUpdateTimer();
             }else if(ind instanceof TextIndice && mUITextIndices!=null)
             {
-                TextView tv = new TextView(getActivity());
-
-                tv.setTextColor(Color.WHITE);
-                tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
-                tv.setText("  Indice "+(indInd+1)+" : "+((TextIndice) ind).getText());
-                mUITextIndices.addView(tv);
+                mUITextIndices.addView(createTextView(ind, indInd));
             }
         }
         //si on arrive ici, ca veut dire que tous les indices ont ete découvert
@@ -162,10 +170,7 @@ public abstract class ChallengeFragment extends Fragment {
                     if(mUITextIndices!=null)
                     {
                         mUIGlobalIndice.setVisibility(View.VISIBLE);
-                        TextView tv = new TextView(getActivity());
-                        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
-                        tv.setText("  Indice "+(indInd+1)+" : "+((TextIndice) ind).getText());
-                        mUITextIndices.addView(tv);
+                        mUITextIndices.addView(createTextView(ind, indInd));
                         ind.discover();
                         return ind;
                     }
@@ -258,11 +263,9 @@ public abstract class ChallengeFragment extends Fragment {
 
 
     public interface OnFragmentInteractionListener {
-        // TODO: Update argument type and name
         void onFragmentInteraction(Uri uri);
     }
 
-    // TODO: Rename method, update argument and hook method into UI event
     public void onButtonPressed(Uri uri) {
         if (mListener != null) {
             mListener.onFragmentInteraction(uri);

+ 5 - 1
app/src/main/java/app/mar/activities/CreditsActivity.java

@@ -5,6 +5,7 @@ import android.os.Bundle;
 import android.text.Html;
 import android.widget.TextView;
 
+import app.mar.game.Game;
 import app.mar.utils.FontChangeCrawler;
 
 public class CreditsActivity extends AppCompatActivity {
@@ -49,6 +50,9 @@ public class CreditsActivity extends AppCompatActivity {
         {
             mText.setText(Html.fromHtml(CREDITS, Html.FROM_HTML_MODE_COMPACT));
         }
-
+        Game.erase(this);
+        Game.setGame(null);
     }
+
+    public static final int REQUEST_CODE = 23;
 }

+ 66 - 18
app/src/main/java/app/mar/activities/HostActivity.java

@@ -15,24 +15,28 @@ import java.util.Timer;
 import java.util.TimerTask;
 
 import app.mar.game.Area;
+import app.mar.game.Bomb;
 import app.mar.game.Game;
 import app.mar.game.Resource;
 import app.mar.game.Stage;
 import app.mar.game.challenges.Challenge;
 import app.mar.game.challenges.Indice;
+import app.mar.game.scheduler.ChallengeTask;
 import app.mar.game.scheduler.Scheduler;
+import app.mar.game.scheduler.SpecialTask;
+import app.mar.game.scheduler.Task;
 import app.mar.utils.AndroidResources;
 import app.mar.utils.L;
 
 
 public class HostActivity extends Activity implements ChallengeDriver{
+    public static final int REQUEST_CODE = 25;
     protected Game mGame;
     protected TextView mUITimeLeft;
     protected TextView mUICode;
     protected Button   mUIButtonVideos;
     protected Button   mUIButtonIndice;
     protected Button   mUIButtonValid;
-    private Timer mTimer;
 
     protected QCMFragment mQCMFragment;
     protected QRCodeFragment mQRCodeFragment;
@@ -42,6 +46,7 @@ public class HostActivity extends Activity implements ChallengeDriver{
 
     private static final int ACTIVITY_RESULT_RESOURCE_VIEWER_SCHEDULER = 2;
 
+    private Timer mTimer;
     private Runnable mTimerTick = new Runnable() {
         public void run() {
             if(!mGame.getBomb().hasExplosed())
@@ -88,13 +93,20 @@ public class HostActivity extends Activity implements ChallengeDriver{
         if(mGame.getCurrentStageIndex()<0) { //noueau jeu
             mGame.nextStage(this);
             mGame.getScheduler().schedule(this, mGame);
-        }else
+        }
+        else
         {
-            //TODO: Chargement de la sauvegarde
+            initFromLoad();
         }
+    }
 
+    public void initFromLoad()
+    {
 
-
+        Log.e("____SAVE____", "Load 0: Last"+mGame.getScheduler().getLastTask()+" --> "+mGame.getScheduler());
+        mGame.getScheduler().undo();
+        Log.e("____SAVE____", "Load 1: Last"+mGame.getScheduler().getLastTask()+" --> "+mGame.getScheduler());
+        mGame.getScheduler().schedule(this, mGame);
     }
 
     public   void setFragment(Challenge c)
@@ -149,6 +161,15 @@ public class HostActivity extends Activity implements ChallengeDriver{
     public void onFragmentInteraction(Uri uri) {}
 
 
+    public void onTryDisarm(View v)
+    {
+        Scheduler sched = mGame.getScheduler();
+        sched.undo();
+        sched.prepend(SpecialTask.BOMB);
+        sched.schedule(this, mGame);
+    }
+
+
     private void timerCallback()
     {
         this.runOnUiThread(mTimerTick);
@@ -193,6 +214,7 @@ public class HostActivity extends Activity implements ChallengeDriver{
 
             if(!mCurrentFragment.getChallenge().hasNextIndice())
                 mUIButtonIndice.setVisibility(View.INVISIBLE);
+            save();
         }
     }
 
@@ -227,25 +249,40 @@ public class HostActivity extends Activity implements ChallengeDriver{
             mGame.getBomb().addKnownCharacter(s.getCharIndex());
             updateCode();
         }else{
-            mGame.getScheduler().appendFinished();
+            Scheduler sched = mGame.getScheduler();
+            sched.undo();
+            sched.prepend(SpecialTask.BOMB);
+            sched.schedule(this, mGame);
         }
         return c;
     }
 
+
+
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if(requestCode == ACTIVITY_RESULT_RESOURCE_VIEWER_SCHEDULER)
+        int x =23;
+        x++;
+        switch (requestCode)
         {
-            mGame.getScheduler().schedule(this, mGame);
+            case CreditsActivity.REQUEST_CODE:
+            case ModelViewerActivity.REQUEST_CODE:
+            case MediaViewerAcitvity.REQUEST_CODE:
+            case TestVideoActivity.REQUEST_CODE:
+            case BombActivity.REQUEST_CODE:
+            case ImageViewerActivity.REQUEST_CODE:
+                mGame.getScheduler().schedule(this, mGame);
+                save();
+            break;
+
 
-            //TODO: Sauvegarde
         }
     }
 
     public void startResource(Resource r)
     {
         Intent intent = AndroidResources.getViewerIntent(this, r);
-        startActivityForResult(intent, ACTIVITY_RESULT_RESOURCE_VIEWER_SCHEDULER);
+        startActivityForResult(intent, AndroidResources.getViewerRequestCode(r));
     }
 
 
@@ -255,13 +292,8 @@ public class HostActivity extends Activity implements ChallengeDriver{
         updateCode();
         nextChallenge();
 
-        /////////////////
-
-        /////////////////
-
-        //TODO: Sauvegarde
-
         mGame.getScheduler().schedule(this, mGame);
+        save();
     }
 
     public Challenge currentChallenge() {
@@ -270,9 +302,7 @@ public class HostActivity extends Activity implements ChallengeDriver{
 
     public void setFinished()
     {
-        Intent intent = new Intent(this, CreditsActivity.class);
-        startActivity(intent);
-        finish();
+
     }
 
     public void setFailed()
@@ -282,6 +312,24 @@ public class HostActivity extends Activity implements ChallengeDriver{
         finish();
     }
 
+    @Override
+    public Activity getActivity() {
+        return this;
+    }
+
+    @Override
+    public void load() {
+        Log.e("____SAVE____", "Load: Last"+mGame.getScheduler().getLastTask()+" --> "+mGame.getScheduler());
+        mGame = Game.load(this);
+        Game.setGame(mGame);
+    }
+
+    @Override
+    public void save() {
+        Log.e("____SAVE____", "Save: Last"+mGame.getScheduler().getLastTask()+" --> "+mGame.getScheduler());
+        mGame.save(this);
+    }
+
     @Override
     public void startLocalisation() {
         mGame.newSensorManager(this);

+ 1 - 0
app/src/main/java/app/mar/activities/ImageViewerActivity.java

@@ -21,6 +21,7 @@ import uk.co.senab.photoview.PhotoViewAttacher;
 public class ImageViewerActivity extends AppCompatActivity {
 
 
+    public static final int REQUEST_CODE = 30;
     private Resource mResource;
     private ImageView mImageView;
     private Button mButton;

+ 2 - 0
app/src/main/java/app/mar/activities/MediaViewerAcitvity.java

@@ -21,6 +21,7 @@ import app.mar.game.Resource;
 public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlayer.OnSeekCompleteListener,
                                                                 MediaView.OnStartListener,
                                                                 SeekBar.OnSeekBarChangeListener {
+    public static final int REQUEST_CODE = 27;
     private Resource mResource;
     private Button mInfo;
     private TextView mTitle;
@@ -39,6 +40,7 @@ public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlaye
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+
         setContentView(R.layout.activity_media);
 
         mFrameLayout = (FrameLayout) findViewById(R.id.media_viewer);

+ 1 - 1
app/src/main/java/app/mar/activities/ModelViewerActivity.java

@@ -18,7 +18,7 @@ import min3d.vos.Light;
 import min3d.vos.LightType;
 
 public class ModelViewerActivity extends RendererActivity  implements View.OnTouchListener {
-
+    public static final int REQUEST_CODE = 29;
     private Resource mResource;
     private Button mInfo;
     private TextView mTitle;

+ 37 - 3
app/src/main/java/app/mar/activities/PermissionActivity.java

@@ -1,6 +1,9 @@
 package app.mar.activities;
 
 import android.Manifest;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.support.v4.app.ActivityCompat;
@@ -13,6 +16,7 @@ import android.widget.TextView;
 
 import java.util.ArrayList;
 
+import app.mar.game.Game;
 import app.mar.utils.files.FileManager;
 
 public class PermissionActivity extends AppCompatActivity {
@@ -76,6 +80,31 @@ public class PermissionActivity extends AppCompatActivity {
     }
 
 
+    public void askForReset()
+    {
+        final Activity t = this;
+        AlertDialog.Builder builder = new AlertDialog.Builder(this);
+        // Add the buttons
+                builder.setPositiveButton("Oui", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int id) {
+                        startGame();
+                    }
+                });
+                builder.setNegativeButton("Non", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int id) {
+                        Game.erase(t);
+                        Game.setGame(null);
+                        startGame();
+                    }
+                });
+        // Set other dialog properties
+        builder.setMessage("Voulez vous continuer la partie ?");
+
+        // Create the AlertDialog
+        AlertDialog dialog = builder.create();
+        dialog.show();
+    }
+
 
     public void onRequestPermissionsResult(int requestCode,
                                            String permissions[], int[] grantResults) {
@@ -96,13 +125,18 @@ public class PermissionActivity extends AppCompatActivity {
 
     }
 
+    public void startGame()
+    {
+        Intent intent = new Intent(this, MenuActivity.class);
+        startActivity(intent);
+        finish();
+    }
+
     public void onUnderstood(View v)
     {
         if(m_nPerm==0)
         {
-            Intent intent = new Intent(this, MenuActivity.class);
-            startActivity(intent);
-            finish();
+            askForReset();
         }
     }
 

+ 17 - 10
app/src/main/java/app/mar/activities/QRCodeFragment.java

@@ -112,7 +112,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
 
     @Override
     protected void onResetUi() {
-        state=STATE_PRESENTATION;
+        setPrimaryView();
         if(mUIGeoIndice2!=null)
         {
             mUIGeoIndice2.setVisibility(View.GONE);
@@ -249,11 +249,23 @@ public class QRCodeFragment extends ChallengeFragment  implements
 
     }
 
-    public boolean onBackPressed(){
-        if(state==STATE_PRESENTATION) return true;
+    public void setPrimaryView()
+    {
         state=STATE_PRESENTATION;
         vScanRoot.setVisibility(View.GONE);
         vPresRoot.setVisibility(View.VISIBLE);
+    }
+
+    public void setSecondaryView()
+    {
+        vScanRoot.setVisibility(View.VISIBLE);
+        vPresRoot.setVisibility(View.GONE);
+        state=STATE_RA;
+    }
+
+    public boolean onBackPressed(){
+        if(state==STATE_PRESENTATION) return true;
+        setPrimaryView();
         return false;
     }
 
@@ -278,10 +290,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
                 if(mUITextIndices2!=null)
                 {
                     mUIGlobalIndice2.setVisibility(View.VISIBLE);
-                    TextView tv = new TextView(getActivity());
-                    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
-                    tv.setText("  Indice "+(indInd+1)+" : "+((TextIndice) indice).getText());
-                    mUITextIndices2.addView(tv);
+                    mUITextIndices2.addView(createTextView(indice, indInd));
                 }
             }
         }
@@ -311,9 +320,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
     public void onClick(View v) {
         if(v==goToScan && state==STATE_PRESENTATION)
         {
-            vScanRoot.setVisibility(View.VISIBLE);
-            vPresRoot.setVisibility(View.GONE);
-            state=STATE_RA;
+            setSecondaryView();
         }
     }
 }

+ 2 - 0
app/src/main/java/app/mar/activities/ResourceListActivity.java

@@ -2,6 +2,7 @@ package app.mar.activities;
 
 import android.app.Activity;
 import android.os.Bundle;
+import android.util.Log;
 import android.widget.ListView;
 
 import java.util.ArrayList;
@@ -27,6 +28,7 @@ public class ResourceListActivity extends Activity {
             ArrayList<Object> obs = new ArrayList<Object>();
             for(int i = 0; i< resources.size(); i++) {
                 obs.add(resources.get(i));
+                Log.e("____ACT_DEBUG___", "-> '"+resources.get(i)+"'");
             }
             ResourceArrayAdapter aa;
             aa = new ResourceArrayAdapter(this, android.R.layout.simple_list_item_1, obs);

+ 1 - 0
app/src/main/java/app/mar/activities/TestVideoActivity.java

@@ -24,6 +24,7 @@ import app.mar.utils.FontChangeCrawler;
 public class TestVideoActivity extends AppCompatActivity implements MediaPlayer.OnSeekCompleteListener,
         MediaView.OnStartListener,
         SeekBar.OnSeekBarChangeListener {
+    public static final int REQUEST_CODE = 28;
     private Resource mResource;
     private Button mInfo;
     private TextView mTitle;

+ 16 - 3
app/src/main/java/app/mar/game/Bomb.java

@@ -39,10 +39,22 @@ public class Bomb implements Serializable{
         mStatus=BOMB_ARMED;
     }
 
-    public void disarm()
+    public int getPasswordLength()
     {
-        mDeadLine = (mDeadLine - Calendar.getInstance().getTimeInMillis()) / 1000;
-        mStatus=BOMB_DISARMED;
+        return mPassword.length();
+    }
+
+    public boolean disarm(String password)
+    {
+        if(password.toLowerCase().compareTo(mPassword.toLowerCase())==0)
+        {
+            mDeadLine = (mDeadLine - Calendar.getInstance().getTimeInMillis()) / 1000;
+            mStatus=BOMB_DISARMED;
+            return true;
+        }else {
+            return false;
+        }
+
     }
 
 
@@ -63,6 +75,7 @@ public class Bomb implements Serializable{
         return s;
     }
 
+
     public void addTime(int minutes)
     {
         mDeadLine+=minutes*60*1000;

+ 2 - 2
app/src/main/java/app/mar/game/Event.java

@@ -17,7 +17,7 @@ import app.mar.activities.ChallengeDriver;
 
 public class Event implements Serializable {
 
-    class EventParam
+    class EventParam implements  Serializable
     {
         static final int EVT_PARAM_INT = 0;
         static final int EVT_PARAM_FLOAT = 1;
@@ -51,7 +51,7 @@ public class Event implements Serializable {
     private String mMethod;
     private ArrayList<EventParam> mArgs = new ArrayList<EventParam>();
 
-    public class EventReturn{
+    public class EventReturn  implements  Serializable{
         public int code;
 
         public String message;

+ 17 - 9
app/src/main/java/app/mar/game/Game.java

@@ -21,6 +21,7 @@ import app.mar.game.challenges.Challenge;
 import app.mar.game.challenges.ChallengeReturn;
 import app.mar.game.challenges.Treasure;
 import app.mar.game.scheduler.Scheduler;
+import app.mar.game.scheduler.SpecialTask;
 import app.mar.utils.SensorsManager;
 import app.mar.utils.Settings;
 import app.mar.utils.files.JSONAssetsManager;
@@ -181,6 +182,7 @@ public class Game  implements Serializable {
             is.close();
             fis.close();
             obj.mIsLoad=true;
+            obj.mResources.setInstance();
             return obj;
         } catch (Exception e) {
             e.printStackTrace();
@@ -209,6 +211,12 @@ public class Game  implements Serializable {
         return b;
     }
 
+
+    public static void erase(Activity context)
+    {
+        context.deleteFile("data");
+    }
+
     public void onPause(Activity context)
     {
         save(context);
@@ -254,7 +262,7 @@ public class Game  implements Serializable {
      *
      * renvoie la liste des ressources sur lesquelles le joueur est présent
      * @return la liste des ressources sur lesquelles le joueur est présent
-
+     */
     public ArrayList<Resource> getResourcesNextToPlayer(Area a)
     {
         ArrayList<Resource> r = new ArrayList<Resource>();
@@ -264,18 +272,18 @@ public class Game  implements Serializable {
             r.add(findResource(rs.get(i)));
 
         return r;
-    }*/
+    }
 
     public Player getPlayer()
     {
         return mPlayer;
     }
 
-/*
+
     public void removeCached3DModels()
     {
         mResources.deleteAll3DModel();
-    }*/
+    }
 
     public void newSensorManager(Activity act)
     {
@@ -303,20 +311,20 @@ public class Game  implements Serializable {
     {
         return gGame;
     }
-/*
+
     public boolean hasResource(String name)
     {
         return mResources.contains(name);
-    }*/
+    }
     
-/*
+
     public ChallengeReturn getReturn() {
         return mLastReturn;
     }
 
     public void setReturn(ChallengeReturn mLastReturn) {
         this.mLastReturn = mLastReturn;
-    }*/
+    }
 
     public Stage nextStage(ChallengeDriver cd) {
         mCurrentStageIndex++;
@@ -351,7 +359,7 @@ public class Game  implements Serializable {
             }
             return mCurrentStage;
         }
-        mSched.appendFinished();
+        mSched.append(SpecialTask.FINISHED_SUCESS);
         return mCurrentStage=null;
     }
 

+ 3 - 1
app/src/main/java/app/mar/game/QRCodeReturn.java

@@ -1,6 +1,8 @@
 package app.mar.game;
 
-public class QRCodeReturn {
+import java.io.Serializable;
+
+public class QRCodeReturn  implements Serializable {
 
     public boolean status=false;
     public String  value="";

+ 7 - 1
app/src/main/java/app/mar/game/Resource.java

@@ -47,11 +47,17 @@ public class Resource implements Serializable {
             e.printStackTrace();
         }
 
+        try {
+            mTitle = obj.getString("title");
+        } catch (JSONException e) {
+        }
 
         try {
             mComment=obj.getString("comment");
+        } catch (JSONException e) {
+        }
+        try {
             mStage = obj.getInt("stage");
-            mTitle = obj.getString("title");
             isLoaded=true;
         } catch (JSONException e) {
         }

+ 2 - 0
app/src/main/java/app/mar/game/ResourceManager.java

@@ -23,6 +23,8 @@ public class ResourceManager implements Serializable{
         return sThis=new ResourceManager();
     }
 
+    public void setInstance(){ sThis=this;}
+
     public static ResourceManager getInstance()
     {
         if(sThis==null) return newInstance();

+ 3 - 1
app/src/main/java/app/mar/game/challenges/Indice.java

@@ -3,7 +3,9 @@ package app.mar.game.challenges;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-public abstract class Indice {
+import java.io.Serializable;
+
+public abstract class Indice implements Serializable {
     protected  int mPenality=-1;
     protected  boolean mIsDiscovered=false;
 

+ 0 - 42
app/src/main/java/app/mar/game/scheduler/EndTask.java

@@ -1,42 +0,0 @@
-package app.mar.game.scheduler;
-
-import app.mar.activities.ChallengeDriver;
-import app.mar.game.Game;
-
-public class EndTask extends Task {
-
-    public static final int STATE_FINISHED_SUCESS=1;
-    public static final int STATE_FINISHED_FAILED=2;
-    public static final int STATE_BOMB=3;
-
-    protected int mState;
-
-    public EndTask(int x) {
-        super(TASK_END);
-        mState=x;
-    }
-
-    private static final String[] gStrings={"STATE_NONE", "STATE_FINISHED_SUCESS",
-                                              "STATE_FINISHED_FAILED", "STATE_FINISHED_FAILED" };
-
-    public String toString()
-    {
-        return "[ End, "+gStrings[mState]+" ]";
-    }
-
-    @Override
-    public int exec(Scheduler s, ChallengeDriver cd, Game g) {
-        switch(mState)
-        {
-            case STATE_FINISHED_SUCESS:
-                cd.setFinished();
-                break;
-            case STATE_FINISHED_FAILED:
-                cd.setFailed();
-                break;
-            case STATE_BOMB:
-                break;
-        }
-        return TASK_END;
-    }
-}

+ 1 - 1
app/src/main/java/app/mar/game/scheduler/EventTask.java

@@ -22,7 +22,7 @@ public class EventTask extends Task {
     @Override
     public int exec(Scheduler s, ChallengeDriver cd, Game g) {
         mEvent.exec(cd, g);
-        //TODO: Sauvegarde
+        cd.save();
         return s.schedule(cd, g);
     }
 

+ 44 - 6
app/src/main/java/app/mar/game/scheduler/Scheduler.java

@@ -33,9 +33,10 @@ public class Scheduler implements Serializable {
 
     private void append(Task t)
     {
-        Log.e("___SCHEDULER_DEBUG___AP", "Ajout de : "+t.toString()+" : "+toString());
+        //Log.e("___SCHEDULER_DEBUG___AP", "Ajout de : "+t.toString()+" : "+toString());
         if(mStart==null) mStart=t;
         else mStart.enqueue(t);
+        Log.e("___", "ok");
     }
 
     public void append(Challenge c)
@@ -51,9 +52,9 @@ public class Scheduler implements Serializable {
 
     public void append(Resource c){ append(new ResourceTask(c));}
     public void append(Event c){ append(new EventTask(c));}
-    public void appendFinished(){ append(new EndTask(EndTask.STATE_FINISHED_SUCESS));}
-    public void appendFailed(){ append(new EndTask(EndTask.STATE_FINISHED_FAILED));}
-    public void appendBomb(){ append(new EndTask(EndTask.STATE_BOMB));}
+    public void append(int x){ append(new SpecialTask(x));}
+
+
     public void append(ArrayList<?> cc) {
         ArrayList<Object> c = (ArrayList<Object>) cc;
         for(int i=0; i<c.size(); i++)
@@ -63,6 +64,12 @@ public class Scheduler implements Serializable {
                 append(new EventTask((Event)c.get(i)));
     }
 
+    public void prepend(Resource r) { prepend(new ResourceTask(r));}
+    public void prepend(Event r) { prepend(new EventTask(r));}
+    public void prepend(int x){ prepend(new SpecialTask(x));}
+
+
+
     public int schedule(ChallengeDriver cd, Game g)
     {
         Task t = mStart;
@@ -70,9 +77,10 @@ public class Scheduler implements Serializable {
         if(t!=null)
         {
             mStart=mStart.next();
-            Log.e("___SCHEDULER_DEBUG___", "Executing task : "+t.toString());
+            mLastTask.mNext=null;
+            //Log.e("___SCHEDULER_DEBUG___", "Executing task : "+t.toString());
             return t.exec(this, cd, g);
-        }
+        }else  mLastTask.mNext=null;
         return Task.TASK_NONE;
     }
 
@@ -83,4 +91,34 @@ public class Scheduler implements Serializable {
             at.add(t);
         return at;
     }
+
+    public Task getLastTask() {
+        return mLastTask;
+    }
+
+    public Task getStart() {
+        return mStart;
+    }
+
+    private void prepend(Task t)
+    {
+        Task sec = mStart;
+        mStart=t;
+        mStart.end().mNext=sec;
+        Log.e("___", "ok");
+    }
+
+    public void clear()
+    {
+        mStart=null;
+    }
+
+    public void undo()
+    {
+        if(mLastTask!=null)
+        {
+            prepend(mLastTask);
+            mLastTask=null;
+        }
+    }
 }

+ 51 - 0
app/src/main/java/app/mar/game/scheduler/SpecialTask.java

@@ -0,0 +1,51 @@
+package app.mar.game.scheduler;
+
+import android.app.Activity;
+import android.content.Intent;
+
+import app.mar.activities.BombActivity;
+import app.mar.activities.ChallengeDriver;
+import app.mar.game.Game;
+
+public class SpecialTask extends Task {
+
+    public static final int FINISHED_SUCESS=1;
+    public static final int FINISHED_FAILED=2;
+    public static final int BOMB=3;
+
+    protected int mState;
+
+    public SpecialTask(int x) {
+        super(TASK_SPECIAL);
+        mState=x;
+    }
+
+    private static final String[] gStrings={"STATE_NONE", "STATE_FINISHED_SUCESS",
+                                              "STATE_FINISHED_FAILED", "STATE_FINISHED_FAILED" };
+
+    public String toString()
+    {
+        return "[ End, "+gStrings[mState]+" ]";
+    }
+
+    @Override
+    public int exec(Scheduler s, ChallengeDriver cd, Game g) {
+        switch(mState)
+        {
+            case FINISHED_SUCESS:
+                cd.setFinished();
+                break;
+            case FINISHED_FAILED:
+                cd.setFailed();
+                break;
+            case BOMB:
+            {
+                Activity act = cd.getActivity();
+                Intent in = new Intent(act, BombActivity.class);
+                act.startActivityForResult(in, BombActivity.REQUEST_CODE);
+            }
+            break;
+        }
+        return TASK_SPECIAL;
+    }
+}

+ 2 - 2
app/src/main/java/app/mar/game/scheduler/Task.java

@@ -10,7 +10,7 @@ public abstract class Task implements Serializable {
     public final static int TASK_CHALLENGE=1;
     public final static int TASK_EVENT=2;
     public final static int TASK_RESOURCE=3;
-    public final static int TASK_END=4;
+    public final static int TASK_SPECIAL=4;
 
     protected int mType;
     protected Task mNext=null;
@@ -46,5 +46,5 @@ public abstract class Task implements Serializable {
         return mNext;
     }
 
-
+    public int type() { return mType; }
 }

+ 1 - 1
app/src/main/java/app/mar/ui/ResourceArrayAdapter.java

@@ -36,7 +36,7 @@ public class ResourceArrayAdapter extends ArrayAdapter<Object> implements  Adapt
         TextView textView=(TextView) view.findViewById(android.R.id.text1);
 
             /*YOUR CHOICE OF COLOR*/
-        textView.setTextColor(Color.rgb(0x33, 0xb5, 0xe5));
+        //textView.setTextColor(Color.rgb(0x33, 0xb5, 0xe5));
 
         if(mList.get(position) instanceof String){
             textView.setTextSize(30);

+ 11 - 1
app/src/main/java/app/mar/utils/AndroidResources.java

@@ -49,7 +49,17 @@ public class AndroidResources {
         return null;
     }
 
-
+    public static int getViewerRequestCode( Resource re)
+    {
+        if(re.isAudio())
+            return MediaViewerAcitvity.REQUEST_CODE;
+        else if( re.isVideo())
+            return TestVideoActivity.REQUEST_CODE;
+        else if(re.is3D())
+            return ModelViewerActivity.REQUEST_CODE;
+        else
+            return ImageViewerActivity.REQUEST_CODE;
+    }
     public static Intent getViewerIntent(Context c, Resource re)
     {
         Intent intent =null ;

+ 288 - 0
app/src/main/res/layout/activity_bomb.xml

@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout 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:orientation="vertical"
+    tools:context="app.mar.activities.BombActivity">
+
+    <TextView
+        android:id="@+id/textView9"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="2dp"
+        android:gravity="center"
+        android:paddingTop="10sp"
+        android:text="Code de la bombe"
+        android:textSize="14sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/divider4"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/tv_bombe"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_marginStart="8dp"
+        android:layout_marginTop="2dp"
+        android:gravity="center"
+        android:paddingBottom="10sp"
+        android:text="_ _ _ _ _ _ _ "
+        android:textSize="14sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/divider4"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <View
+        android:id="@+id/divider"
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="?android:attr/listDivider" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <Space
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+
+        <TextView
+            android:id="@+id/tv_car"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_margin="15dp"
+            android:layout_marginEnd="8dp"
+            android:layout_marginLeft="30dp"
+            android:layout_marginRight="30dp"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="2dp"
+            android:gravity="right|center_vertical"
+            android:paddingLeft="10dp"
+            android:paddingRight="10dp"
+            android:password="false"
+            android:text="00 : 00 : 00"
+            android:textIsSelectable="false"
+            android:textSize="30sp"
+            android:textStyle="bold"
+            app:layout_constraintEnd_toStartOf="@+id/divider4"
+            app:layout_constraintHorizontal_bias="0.512"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/tv_code"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_margin="15dp"
+            android:layout_marginEnd="8dp"
+            android:layout_marginLeft="30dp"
+            android:layout_marginRight="30dp"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="2dp"
+            android:gravity="right|center_vertical"
+            android:paddingLeft="10dp"
+            android:paddingRight="10dp"
+            android:password="false"
+            android:text="#########"
+            android:textIsSelectable="false"
+            android:textSize="30sp"
+            android:textStyle="bold"
+            app:layout_constraintEnd_toStartOf="@+id/divider4"
+            app:layout_constraintHorizontal_bias="0.512"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <Space
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginBottom="100sp"
+            android:layout_marginLeft="30sp"
+            android:layout_marginRight="30sp"
+            android:layout_marginTop="30sp"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:paddingTop="20sp">
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/button7"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="20dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButton7"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="7" />
+
+                <Button
+                    android:id="@+id/button8"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButton8"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="8" />
+
+                <Button
+                    android:id="@+id/button9"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="20dp"
+                    android:onClick="onButton9"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="9" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/button4"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="20dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButton4"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="4" />
+
+                <Button
+                    android:id="@+id/button5"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButton5"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="5" />
+
+                <Button
+                    android:id="@+id/button6"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="20dp"
+                    android:onClick="onButton6"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="6" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/button1"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="20dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButton1"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="1" />
+
+                <Button
+                    android:id="@+id/button2"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="10dp"
+                    android:width="10dp"
+                    android:onClick="onButton2"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="2" />
+
+                <Button
+                    android:id="@+id/button3"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="20dp"
+                    android:onClick="onButton3"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="3" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <Button
+                    android:id="@+id/b_erase"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="20dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButtonEff"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="Eff" />
+
+                <Button
+                    android:id="@+id/button0"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="10dp"
+                    android:onClick="onButton0"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="0" />
+
+                <Button
+                    android:id="@+id/buttonOk"
+                    android:layout_width="@dimen/bomb_key_size"
+                    android:layout_height="@dimen/bomb_key_size"
+                    android:layout_marginLeft="10dp"
+                    android:layout_marginRight="20dp"
+                    android:onClick="onButtonOk"
+                    android:paddingBottom="20dp"
+                    android:paddingTop="20dp"
+                    android:text="Ok" />
+            </LinearLayout>
+
+
+        </LinearLayout>
+    </LinearLayout>
+
+</LinearLayout>

+ 2 - 1
app/src/main/res/layout/activity_host.xml

@@ -26,7 +26,8 @@
             <android.support.constraint.ConstraintLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_weight="1">
+                android:layout_weight="1"
+                android:onClick="onTryDisarm">
 
 
                 <TextView

+ 0 - 1
app/src/main/res/layout/activity_media.xml

@@ -55,7 +55,6 @@
         android:layout_alignParentTop="true"
         android:textAlignment="center"
         android:textAppearance="?android:attr/textAppearanceLarge"
-        android:textColor="@color/dull_5"
         android:textSize="25dp"
         android:textStyle="bold" />
 

+ 1 - 2
app/src/main/res/layout/activity_resource_list.xml

@@ -18,8 +18,7 @@
         android:layout_height="70dp"
         android:layout_gravity="center_horizontal"
         android:background="@drawable/title"
-        android:text="Inventaire"
-        android:textColor="@color/dull_4"
+        android:text="Vidéos"
         android:textSize="30dp"
         android:textStyle="bold" />
 

+ 8 - 10
app/src/main/res/layout/activity_test_video.xml

@@ -23,29 +23,27 @@
         android:src="@android:drawable/ic_media_pause" />
 
     <SeekBar
+        android:id="@+id/seekBar"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:id="@+id/seekBar"
-        android:layout_below="@+id/title"
         android:layout_alignBottom="@+id/play"
         android:layout_alignParentLeft="true"
         android:layout_alignParentStart="true"
+        android:layout_below="@+id/title"
         android:layout_toLeftOf="@+id/play"
-        android:layout_toStartOf="@+id/play"
-        android:background="#191919" />
+        android:layout_toStartOf="@+id/play" />
 
     <TextView
+        android:id="@+id/title"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:id="@+id/title"
-        android:layout_alignParentTop="true"
+        android:layout_alignParentEnd="true"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentStart="true"
         android:layout_alignParentRight="true"
-        android:layout_alignParentEnd="true"
-        android:textColor="@color/dull_5"
+        android:layout_alignParentStart="true"
+        android:layout_alignParentTop="true"
         android:textAlignment="center"
+        android:textAppearance="?android:attr/textAppearanceLarge"
         android:textSize="25dp"
         android:textStyle="bold" />
 

+ 23 - 26
app/src/main/res/layout/activity_viewer.xml

@@ -1,10 +1,9 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/rl_screen"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context=".ImageViewerActivity"
-    android:background="@drawable/background"
-    android:id="@+id/rl_screen">
+    tools:context=".ImageViewerActivity">
 
     <!-- The primary full-screen view. This can be replaced with whatever view
          is needed to present your content, e.g. VideoView, SurfaceView,
@@ -14,65 +13,63 @@
          android:fitsSystemWindows. -->
 
     <Button
+        android:id="@+id/info"
         android:layout_width="match_parent"
         android:layout_height="100px"
-        android:text="@string/informations"
-        android:id="@+id/info"
         android:layout_alignParentBottom="true"
         android:layout_centerHorizontal="true"
-        android:onClick="onClickInfo"
         android:background="@drawable/uibutton"
-        android:textStyle="bold"
-        android:textColor="@color/dull_4"
-        android:textSize="25px" />
+        android:onClick="onClickInfo"
+        android:text="@string/informations"
+        android:textSize="25px"
+        android:textStyle="bold" />
 
     <FrameLayout
+        android:id="@+id/frame_viewer"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_above="@+id/info"
-        android:id="@+id/frame_viewer"
         android:layout_below="@+id/title">
 
         <ImageView
+            android:id="@+id/imageView"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
-            android:id="@+id/imageView"
             android:layout_gravity="center"
             android:adjustViewBounds="true"
             android:cropToPadding="false"
-            android:focusableInTouchMode="true"
             android:focusable="true"
+            android:focusableInTouchMode="true"
             android:visibility="visible" />
 
     </FrameLayout>
 
     <TextView
+        android:id="@+id/title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:text="Large Text"
-        android:id="@+id/title"
-        android:layout_alignParentTop="true"
         android:layout_alignParentLeft="true"
         android:layout_alignParentStart="true"
-        android:textColor="@color/dull_5"
-        android:textStyle="bold"
-        android:textSize="25dp"
-        android:textAlignment="center"
-        android:onClick="onClick"
+        android:layout_alignParentTop="true"
         android:layout_toLeftOf="@+id/imageButton"
-        android:layout_toStartOf="@+id/imageButton" />
+        android:layout_toStartOf="@+id/imageButton"
+        android:onClick="onClick"
+        android:text="Large Text"
+        android:textAlignment="center"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:textSize="25dp"
+        android:textStyle="bold" />
 
     <ImageButton
+        android:id="@+id/imageButton"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:id="@+id/imageButton"
         android:layout_above="@+id/frame_viewer"
-        android:layout_alignParentRight="true"
         android:layout_alignParentEnd="true"
+        android:layout_alignParentRight="true"
         android:layout_alignParentTop="true"
-        android:src="@android:drawable/ic_menu_crop"
+        android:background="#00000000"
         android:onClick="onClick"
-        android:background="#00000000" />
+        android:src="@android:drawable/ic_menu_crop" />
 
 </RelativeLayout>

+ 16 - 8
app/src/main/res/layout/fragment_qcm.xml

@@ -3,6 +3,7 @@ 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:orientation="vertical"
 tools:context="app.mar.activities.QCMFragment">
 
     <LinearLayout
@@ -17,9 +18,10 @@ tools:context="app.mar.activities.QCMFragment">
 
             <ImageView
                 android:id="@+id/iv_img"
-                android:layout_width="wrap_content"
+                android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:src="@drawable/bscanner_tap" />
+
         </FrameLayout>
 
         <FrameLayout
@@ -32,18 +34,16 @@ tools:context="app.mar.activities.QCMFragment">
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-                <TextView
-                    android:id="@+id/tv_question"
+                <Space
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:editable="false"
-                    android:text="Comment s'appelait le joli cheval blanc d'Henri IV ?"
-                    android:textSize="18sp" />
+                    android:layout_height="20sp"
+                    android:layout_weight="1" />
 
                 <LinearLayout
                     android:id="@+id/ll_rootIndices"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
+                    android:layout_height="match_parent"
+                    android:layout_weight="1"
                     android:orientation="vertical">
 
                     <LinearLayout
@@ -54,6 +54,14 @@ tools:context="app.mar.activities.QCMFragment">
 
                 </LinearLayout>
 
+                <TextView
+                    android:id="@+id/tv_question"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:editable="false"
+                    android:text="Comment s'appelait le joli cheval blanc d'Henri IV ?"
+                    android:textSize="18sp" />
+
                 <RadioGroup
                     android:id="@+id/rg_qcm"
                     android:layout_width="match_parent"

+ 36 - 21
app/src/main/res/layout/fragment_qrcode.xml

@@ -3,7 +3,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="horizontal"
+    android:orientation="vertical"
     tools:context="app.mar.activities.QRCodeFragment">
 
 
@@ -33,22 +33,22 @@
             app:layout_anchorGravity="bottom|center" />
 
         <LinearLayout
-            android:id="@+id/ll_rootIndices"
+            android:id="@+id/ll_rootIndices2"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical">
 
             <TextView
-                android:id="@+id/tv_geoIndice"
+                android:id="@+id/tv_geoIndice2"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:gravity="center"
                 android:text="130 m"
-                android:textColor="#ffffff"
+                android:textColor="#ff70e030"
                 android:textSize="14sp" />
 
             <LinearLayout
-                android:id="@+id/ll_textIndices"
+                android:id="@+id/ll_textIndices2"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:orientation="vertical"></LinearLayout>
@@ -62,13 +62,38 @@
         android:layout_height="match_parent"
         android:orientation="vertical">
 
+        <Space
+            android:layout_width="match_parent"
+            android:layout_height="10sp" />
+
         <TextView
-            android:id="@+id/tv_geoIndice2"
+            android:id="@+id/tv_geoIndice"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:gravity="center"
             android:text="130 m"
-            android:textSize="14sp" />
+            android:textColor="#ff70e030"
+            android:textSize="14sp"
+            android:textStyle="bold" />
+
+        <LinearLayout
+            android:id="@+id/ll_rootIndices"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <LinearLayout
+                android:id="@+id/ll_textIndices"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:orientation="vertical">
+
+            </LinearLayout>
+        </LinearLayout>
+
+        <Space
+            android:layout_width="match_parent"
+            android:layout_height="10sp" />
 
         <ImageView
             android:id="@+id/iv_img"
@@ -77,6 +102,10 @@
             android:layout_weight="1"
             android:src="@drawable/bscanner_tap" />
 
+        <Space
+            android:layout_width="match_parent"
+            android:layout_height="20sp" />
+
         <TextView
             android:id="@+id/tv_question"
             android:layout_width="match_parent"
@@ -84,20 +113,6 @@
             android:text="Retrouvez un QR Code à cet endroit"
             android:textSize="14sp" />
 
-        <LinearLayout
-            android:id="@+id/ll_rootIndices2"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_weight="4"
-            android:orientation="vertical">
-
-            <LinearLayout
-                android:id="@+id/ll_textIndices2"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:orientation="vertical"></LinearLayout>
-        </LinearLayout>
-
         <Button
             android:id="@+id/btn_scan"
             android:layout_width="match_parent"

+ 68 - 41
app/src/main/res/layout/fragment_question.xml

@@ -6,67 +6,94 @@ android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context="app.mar.activities.QuestionFragment">
 
-<LinearLayout
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="1">
-
-        <ImageView
-            android:id="@+id/iv_img"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:src="@drawable/bscanner_tap" />
-    </FrameLayout>
-
-    <FrameLayout
+    <ScrollView
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_weight="1">
+        android:measureAllChildren="false">
 
         <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:orientation="vertical">
 
-            <TextView
-                android:id="@+id/tv_question"
+            <FrameLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:editable="false"
-                android:text="Qui a tué le cheval blanc d'Henri IV ?"
-                android:textSize="18sp" />
+                android:layout_height="wrap_content">
+
+                <ImageView
+                    android:id="@+id/iv_img"
+                    android:layout_width="match_parent"
+                    android:layout_height="200sp"
+                    android:layout_gravity="top"
+                    android:src="@drawable/bscanner_tap" />
+            </FrameLayout>
 
             <LinearLayout
-                android:id="@+id/ll_rootIndices"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
+                android:layout_weight="1"
                 android:orientation="vertical">
 
+                <Space
+                    android:layout_width="match_parent"
+                    android:layout_height="10sp" />
+
                 <LinearLayout
-                    android:id="@+id/ll_textIndices"
+                    android:id="@+id/ll_rootIndices"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:orientation="vertical">
+
+                    <LinearLayout
+                        android:id="@+id/ll_textIndices"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:orientation="vertical"></LinearLayout>
+
+                </LinearLayout>
+
+                <Space
+                    android:layout_width="match_parent"
+                    android:layout_height="10sp" />
+
+                <FrameLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent">
+
+                    <LinearLayout
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:orientation="vertical">
+
+                        <TextView
+                            android:id="@+id/tv_question"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:editable="false"
+                            android:text="Qui a tué le cheval blanc d'Henri IV ?"
+                            android:textSize="18sp" />
+
+                    </LinearLayout>
+
+                </FrameLayout>
+
+                <Space
+                    android:layout_width="match_parent"
+                    android:layout_height="20sp" />
+
+                <EditText
+                    android:id="@+id/et_response"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:orientation="vertical"></LinearLayout>
+                    android:layout_gravity="bottom"
+                    android:layout_weight="5"
+                    android:ems="10"
+                    android:hint="Entrer votre réponse"
+                    android:inputType="textPersonName" />
 
             </LinearLayout>
 
         </LinearLayout>
+    </ScrollView>
 
-    </FrameLayout>
-
-    <EditText
-        android:id="@+id/et_response"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_weight="0"
-        android:ems="10"
-        android:hint="Entrer votre réponse"
-        android:inputType="textPersonName" />
-
-</LinearLayout>
 </FrameLayout>

+ 1 - 0
app/src/main/res/values/dimens.xml

@@ -5,4 +5,5 @@
     <dimen name="fab_margin">16dp</dimen>
     <dimen name="title_height">70dp</dimen>
     <dimen name="title_text_size">30dp</dimen>
+    <dimen name="bomb_key_size">70</dimen>
 </resources>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -95,4 +95,5 @@
     <!-- TODO: Remove or change this placeholder text -->
     <string name="hello_blank_fragment">Hello blank fragment</string>
     <string name="title_activity_test_video">TestVideoActivity</string>
+    <string name="title_activity_bomb">BombActivity</string>
 </resources>