Browse Source

Premiere révision après le test de la Beta:
-Question écrites en plus grandes
-Correction d'erreurs (réponses)
-etc.

François Gautrais 7 years ago
parent
commit
7cc2e5f03d
33 changed files with 216 additions and 139 deletions
  1. 1 0
      app/app.iml
  2. BIN
      app/src/main/assets/burger.mp3
  3. BIN
      app/src/main/assets/fin.mp3
  4. 7 8
      app/src/main/assets/game_medium
  5. BIN
      app/src/main/assets/intro.mp3
  6. BIN
      app/src/main/assets/intro_fin.mp3
  7. 2 1
      app/src/main/assets/ressources.res
  8. BIN
      app/src/main/assets/tuto/8.png
  9. 2 2
      app/src/main/java/macampcorp/macamp/activities/CrashActivity.java
  10. 10 2
      app/src/main/java/macampcorp/macamp/activities/HostActivity.java
  11. 5 0
      app/src/main/java/macampcorp/macamp/activities/fragments/ChallengeFragment.java
  12. 14 11
      app/src/main/java/macampcorp/macamp/activities/fragments/QRCodeFragment.java
  13. 6 2
      app/src/main/java/macampcorp/macamp/activities/fragments/QuestionFragment.java
  14. 14 2
      app/src/main/java/macampcorp/macamp/activities/viewers/MediaViewerAcitvity.java
  15. 1 1
      app/src/main/java/macampcorp/macamp/game/Event.java
  16. 1 0
      app/src/main/java/macampcorp/macamp/game/challenges/Challenge.java
  17. 1 1
      app/src/main/java/macampcorp/macamp/game/scheduler/ResourceTask.java
  18. 6 1
      app/src/main/java/macampcorp/macamp/ui/MediaView.java
  19. 41 0
      app/src/main/java/macampcorp/macamp/ui/Sound.java
  20. 7 1
      app/src/main/java/macampcorp/macamp/utils/AndroidResources.java
  21. 2 1
      app/src/main/java/macampcorp/macamp/utils/Const.java
  22. 14 0
      app/src/main/java/macampcorp/macamp/utils/Utils.java
  23. 31 46
      app/src/main/res/layout/fragment_bomb.xml
  24. 13 19
      app/src/main/res/layout/fragment_qcm.xml
  25. 20 17
      app/src/main/res/layout/fragment_qrcode.xml
  26. 12 23
      app/src/main/res/layout/fragment_question.xml
  27. BIN
      app/src/main/res/raw/fail.mp3
  28. BIN
      app/src/main/res/raw/ok.mp3
  29. 1 0
      app/src/main/res/values-large/dimens.xml
  30. 1 0
      app/src/main/res/values-normal/dimens.xml
  31. 1 0
      app/src/main/res/values-small/dimens.xml
  32. 1 0
      app/src/main/res/values-xlarge/dimens.xml
  33. 2 1
      app/src/main/res/values/dimens.xml

+ 1 - 0
app/app.iml

@@ -112,6 +112,7 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/reports" />
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
     </content>
     <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
     <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />

BIN
app/src/main/assets/burger.mp3


BIN
app/src/main/assets/fin.mp3


+ 7 - 8
app/src/main/assets/game_medium

@@ -35,7 +35,7 @@
 				]
 				]
 			}
 			}
 		],
 		],
-	"resources" : [],
+	"resources" : ["intro_fin"],
 	"charIndex" : 7
 	"charIndex" : 7
 },
 },
 {
 {
@@ -240,7 +240,7 @@
 				"bad_message" : "Non !",
 				"bad_message" : "Non !",
 				"question" : "Et maintenant, un petit test de raisonnement : Regardez sur la porte à votre gauche. Vous pouvez essayer de deviner sur quelle place est garé la voiture, mais ca m’étonnerais que vous trouviez !",
 				"question" : "Et maintenant, un petit test de raisonnement : Regardez sur la porte à votre gauche. Vous pouvez essayer de deviner sur quelle place est garé la voiture, mais ca m’étonnerais que vous trouviez !",
 				"good_message" : "Brillant !",
 				"good_message" : "Brillant !",
-				"resource" : "ludo",
+				"resource" : "parking",
 				"answer" : "97",
 				"answer" : "97",
 				"indices" : [
 				"indices" : [
 					{
 					{
@@ -276,13 +276,13 @@
 				"name" : "JardinHiverQuestion",
 				"name" : "JardinHiverQuestion",
 				"bad_message" : "Non !",
 				"bad_message" : "Non !",
 				"resource" : "jardin", 
 				"resource" : "jardin", 
-				"question" : "Rentrez par la porte en face de vous et allez dans le 'jardin d’hiver' de la MJC. Un mot de X lettres est caché dans ce dernier, mais bonne chance pour le découvrir !",
+				"question" : "Rentrez par la porte en face de vous et allez dans le 'jardin d’hiver' de la MJC. Un mot de 6 lettres est caché dans ce dernier, mais bonne chance pour le découvrir !",
 				"good_message" : "Bravo !",
 				"good_message" : "Bravo !",
 				"answer" : "patate",
 				"answer" : "patate",
 				"indices" : [
 				"indices" : [
 					{
 					{
 						"penality" : 0.5,
 						"penality" : 0.5,
-						"text": "J’ai bien dit X lettres !"
+						"text": "J’ai bien dit 6 lettres !"
 					},
 					},
 					{
 					{
 						"penality" : 1,
 						"penality" : 1,
@@ -314,7 +314,7 @@
 				"good_message" : "Bravo !",
 				"good_message" : "Bravo !",
 				"resource" : "accueil",
 				"resource" : "accueil",
 				"question" : "Quel est le sens de la vie ?\nDemandez donc aux personnes les mieux renseignés de la médiathèque ET de la MJC. Et au passage, la plaquette de la MJC et le facebook de la médiathèque pourrait être utile !",
 				"question" : "Quel est le sens de la vie ?\nDemandez donc aux personnes les mieux renseignés de la médiathèque ET de la MJC. Et au passage, la plaquette de la MJC et le facebook de la médiathèque pourrait être utile !",
-				"answer" : "Trop cuite",
+				"answer" : "De gauche à droite",
 				"indices" : [
 				"indices" : [
 					{
 					{
 						"penality" : 0.5,
 						"penality" : 0.5,
@@ -414,7 +414,7 @@
 				"type" : "BombDefuse",
 				"type" : "BombDefuse",
 				"name" : "DefuseBomb",
 				"name" : "DefuseBomb",
 				"resource" : "oeil",
 				"resource" : "oeil",
-				"text" : "Allez chercher ce roman policier un message codé se trouve à l'intérieur...",
+				"text" : "Allez à cet endroit et désamorcez la bombe !",
 				"indices" : [
 				"indices" : [
 					{
 					{
 						"penality" : 0.5,
 						"penality" : 0.5,
@@ -432,9 +432,8 @@
 }	],
 }	],
      "win" : {
      "win" : {
          "name" : "win",
          "name" : "win",
-         "resources" : ["intro"],
           "challenges" : [],
           "challenges" : [],
-         "event_start" : {"method" : "alert", "args" : ["T'as gagné !"] } 
+         "resources" : ["intro"]
      },
      },
       "loose" : {
       "loose" : {
           "name" : "loose",
           "name" : "loose",

BIN
app/src/main/assets/intro.mp3


BIN
app/src/main/assets/intro_fin.mp3


+ 2 - 1
app/src/main/assets/ressources.res

@@ -35,5 +35,6 @@
 	"prospect" :  {"type" : "Image"},
 	"prospect" :  {"type" : "Image"},
 	"error" : {"type" : "Image"},
 	"error" : {"type" : "Image"},
 	"livre" : {"type" : "Image"},
 	"livre" : {"type" : "Image"},
-	"oeil" : { "type": "Image" }
+	"oeil" : { "type": "Image" },
+	"parking" : { "type" : "Image" }
 }
 }

BIN
app/src/main/assets/tuto/8.png


+ 2 - 2
app/src/main/java/macampcorp/macamp/activities/CrashActivity.java

@@ -12,6 +12,7 @@ import android.os.Bundle;
 import android.view.View;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.ImageView;
 
 
+import macampcorp.macamp.ui.Sound;
 import macampcorp.macamp.utils.Const;
 import macampcorp.macamp.utils.Const;
 
 
 public class CrashActivity extends AppCompatActivity {
 public class CrashActivity extends AppCompatActivity {
@@ -34,8 +35,7 @@ public class CrashActivity extends AppCompatActivity {
 
 
         AnimatorSet scaleDown = new AnimatorSet();
         AnimatorSet scaleDown = new AnimatorSet();
         scaleDown.play(scaleDownX).with(scaleDownY);
         scaleDown.play(scaleDownX).with(scaleDownY);
-        final MediaPlayer mp = MediaPlayer.create(this, R.raw.boom);
-        mp.start();
+        Sound.boom(this);
         scaleDown.start();
         scaleDown.start();
 
 
         final Activity t = this;
         final Activity t = this;

+ 10 - 2
app/src/main/java/macampcorp/macamp/activities/HostActivity.java

@@ -36,6 +36,7 @@ import macampcorp.macamp.game.Indice;
 import macampcorp.macamp.game.scheduler.Scheduler;
 import macampcorp.macamp.game.scheduler.Scheduler;
 import macampcorp.macamp.game.scheduler.SpecialTask;
 import macampcorp.macamp.game.scheduler.SpecialTask;
 import macampcorp.macamp.lang.Locale;
 import macampcorp.macamp.lang.Locale;
+import macampcorp.macamp.ui.Sound;
 import macampcorp.macamp.utils.AndroidResources;
 import macampcorp.macamp.utils.AndroidResources;
 import macampcorp.macamp.utils.L;
 import macampcorp.macamp.utils.L;
 
 
@@ -197,9 +198,11 @@ public class HostActivity extends Activity implements ChallengeFragment.OnFragme
             if(res==Challenge.OK)
             if(res==Challenge.OK)
             { //bonne réponse
             { //bonne réponse
                 challengeValidate(mCurrentFragment.getChallenge(),  mGame, this);
                 challengeValidate(mCurrentFragment.getChallenge(),  mGame, this);
+                Sound.ok(this);
             }else if(res==Challenge.FAIL)
             }else if(res==Challenge.FAIL)
             { //mauvaise réponse
             { //mauvaise réponse
                 //réponse facultative
                 //réponse facultative
+                Sound.fail(this);
                 if(!mCurrentFragment.getChallenge().isMandatory())
                 if(!mCurrentFragment.getChallenge().isMandatory())
                 {
                 {
                     mCurrentFragment.onChallengePassed();
                     mCurrentFragment.onChallengePassed();
@@ -324,10 +327,14 @@ public class HostActivity extends Activity implements ChallengeFragment.OnFragme
 
 
         }
         }
     }
     }
-
     public void startResource(Resource r)
     public void startResource(Resource r)
     {
     {
-        Intent intent = AndroidResources.getViewerIntent(this, r);
+        startResource(r, false);
+    }
+
+    public void startResource(Resource r, boolean autopass)
+    {
+        Intent intent = AndroidResources.getViewerIntent(this, r, autopass);
         startActivityForResult(intent, AndroidResources.getViewerRequestCode(r));
         startActivityForResult(intent, AndroidResources.getViewerRequestCode(r));
     }
     }
 
 
@@ -335,6 +342,7 @@ public class HostActivity extends Activity implements ChallengeFragment.OnFragme
         if(ok)
         if(ok)
             mGame.getBomb().addKnownCharacter(c.getCharIndex());
             mGame.getBomb().addKnownCharacter(c.getCharIndex());
         updateCode();
         updateCode();
+        mCurrentFragment.onChallengeEnd();
         nextChallenge();
         nextChallenge();
 
 
         mGame.getScheduler().schedule(this, mGame);
         mGame.getScheduler().schedule(this, mGame);

+ 5 - 0
app/src/main/java/macampcorp/macamp/activities/fragments/ChallengeFragment.java

@@ -65,6 +65,11 @@ public abstract class ChallengeFragment extends Fragment{
 
 
     }
     }
 
 
+    public  void onChallengeEnd()
+    {
+
+    }
+
     public boolean onBackPressed()
     public boolean onBackPressed()
     {
     {
         return true;
         return true;

+ 14 - 11
app/src/main/java/macampcorp/macamp/activities/fragments/QRCodeFragment.java

@@ -13,11 +13,11 @@ import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.Toast;
 
 
 import com.google.zxing.ResultPoint;
 import com.google.zxing.ResultPoint;
-import com.google.zxing.client.android.BeepManager;
 import com.journeyapps.barcodescanner.BarcodeCallback;
 import com.journeyapps.barcodescanner.BarcodeCallback;
 import com.journeyapps.barcodescanner.BarcodeResult;
 import com.journeyapps.barcodescanner.BarcodeResult;
 import com.journeyapps.barcodescanner.CaptureManager;
 import com.journeyapps.barcodescanner.CaptureManager;
 import com.journeyapps.barcodescanner.DecoratedBarcodeView;
 import com.journeyapps.barcodescanner.DecoratedBarcodeView;
+import com.journeyapps.barcodescanner.Util;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -27,6 +27,9 @@ import macampcorp.macamp.game.Game;
 import macampcorp.macamp.game.challenges.Challenge;
 import macampcorp.macamp.game.challenges.Challenge;
 import macampcorp.macamp.game.Indice;
 import macampcorp.macamp.game.Indice;
 import macampcorp.macamp.game.challenges.QRCodeTreasure;
 import macampcorp.macamp.game.challenges.QRCodeTreasure;
+import macampcorp.macamp.ui.Sound;
+import macampcorp.macamp.utils.Const;
+import macampcorp.macamp.utils.Utils;
 
 
 
 
 /**
 /**
@@ -42,13 +45,13 @@ public class QRCodeFragment extends ChallengeFragment  implements BarcodeCallbac
     private DecoratedBarcodeView barcodeScannerView;
     private DecoratedBarcodeView barcodeScannerView;
     private TextView tvQuestion;
     private TextView tvQuestion;
     private Button goToScan;
     private Button goToScan;
-    private BeepManager beepManager;
     private View vPresRoot;
     private View vPresRoot;
     private View vScanRoot;
     private View vScanRoot;
     private Game mGame;
     private Game mGame;
     public static final int REQUEST_CODE = 2001;
     public static final int REQUEST_CODE = 2001;
     private QRCodeTreasure mQr;
     private QRCodeTreasure mQr;
     private OnFragmentInteractionListener mListener;
     private OnFragmentInteractionListener mListener;
+    protected long mLastScan=0;
 
 
     protected static final int STATE_PRESENTATION=0;
     protected static final int STATE_PRESENTATION=0;
     protected static final int STATE_RA=1;
     protected static final int STATE_RA=1;
@@ -80,6 +83,7 @@ public class QRCodeFragment extends ChallengeFragment  implements BarcodeCallbac
     public void onCreate(Bundle savedInstanceState) {
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         super.onCreate(savedInstanceState);
         if (getArguments() != null) {
         if (getArguments() != null) {
+
         }
         }
     }
     }
 
 
@@ -121,7 +125,6 @@ public class QRCodeFragment extends ChallengeFragment  implements BarcodeCallbac
         // Inflate the layout for this fragment
         // Inflate the layout for this fragment
         View v = super.onCreateView(inflater, container, R.layout.fragment_qrcode);
         View v = super.onCreateView(inflater, container, R.layout.fragment_qrcode);
         barcodeScannerView = (DecoratedBarcodeView)v.findViewById(R.id.zxing_barcode_scanner);
         barcodeScannerView = (DecoratedBarcodeView)v.findViewById(R.id.zxing_barcode_scanner);
-        beepManager=new BeepManager(getActivity());
 
 
         goToScan = (Button)v.findViewById(R.id.btn_scan);
         goToScan = (Button)v.findViewById(R.id.btn_scan);
         goToScan.setOnClickListener(this);
         goToScan.setOnClickListener(this);
@@ -177,14 +180,11 @@ public class QRCodeFragment extends ChallengeFragment  implements BarcodeCallbac
     }
     }
 
 
 
 
-
-
     public void barcodeResult(final BarcodeResult result) {
     public void barcodeResult(final BarcodeResult result) {
-        beepManager.playBeepSoundAndVibrate();
-
 
 
         if(result.getText().compareTo(mQr.getQRValue())==0 || result.getText().compareTo("1")==0)
         if(result.getText().compareTo(mQr.getQRValue())==0 || result.getText().compareTo("1")==0)
         {
         {
+            Sound.ok(getActivity());
             if(mQr.getGoodMessage()!=null)
             if(mQr.getGoodMessage()!=null)
                 Toast.makeText(getActivity(),mQr.getGoodMessage(), Toast.LENGTH_LONG).show();
                 Toast.makeText(getActivity(),mQr.getGoodMessage(), Toast.LENGTH_LONG).show();
             barcodeScannerView.pause();
             barcodeScannerView.pause();
@@ -192,11 +192,14 @@ public class QRCodeFragment extends ChallengeFragment  implements BarcodeCallbac
             getHostActivity().challengeValidate(mChallenge, mGame, HostActivity.cast(getActivity()));
             getHostActivity().challengeValidate(mChallenge, mGame, HostActivity.cast(getActivity()));
         }else
         }else
         {
         {
-            if(mQr.getBadMessage()!=null)
-                Toast.makeText(getActivity(), mQr.getBadMessage(), Toast.LENGTH_LONG).show();
-            barcodeScannerView.decodeContinuous(this);
+            if(Utils.time(mLastScan)> Const.TIME_BEETWIN_SCAN_FAIL) {
+                Sound.fail(getActivity());
+                if (mQr.getBadMessage() != null)
+                    Toast.makeText(getActivity(), mQr.getBadMessage(), Toast.LENGTH_LONG).show();
+                barcodeScannerView.decodeContinuous(this);
+                mLastScan= Utils.time();
+            }
         }
         }
-
     }
     }
 
 
     public void setPrimaryView()
     public void setPrimaryView()

+ 6 - 2
app/src/main/java/macampcorp/macamp/activities/fragments/QuestionFragment.java

@@ -106,8 +106,6 @@ public class QuestionFragment extends ChallengeFragment  {
         super.onInitChallenge(c);
         super.onInitChallenge(c);
         Android.hideKeyboard(getActivity());
         Android.hideKeyboard(getActivity());
 
 
-
-
         if(c instanceof Question)
         if(c instanceof Question)
         {
         {
             mQuestion=(Question)c;
             mQuestion=(Question)c;
@@ -128,5 +126,11 @@ public class QuestionFragment extends ChallengeFragment  {
 
 
     }
     }
 
 
+    @Override
+    public  void onChallengeEnd()
+    {
+        Android.hideKeyboard(getActivity());
+    }
+
 
 
 }
 }

+ 14 - 2
app/src/main/java/macampcorp/macamp/activities/viewers/MediaViewerAcitvity.java

@@ -24,7 +24,8 @@ import macampcorp.macamp.utils.files.FileManager;
 
 
 public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlayer.OnSeekCompleteListener,
 public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlayer.OnSeekCompleteListener,
                                                                 MediaView.OnStartListener,
                                                                 MediaView.OnStartListener,
-                                                                SeekBar.OnSeekBarChangeListener {
+                                                                SeekBar.OnSeekBarChangeListener,
+                                                                MediaPlayer.OnCompletionListener{
     public static final int REQUEST_CODE = 27;
     public static final int REQUEST_CODE = 27;
     private Resource mResource;
     private Resource mResource;
     private Button mInfo;
     private Button mInfo;
@@ -39,6 +40,7 @@ public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlaye
     private AutoSeek mAutoSeek;
     private AutoSeek mAutoSeek;
     private int mCurrentTime;
     private int mCurrentTime;
     private int mEndTime;
     private int mEndTime;
+    private boolean mAutoPass=false;
     private boolean mUserSeeks=false;
     private boolean mUserSeeks=false;
 
 
     @Override
     @Override
@@ -58,11 +60,16 @@ public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlaye
 
 
         mMediaView = new MediaView(this);
         mMediaView = new MediaView(this);
         mMediaView.setOnStartListener(this);
         mMediaView.setOnStartListener(this);
+        mMediaView.setOnCompleteListener(this);
         mImageView = new ImageView(this);
         mImageView = new ImageView(this);
 
 
         mFrameLayout.addView(mMediaView);
         mFrameLayout.addView(mMediaView);
         mFrameLayout.addView(mImageView);
         mFrameLayout.addView(mImageView);
 
 
+        if(getIntent().hasExtra("autopass"))
+        {
+            mAutoPass=getIntent().getBooleanExtra("autopass", false);
+        }
 
 
         if(getIntent().hasExtra("resource"))
         if(getIntent().hasExtra("resource"))
         {
         {
@@ -163,7 +170,6 @@ public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlaye
 
 
     @Override
     @Override
     public void onStartTrackingTouch(SeekBar seekBar) {
     public void onStartTrackingTouch(SeekBar seekBar) {
-
     }
     }
 
 
 
 
@@ -191,6 +197,12 @@ public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlaye
         mButton.setImageResource(android.R.drawable.ic_media_pause);
         mButton.setImageResource(android.R.drawable.ic_media_pause);
     }
     }
 
 
+    @Override
+    public void onCompletion(MediaPlayer mp) {
+        if(mAutoPass)
+            onOk(null);
+    }
+
     private class AutoSeek implements Runnable
     private class AutoSeek implements Runnable
     {
     {
         private Handler mHandler;
         private Handler mHandler;

+ 1 - 1
app/src/main/java/macampcorp/macamp/game/Event.java

@@ -197,7 +197,7 @@ public class Event implements Serializable {
             throw new RuntimeException("Erreur dans Event: la ressource '"+rname+"' n'existe pas !");
             throw new RuntimeException("Erreur dans Event: la ressource '"+rname+"' n'existe pas !");
         }
         }
         g.getInventaire().addResource(r);
         g.getInventaire().addResource(r);
-        a.startResource(r);
+        a.startResource(r, true);
         EventReturn ev = new EventReturn(0, "OK");
         EventReturn ev = new EventReturn(0, "OK");
         ev.setWait();
         ev.setWait();
         return ev;
         return ev;

+ 1 - 0
app/src/main/java/macampcorp/macamp/game/challenges/Challenge.java

@@ -252,4 +252,5 @@ public abstract class Challenge implements Serializable{
     public String getBadMessage() {
     public String getBadMessage() {
         return mBadMessage;
         return mBadMessage;
     }
     }
+
 }
 }

+ 1 - 1
app/src/main/java/macampcorp/macamp/game/scheduler/ResourceTask.java

@@ -21,7 +21,7 @@ public class ResourceTask extends Task {
 
 
     @Override
     @Override
     public int exec(Scheduler s, HostActivity cd, Game g) {
     public int exec(Scheduler s, HostActivity cd, Game g) {
-        cd.startResource(mResource);
+        cd.startResource(mResource, true);
         return TASK_RESOURCE;
         return TASK_RESOURCE;
     }
     }
 
 

+ 6 - 1
app/src/main/java/macampcorp/macamp/ui/MediaView.java

@@ -23,13 +23,18 @@ public class MediaView extends SurfaceView implements View.OnClickListener,Surfa
     private MediaView mThis;
     private MediaView mThis;
     private Context mContext;
     private Context mContext;
     private OnStartListener mOnStart;
     private OnStartListener mOnStart;
+    private MediaPlayer.OnCompletionListener mOnComplete;
 
 
     public interface OnStartListener
     public interface OnStartListener
     {
     {
         public void onStart(MediaView mv);
         public void onStart(MediaView mv);
     }
     }
 
 
-
+    public void setOnCompleteListener(MediaPlayer.OnCompletionListener l)
+    {
+        mOnComplete=l;
+        mPlayer.setOnCompletionListener(mOnComplete);
+    }
 
 
     public MediaView(Activity cont) {
     public MediaView(Activity cont) {
         super(cont);
         super(cont);

+ 41 - 0
app/src/main/java/macampcorp/macamp/ui/Sound.java

@@ -0,0 +1,41 @@
+package macampcorp.macamp.ui;
+
+import android.app.Activity;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.media.SoundPool;
+
+import macampcorp.macamp.activities.R;
+
+public class Sound {
+
+    public static void play(Activity a, int res) {
+        MediaPlayer mediaPlayer = MediaPlayer.create(a, res);
+        mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
+        mediaPlayer.setLooping(false);
+        mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
+            @Override
+            public void onCompletion(MediaPlayer mp) {
+                mp.stop();
+                mp.release();
+            }
+        });
+        mediaPlayer.start();
+    }
+
+
+    public static void boom(Activity a)
+    {
+        play(a, R.raw.boom);
+    }
+
+    public static void ok(Activity a)
+    {
+        play(a, R.raw.ok);
+    }
+
+    public static void fail(Activity a)
+    {
+        play(a, R.raw.fail);
+    }
+}

+ 7 - 1
app/src/main/java/macampcorp/macamp/utils/AndroidResources.java

@@ -29,6 +29,12 @@ public class AndroidResources {
             return ImageViewerActivity.REQUEST_CODE;
             return ImageViewerActivity.REQUEST_CODE;
     }
     }
     public static Intent getViewerIntent(Context c, Resource re)
     public static Intent getViewerIntent(Context c, Resource re)
+    {
+        return getViewerIntent(c, re, false);
+    }
+
+
+    public static Intent getViewerIntent(Context c, Resource re, boolean autopass)
     {
     {
         Intent intent =null ;
         Intent intent =null ;
         if(re.isAudio() || re.isVideo())
         if(re.isAudio() || re.isVideo())
@@ -37,7 +43,7 @@ public class AndroidResources {
             intent= new Intent(c, ImageViewerActivity.class);
             intent= new Intent(c, ImageViewerActivity.class);
 
 
         intent.putExtra("resource", re);
         intent.putExtra("resource", re);
-
+        intent.putExtra("autopass", autopass);
         return intent;
         return intent;
     }
     }
 
 

+ 2 - 1
app/src/main/java/macampcorp/macamp/utils/Const.java

@@ -1,10 +1,11 @@
 package macampcorp.macamp.utils;
 package macampcorp.macamp.utils;
 
 
 public class Const {
 public class Const {
-    public static final float BOMB_PENALITY=120;
+    public static final float BOMB_PENALITY=1;
 
 
     public static final int POWER_OF_ANIM_DURATION=300;
     public static final int POWER_OF_ANIM_DURATION=300;
 
 
     public static final int POWER_OF_DURATION=5000;
     public static final int POWER_OF_DURATION=5000;
     public static final int BSOD_DURATION=6000;
     public static final int BSOD_DURATION=6000;
+    public static final int TIME_BEETWIN_SCAN_FAIL=3000;
 }
 }

+ 14 - 0
app/src/main/java/macampcorp/macamp/utils/Utils.java

@@ -0,0 +1,14 @@
+package macampcorp.macamp.utils;
+
+public class Utils {
+
+    public static long time()
+    {
+        return System.currentTimeMillis();
+    }
+
+    public static long time(long ref)
+    {
+        return System.currentTimeMillis()-ref;
+    }
+}

+ 31 - 46
app/src/main/res/layout/fragment_bomb.xml

@@ -16,6 +16,19 @@
                 android:layout_height="match_parent"
                 android:layout_height="match_parent"
                 android:orientation="vertical">
                 android:orientation="vertical">
 
 
+                <TextView
+                    android:id="@+id/tv_question"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="5"
+                    android:editable="false"
+                    android:text="Qui a tué le cheval blanc d'Henri IV ?"
+                    android:textSize="@dimen/lbl_question_size" />
+
+                <Space
+                    android:layout_width="match_parent"
+                    android:layout_height="10sp" />
+
                 <FrameLayout
                 <FrameLayout
                     android:layout_width="match_parent"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content">
                     android:layout_height="wrap_content">
@@ -23,8 +36,10 @@
                     <ImageView
                     <ImageView
                         android:id="@+id/iv_img"
                         android:id="@+id/iv_img"
                         android:layout_width="match_parent"
                         android:layout_width="match_parent"
-                        android:layout_height="200sp"
-                        android:layout_gravity="top" />
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="top"
+                        android:adjustViewBounds="true"
+                        android:src="@drawable/explosion" />
                 </FrameLayout>
                 </FrameLayout>
 
 
                 <LinearLayout
                 <LinearLayout
@@ -33,16 +48,16 @@
                     android:layout_weight="1"
                     android:layout_weight="1"
                     android:orientation="vertical">
                     android:orientation="vertical">
 
 
-                    <Space
-                        android:layout_width="match_parent"
-                        android:layout_height="10sp" />
-
                     <LinearLayout
                     <LinearLayout
                         android:id="@+id/ll_rootIndices"
                         android:id="@+id/ll_rootIndices"
                         android:layout_width="match_parent"
                         android:layout_width="match_parent"
                         android:layout_height="match_parent"
                         android:layout_height="match_parent"
                         android:orientation="vertical">
                         android:orientation="vertical">
 
 
+                        <Space
+                            android:layout_width="match_parent"
+                            android:layout_height="10sp" />
+
                         <LinearLayout
                         <LinearLayout
                             android:id="@+id/ll_textIndices"
                             android:id="@+id/ll_textIndices"
                             android:layout_width="match_parent"
                             android:layout_width="match_parent"
@@ -53,48 +68,18 @@
 
 
                     <Space
                     <Space
                         android:layout_width="match_parent"
                         android:layout_width="match_parent"
-                        android:layout_height="10sp" />
-
-                    <FrameLayout
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent">
-
-                    </FrameLayout>
+                        android:layout_height="20sp"
+                        android:layout_weight="5" />
 
 
-                    <ScrollView
+                    <Button
+                        android:id="@+id/btn_ok"
                         android:layout_width="match_parent"
                         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:layout_weight="5"
-                                android:editable="false"
-                                android:text="Qui a tué le cheval blanc d'Henri IV ?"
-                                android:textSize="18sp" />
-
-                            <Space
-                                android:layout_width="match_parent"
-                                android:layout_height="20sp"
-                                android:layout_weight="5" />
-
-                            <Button
-                                android:id="@+id/btn_ok"
-                                android:layout_width="match_parent"
-                                android:layout_height="wrap_content"
-                                android:layout_gravity="bottom"
-                                android:layout_weight="5"
-                                android:hint="Désamorcer la bombe"
-                                android:text="@string/btn_defuse"
-                                android:textSize="@dimen/font_button_size" />
-                        </LinearLayout>
-                    </ScrollView>
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="bottom"
+                        android:layout_weight="5"
+                        android:hint="Désamorcer la bombe"
+                        android:text="@string/btn_defuse"
+                        android:textSize="@dimen/font_button_size" />
 
 
                 </LinearLayout>
                 </LinearLayout>
 
 

+ 13 - 19
app/src/main/res/layout/fragment_qcm.xml

@@ -11,22 +11,24 @@ tools:context="macampcorp.macamp.activities.fragments.QCMFragment">
         android:layout_height="match_parent"
         android:layout_height="match_parent"
         android:orientation="vertical">
         android:orientation="vertical">
 
 
-        <FrameLayout
+        <TextView
+            android:id="@+id/tv_question"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_weight="1">
-
-            <ImageView
-                android:id="@+id/iv_img"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent" />
+            android:editable="false"
+            android:text="Comment s'appelait le joli cheval blanc d'Henri IV ?"
+            android:textSize="@dimen/lbl_question_size" />
 
 
-        </FrameLayout>
+        <ImageView
+            android:id="@+id/iv_img"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:adjustViewBounds="true"
+            android:src="@drawable/explosion" />
 
 
         <FrameLayout
         <FrameLayout
             android:layout_width="match_parent"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:layout_weight="1">
+            android:layout_height="match_parent">
 
 
             <LinearLayout
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
@@ -53,14 +55,6 @@ tools:context="macampcorp.macamp.activities.fragments.QCMFragment">
 
 
                 </LinearLayout>
                 </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" />
-
                 <ScrollView
                 <ScrollView
                     android:layout_width="match_parent"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
                     android:layout_height="match_parent"
@@ -69,7 +63,7 @@ tools:context="macampcorp.macamp.activities.fragments.QCMFragment">
                     <LinearLayout
                     <LinearLayout
                         android:layout_width="match_parent"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_height="wrap_content"
-                        android:orientation="vertical" >
+                        android:orientation="vertical">
 
 
                         <RadioGroup
                         <RadioGroup
                             android:id="@+id/rg_qcm"
                             android:id="@+id/rg_qcm"

+ 20 - 17
app/src/main/res/layout/fragment_qrcode.xml

@@ -41,7 +41,7 @@
     <LinearLayout
     <LinearLayout
         android:id="@+id/presentation"
         android:id="@+id/presentation"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:orientation="vertical">
         android:orientation="vertical">
 
 
         <Space
         <Space
@@ -63,33 +63,36 @@
             </LinearLayout>
             </LinearLayout>
         </LinearLayout>
         </LinearLayout>
 
 
+        <TextView
+            android:id="@+id/tv_question"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="Retrouvez un QR Code à cet endroit"
+            android:textSize="@dimen/lbl_question_size" />
+
         <Space
         <Space
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="10sp" />
             android:layout_height="10sp" />
 
 
         <ImageView
         <ImageView
             android:id="@+id/iv_img"
             android:id="@+id/iv_img"
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_weight="1"/>
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:adjustViewBounds="true"
+            android:src="@drawable/explosion" />
 
 
         <Space
         <Space
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="20sp" />
             android:layout_height="20sp" />
 
 
-        <TextView
-            android:id="@+id/tv_question"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="Retrouvez un QR Code à cet endroit"
-            android:textSize="14sp" />
-
-        <Button
-            android:id="@+id/btn_scan"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/btn_scan"
-            android:textSize="@dimen/font_button_size" />
     </LinearLayout>
     </LinearLayout>
 
 
+    <Button
+        android:id="@+id/btn_scan"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="bottom"
+        android:text="@string/btn_scan"
+        android:textSize="@dimen/font_button_size" />
+
 </LinearLayout>
 </LinearLayout>

+ 12 - 23
app/src/main/res/layout/fragment_question.xml

@@ -16,17 +16,6 @@ tools:context="macampcorp.macamp.activities.fragments.QuestionFragment">
             android:layout_height="match_parent"
             android:layout_height="match_parent"
             android:orientation="vertical">
             android:orientation="vertical">
 
 
-            <FrameLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-
-                <ImageView
-                    android:id="@+id/iv_img"
-                    android:layout_width="match_parent"
-                    android:layout_height="200sp"
-                    android:layout_gravity="top" />
-            </FrameLayout>
-
             <LinearLayout
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout_height="match_parent"
@@ -55,12 +44,6 @@ tools:context="macampcorp.macamp.activities.fragments.QuestionFragment">
                     android:layout_width="match_parent"
                     android:layout_width="match_parent"
                     android:layout_height="10sp" />
                     android:layout_height="10sp" />
 
 
-                <FrameLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="match_parent">
-
-                </FrameLayout>
-
                 <ScrollView
                 <ScrollView
                     android:layout_width="match_parent"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent">
                     android:layout_height="match_parent">
@@ -68,28 +51,34 @@ tools:context="macampcorp.macamp.activities.fragments.QuestionFragment">
                     <LinearLayout
                     <LinearLayout
                         android:layout_width="match_parent"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_height="wrap_content"
-                        android:orientation="vertical" >
+                        android:layout_gravity="top"
+                        android:orientation="vertical">
 
 
                         <TextView
                         <TextView
                             android:id="@+id/tv_question"
                             android:id="@+id/tv_question"
                             android:layout_width="match_parent"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:layout_height="wrap_content"
-                            android:layout_weight="5"
                             android:editable="false"
                             android:editable="false"
                             android:text="Qui a tué le cheval blanc d'Henri IV ?"
                             android:text="Qui a tué le cheval blanc d'Henri IV ?"
-                            android:textSize="18sp" />
+                            android:textSize="@dimen/lbl_question_size" />
+
+                        <ImageView
+                            android:id="@+id/iv_img"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="top"
+                            android:adjustViewBounds="true"
+                            android:src="@drawable/explosion" />
 
 
                         <Space
                         <Space
                             android:layout_width="match_parent"
                             android:layout_width="match_parent"
-                            android:layout_height="20sp"
-                            android:layout_weight="5" />
+                            android:layout_height="20sp" />
 
 
                         <EditText
                         <EditText
                             android:id="@+id/et_response"
                             android:id="@+id/et_response"
                             android:layout_width="match_parent"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_gravity="bottom"
                             android:layout_gravity="bottom"
-                            android:layout_weight="5"
                             android:ems="10"
                             android:ems="10"
                             android:hint="Entrer votre réponse"
                             android:hint="Entrer votre réponse"
                             android:inputType="textPersonName" />
                             android:inputType="textPersonName" />

BIN
app/src/main/res/raw/fail.mp3


BIN
app/src/main/res/raw/ok.mp3


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

@@ -5,4 +5,5 @@
     <dimen name="font_button_size">35dp</dimen>
     <dimen name="font_button_size">35dp</dimen>
     <dimen name="label_size">14dp</dimen>
     <dimen name="label_size">14dp</dimen>
     <dimen name="big_label_size">25dp</dimen>
     <dimen name="big_label_size">25dp</dimen>
+    <dimen name="lbl_question_size">35dp</dimen>
 </resources>
 </resources>

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

@@ -5,4 +5,5 @@
     <dimen name="font_button_size">16dp</dimen>
     <dimen name="font_button_size">16dp</dimen>
     <dimen name="label_size">14dp</dimen>
     <dimen name="label_size">14dp</dimen>
     <dimen name="big_label_size">25dp</dimen>
     <dimen name="big_label_size">25dp</dimen>
+    <dimen name="lbl_question_size">22dp</dimen>
 </resources>
 </resources>

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

@@ -7,4 +7,5 @@
     <dimen name="font_button_size">14dp</dimen>
     <dimen name="font_button_size">14dp</dimen>
     <dimen name="label_size">12dp</dimen>
     <dimen name="label_size">12dp</dimen>
     <dimen name="big_label_size">20dp</dimen>
     <dimen name="big_label_size">20dp</dimen>
+    <dimen name="lbl_question_size">18dp</dimen>
 </resources>
 </resources>

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

@@ -5,4 +5,5 @@
     <dimen name="font_button_size">40dp</dimen>
     <dimen name="font_button_size">40dp</dimen>
     <dimen name="label_size">16dp</dimen>
     <dimen name="label_size">16dp</dimen>
     <dimen name="big_label_size">30dp</dimen>
     <dimen name="big_label_size">30dp</dimen>
+    <dimen name="lbl_question_size">35dp</dimen>
 </resources>
 </resources>

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

@@ -6,8 +6,9 @@
     <dimen name="title_height">70dp</dimen>
     <dimen name="title_height">70dp</dimen>
     <dimen name="title_text_size">30dp</dimen>
     <dimen name="title_text_size">30dp</dimen>
     <dimen name="bomb_key_size">60dp</dimen>
     <dimen name="bomb_key_size">60dp</dimen>
-    <dimen name="padding_afficheur" />
+    <dimen name="padding_afficheur" > </dimen>
     <dimen name="font_button_size">14dp</dimen>
     <dimen name="font_button_size">14dp</dimen>
     <dimen name="label_size">14dp</dimen>
     <dimen name="label_size">14dp</dimen>
     <dimen name="big_label_size">25dp</dimen>
     <dimen name="big_label_size">25dp</dimen>
+    <dimen name="lbl_question_size">18dp</dimen>
 </resources>
 </resources>