gautrais 7 年之前
父節點
當前提交
9f91be7769

+ 1 - 0
app/app.iml

@@ -96,6 +96,7 @@
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />

+ 21 - 1
app/src/main/assets/game_medium

@@ -3,7 +3,27 @@
     "max_time" : 120,
 	"stages" : [{
 	"name" : "Intro",
-	"challenges" : [],
+	"challenges" : [
+
+
+    			{
+    				"type" : "Question",
+    				"name" : "accueilQuestion3",
+    				"resource" : "accueil",
+    				"question" : "Comment est votre blanquette ?\nDemandez donc aux personnes les mieux renseignés de la bibliothèque ET de la MJC. Et au passage, la plaquette de la MJC et le facebook de la bibliothèque pourrait être utile !",
+    				"answer" : "1"
+    			},
+    			{
+    				"type" : "Question",
+    				"name" : "accueilQuestion2",
+    				"resource" : "accueil",
+    				"question" : "Comment est votre blanquette ?\nDemandez donc aux personnes les mieux renseignés de la bibliothèque ET de la MJC. Et au passage, la plaquette de la MJC et le facebook de la bibliothèque pourrait être utile !",
+    				"answer" : "2"
+    			}
+
+
+
+	],
 	"resources" : ["intro"],
 	"event_end" : [ 
 		{"method" : "tuto"},

+ 0 - 33
app/src/main/java/macampcorp/macamp/activities/ChallengeDriver.java

@@ -1,33 +0,0 @@
-package macampcorp.macamp.activities;
-
-import android.app.Activity;
-import android.net.Uri;
-
-import macampcorp.macamp.activities.fragments.ChallengeFragment;
-import macampcorp.macamp.game.Game;
-import macampcorp.macamp.game.Resource;
-import macampcorp.macamp.game.challenges.Challenge;
-
-public interface ChallengeDriver extends ChallengeFragment.OnFragmentInteractionListener {
-    public void challengeValidate(Challenge c, Game g, ChallengeDriver cd);
-    public void challengePassed(Challenge c, Game g, ChallengeDriver cd);
-    public Challenge currentChallenge();
-    public void setFragment(Challenge c);
-    public void onFragmentInteraction(Uri uri);
-    public void onReady(Challenge chall);
-
-    public void   startResource(Resource r);
-
-
-    public void setVisibilityView(int res, int state);
-    public void setVisibilityView(int[] res, int state);
-
-    public void setFinished();
-    public void setFailed();
-    public Activity getActivity();
-
-
-    public void load();
-    public void save();
-    //TODO: Sauvegarde dans le prototype
-}

+ 14 - 12
app/src/main/java/macampcorp/macamp/activities/HostActivity.java

@@ -3,6 +3,7 @@ package macampcorp.macamp.activities;
 import android.app.Activity;
 import android.app.FragmentManager;
 import android.app.FragmentTransaction;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.net.Uri;
@@ -10,6 +11,7 @@ import android.os.Bundle;
 import android.support.v7.app.AlertDialog;
 import android.util.Log;
 import android.view.View;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.Button;
 import android.widget.TextView;
 
@@ -34,7 +36,7 @@ import macampcorp.macamp.game.scheduler.SpecialTask;
 import macampcorp.macamp.utils.AndroidResources;
 
 
-public class HostActivity extends Activity implements ChallengeDriver{
+public class HostActivity extends Activity implements ChallengeFragment.OnFragmentInteractionListener {
     public static final int REQUEST_CODE = 25;
     protected Game mGame;
     protected TextView mUITimeLeft;
@@ -144,13 +146,10 @@ public class HostActivity extends Activity implements ChallengeDriver{
         }
     }
 
-    @Override
     public void onReady(Challenge chall) {
         mCurrentFragment.initChallenge(chall);
     }
 
-
-    @Override
     public void onFragmentInteraction(Uri uri) {}
 
 
@@ -317,7 +316,7 @@ public class HostActivity extends Activity implements ChallengeDriver{
         startActivityForResult(intent, AndroidResources.getViewerRequestCode(r));
     }
 
-    public void _challengeValidate(Challenge c, Game g, ChallengeDriver dri, boolean ok) {
+    public void _challengeValidate(Challenge c, Game g, HostActivity dri, boolean ok) {
         if(ok)
             mGame.getBomb().addKnownCharacter(c.getCharIndex());
         updateCode();
@@ -327,13 +326,11 @@ public class HostActivity extends Activity implements ChallengeDriver{
         save();
     }
 
-    @Override
-    public void challengeValidate(Challenge c, Game g, ChallengeDriver dri) {
+    public void challengeValidate(Challenge c, Game g, HostActivity dri) {
         _challengeValidate(c,g,dri,true);
     }
 
-    @Override
-    public void challengePassed(Challenge c, Game g, ChallengeDriver dri)
+    public void challengePassed(Challenge c, Game g, HostActivity dri)
     {
         _challengeValidate(c,g,dri,false);
     }
@@ -354,18 +351,15 @@ public class HostActivity extends Activity implements ChallengeDriver{
         finish();
     }
 
-    @Override
     public Activity getActivity() {
         return this;
     }
 
-    @Override
     public void load() {
         mGame = Game.load(this);
         Game.setGame(mGame);
     }
 
-    @Override
     public void save() {
         mGame.save(this);
     }
@@ -377,4 +371,12 @@ public class HostActivity extends Activity implements ChallengeDriver{
         if(mCurrentFragment==null || mCurrentFragment.onBackPressed())
             super.onBackPressed();
     }
+
+    public static HostActivity cast(Activity v)
+    {
+        if(v instanceof HostActivity) return (HostActivity) v;
+        throw new RuntimeException("Erreur l'activity n'est pas 'HostActivity' : '"+v.getClass().getName()+"'");
+    }
+
+
 }

+ 1 - 1
app/src/main/java/macampcorp/macamp/activities/fragments/BombFragment.java

@@ -66,7 +66,7 @@ public class BombFragment extends ChallengeFragment implements View.OnClickListe
 
     @Override
     protected void onResetUi() {
-        getDriver().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
+        getHostActivity().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
     }
 
 

+ 20 - 29
app/src/main/java/macampcorp/macamp/activities/fragments/ChallengeFragment.java

@@ -1,13 +1,11 @@
 package macampcorp.macamp.activities.fragments;
 
-import android.app.Activity;
 import android.app.Fragment;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Typeface;
 import android.net.Uri;
 import android.os.Bundle;
-import android.util.Log;
 import android.util.TypedValue;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
@@ -16,12 +14,10 @@ import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
-import android.widget.Toast;
 
 import java.util.ArrayList;
-import java.util.Timer;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.activities.R;
 import macampcorp.macamp.exceptions.ResourceFileNotFoundException;
 import macampcorp.macamp.exceptions.ResourceNotFoundException;
@@ -32,7 +28,7 @@ import macampcorp.macamp.game.Indice;
 import macampcorp.macamp.utils.files.FileManager;
 import uk.co.senab.photoview.PhotoViewAttacher;
 
-public abstract class ChallengeFragment extends Fragment {
+public abstract class ChallengeFragment extends Fragment{
     public abstract int check();
     protected abstract  void onResetUi();
 
@@ -44,6 +40,11 @@ public abstract class ChallengeFragment extends Fragment {
     protected ImageView     mImage;
     private PhotoViewAttacher mAttacher;
 
+    public HostActivity getHostActivity()
+    {
+        return HostActivity.cast(getActivity());
+    }
+
     protected void onInitChallenge(Challenge c)
     {
         if(c!=null) setImageResource(c.getResourceName());
@@ -94,7 +95,7 @@ public abstract class ChallengeFragment extends Fragment {
 
     public void resetUi()
     {
-        getDriver().setVisibilityView(R.id.btn_indice, View.VISIBLE);
+        getHostActivity().setVisibilityView(R.id.btn_indice, View.VISIBLE);
         if(mUITextIndices!=null)
         {
             mUITextIndices.removeAllViews();
@@ -129,7 +130,7 @@ public abstract class ChallengeFragment extends Fragment {
 
         }
         //si on arrive ici, ca veut dire que tous les indices ont ete découvert
-        getDriver().setVisibilityView(R.id.btn_indice, View.INVISIBLE);
+        getHostActivity().setVisibilityView(R.id.btn_indice, View.INVISIBLE);
     }
 
     public Indice showIndice()
@@ -138,15 +139,13 @@ public abstract class ChallengeFragment extends Fragment {
         int indInd = mChallenge.getIndiceIndex();
         if(ind!=null)
         {
-            if(getActivity() instanceof ChallengeDriver)
-            {
-
-                    if(mUITextIndices!=null) {
-                        mUIGlobalIndice.setVisibility(View.VISIBLE);
-                        mUITextIndices.addView(createTextView(ind, indInd));
-                        ind.discover();
-                        return ind;
-                    }
+
+
+            if(mUITextIndices!=null) {
+                mUIGlobalIndice.setVisibility(View.VISIBLE);
+                mUITextIndices.addView(createTextView(ind, indInd));
+                ind.discover();
+                return ind;
             }
         }
         return null;
@@ -175,33 +174,25 @@ public abstract class ChallengeFragment extends Fragment {
     {
         if(c==null)
         {
-            getDriver().setFinished();
+            getHostActivity().setFinished();
         }
         mChallenge=c;
         resetUi();
         if(mChallenge!=null && !mChallenge.hasNextIndice())
         {
-            getDriver().setVisibilityView(R.id.btn_indice, View.INVISIBLE);
+            getHostActivity().setVisibilityView(R.id.btn_indice, View.INVISIBLE);
         }
         onInitChallenge(c);
     }
 
-    public ChallengeDriver getDriver()
-    {
-        Activity act = getActivity();
-        if(act instanceof ChallengeDriver)
-            return (ChallengeDriver)act;
-        else if(act==null)
-            return null;
-        throw new RuntimeException("Error Activty hosting this Fragment ("+getClass()+") is not a ChallengeDriver");
-    }
+
 
 
 
 
     protected void ready()
     {
-        getDriver().onReady(getDriver().currentChallenge());
+        getHostActivity().onReady(getHostActivity().currentChallenge());
     }
 
     @Override

+ 1 - 1
app/src/main/java/macampcorp/macamp/activities/fragments/QCMFragment.java

@@ -119,7 +119,7 @@ public class QCMFragment extends ChallengeFragment {
     @Override
     protected void onResetUi() {
         mUIGoupQCM.clearCheck();
-        getDriver().setVisibilityView(R.id.btn_valid, View.VISIBLE);
+        getHostActivity().setVisibilityView(R.id.btn_valid, View.VISIBLE);
     }
 
 }

+ 6 - 39
app/src/main/java/macampcorp/macamp/activities/fragments/QRCodeFragment.java

@@ -1,10 +1,8 @@
 package macampcorp.macamp.activities.fragments;
 
 import android.app.Activity;
-import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.app.Fragment;
-import android.util.Log;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -23,7 +21,7 @@ import com.journeyapps.barcodescanner.DecoratedBarcodeView;
 
 import java.util.List;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.activities.R;
 import macampcorp.macamp.game.Game;
 import macampcorp.macamp.game.challenges.Challenge;
@@ -39,11 +37,9 @@ import macampcorp.macamp.game.challenges.QRCodeTreasure;
  * Use the {@link QRCodeFragment#newInstance} factory method to
  * create an instance of this fragment.
  */
-public class QRCodeFragment extends ChallengeFragment  implements
-        DecoratedBarcodeView.TorchListener, BarcodeCallback, View.OnClickListener{
+public class QRCodeFragment extends ChallengeFragment  implements BarcodeCallback, View.OnClickListener{
     private CaptureManager capture;
     private DecoratedBarcodeView barcodeScannerView;
-    private Button switchFlashlightButton;
     private TextView tvQuestion;
     private Button goToScan;
     private BeepManager beepManager;
@@ -98,7 +94,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
         {
             mQr=null;
         }
-        getDriver().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
+        getHostActivity().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
 
     }
 
@@ -116,7 +112,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
         if(mUIGlobalIndice2!=null) {
             mUIGlobalIndice2.setVisibility(View.GONE);
         }
-        getDriver().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
+        getHostActivity().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
     }
 
     @Override
@@ -125,10 +121,8 @@ public class QRCodeFragment extends ChallengeFragment  implements
         // Inflate the layout for this fragment
         View v = super.onCreateView(inflater, container, R.layout.fragment_qrcode);
         barcodeScannerView = (DecoratedBarcodeView)v.findViewById(R.id.zxing_barcode_scanner);
-        barcodeScannerView.setTorchListener(this);
         beepManager=new BeepManager(getActivity());
 
-        switchFlashlightButton = (Button)v.findViewById(R.id.switch_flashlight);
         goToScan = (Button)v.findViewById(R.id.btn_scan);
         goToScan.setOnClickListener(this);
         vPresRoot=v.findViewById(R.id.presentation);
@@ -138,9 +132,6 @@ public class QRCodeFragment extends ChallengeFragment  implements
         mUITextIndices2= (LinearLayout) v.findViewById(R.id.ll_textIndices2);
         mUIGlobalIndice2 = (LinearLayout) v.findViewById(R.id.ll_rootIndices2);
 
-        if (!hasFlash()) {
-            switchFlashlightButton.setVisibility(View.GONE);
-        }
 
         capture = new CaptureManager(getActivity(), barcodeScannerView);
         capture.initializeFromIntent(getActivity().getIntent(), savedInstanceState);
@@ -185,32 +176,8 @@ public class QRCodeFragment extends ChallengeFragment  implements
         return barcodeScannerView.onKeyDown(keyCode, event) || getActivity().onKeyDown(keyCode, event);
     }
 
-    /**
-     * Check if the device's camera has a Flashlight.
-     * @return true if there is Flashlight, otherwise false.
-     */
-    private boolean hasFlash() {
-        return getActivity().getApplicationContext().getPackageManager()
-                .hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
-    }
 
-    public void switchFlashlight(View view) {
-        if ("on".equals(switchFlashlightButton.getText())) {
-            barcodeScannerView.setTorchOn();
-        } else {
-            barcodeScannerView.setTorchOff();
-        }
-    }
 
-    @Override
-    public void onTorchOn() {
-        switchFlashlightButton.setText("Off");
-    }
-
-    @Override
-    public void onTorchOff() {
-        switchFlashlightButton.setText("On");
-    }
 
     public void barcodeResult(final BarcodeResult result) {
         beepManager.playBeepSoundAndVibrate();
@@ -222,7 +189,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
                 Toast.makeText(getActivity(),mQr.getGoodMessage(), Toast.LENGTH_LONG).show();
             barcodeScannerView.pause();
             Activity act = getActivity();
-            getDriver().challengeValidate(mChallenge, mGame, (ChallengeDriver)getActivity());
+            getHostActivity().challengeValidate(mChallenge, mGame, HostActivity.cast(getActivity()));
         }else
         {
             if(mQr.getBadMessage()!=null)
@@ -259,7 +226,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
         Indice indice = super.showIndice();
         int indInd = mChallenge.getIndiceIndex();
 
-        if(indice!=null && getActivity() instanceof  ChallengeDriver)
+        if(indice!=null)
         {
 
             if(mUITextIndices2!=null)

+ 33 - 3
app/src/main/java/macampcorp/macamp/activities/fragments/QuestionFragment.java

@@ -1,16 +1,22 @@
 package macampcorp.macamp.activities.fragments;
 
+import android.app.Activity;
+import android.content.Context;
 import android.os.Bundle;
 import android.app.Fragment;
 import android.text.InputType;
+import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.activities.R;
 import macampcorp.macamp.game.challenges.Challenge;
 import macampcorp.macamp.game.challenges.Question;
@@ -49,6 +55,18 @@ public class QuestionFragment extends ChallengeFragment  {
         mUIImage = (ImageView) v.findViewById(R.id.iv_img);
         mUIQuestion = (TextView) v.findViewById(R.id.tv_question);
         mUIResponse = (EditText) v.findViewById(R.id.et_response);
+        mUIResponse.setOnEditorActionListener(new EditText.OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+                if (actionId == EditorInfo.IME_ACTION_DONE) {
+                    HostActivity ha = getHostActivity();
+                    ha.onClickValid(null);
+                    return true;
+                }
+                return false;
+            }
+
+        });
         return v;
     }
 
@@ -78,13 +96,16 @@ public class QuestionFragment extends ChallengeFragment  {
 
     public void onChallengeFailed()
     {
-        mUIResponse.clearFocus();
+        hideKeyboard(getActivity());
     }
 
 
     @Override
     protected void onInitChallenge(Challenge c) {
         super.onInitChallenge(c);
+        hideKeyboard(getActivity());
+
+
 
         if(c instanceof Question)
         {
@@ -101,7 +122,16 @@ public class QuestionFragment extends ChallengeFragment  {
     protected void onResetUi() {
         mUIResponse.setText("");
         mUIResponse.setHint("Entrer votre réponse");
-        getDriver().setVisibilityView(R.id.btn_valid, View.VISIBLE);
-        mUIResponse.clearFocus();
+        getHostActivity().setVisibilityView(R.id.btn_valid, View.VISIBLE);
+        hideKeyboard(getActivity());
+
+    }
+
+    public static void hideKeyboard(Activity activity) {
+        View view = activity.findViewById(android.R.id.content);
+        if (view != null) {
+            InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
+            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
+        }
     }
 }

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

@@ -3,7 +3,6 @@ package macampcorp.macamp.game;
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.DialogInterface;
-import android.util.Log;
 import android.widget.Toast;
 
 import org.json.JSONArray;
@@ -15,10 +14,9 @@ import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.activities.TutoActivity;
 import macampcorp.macamp.exceptions.BadConfigFileException;
-import macampcorp.macamp.exceptions.BadGameConfigException;
 import macampcorp.macamp.utils.L;
 
 public class Event implements Serializable {
@@ -92,7 +90,7 @@ public class Event implements Serializable {
         }
     }
 
-    public EventReturn exec(ChallengeDriver a, Game g)
+    public EventReturn exec(HostActivity a, Game g)
     {
         Class[] paramType = new Class[2];
         paramType[0] = Activity.class;
@@ -160,12 +158,12 @@ public class Event implements Serializable {
         // Add the buttons
         builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
-                g.getScheduler().schedule((ChallengeDriver)a, g);
+                g.getScheduler().schedule(HostActivity.cast(a), g);
             }
         });
         builder.setNegativeButton("Non", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
-                g.getScheduler().schedule((ChallengeDriver)a, g);
+                g.getScheduler().schedule(HostActivity.cast(a), g);
             }
         });
         // Set other dialog properties

+ 3 - 4
app/src/main/java/macampcorp/macamp/game/Game.java

@@ -2,7 +2,6 @@ package macampcorp.macamp.game;
 
 import android.app.Activity;
 import android.content.Context;
-import android.util.Log;
 
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -16,7 +15,7 @@ import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.exceptions.BadGameConfigException;
 import macampcorp.macamp.game.challenges.Challenge;
 import macampcorp.macamp.game.challenges.ChallengeReturn;
@@ -103,7 +102,7 @@ public class Game  implements Serializable {
         return c;
     }
 
-    public Challenge nextChallenge(ChallengeDriver cd)
+    public Challenge nextChallenge(HostActivity cd)
     {
         if(mCurrentStage==null) return null;
         mCurrentStage.nextChallenge(cd, this);
@@ -261,7 +260,7 @@ public class Game  implements Serializable {
         this.mLastReturn = mLastReturn;
     }
 
-    public Stage nextStage(ChallengeDriver cd) {
+    public Stage nextStage(HostActivity cd) {
         mCurrentStageIndex++;
         if(mCurrentStageIndex<=mStages.size())
         {

+ 2 - 3
app/src/main/java/macampcorp/macamp/game/Stage.java

@@ -1,7 +1,6 @@
 package macampcorp.macamp.game;
 
 import android.app.Activity;
-import android.util.Log;
 
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -10,7 +9,7 @@ import org.json.JSONObject;
 import java.io.Serializable;
 import java.util.ArrayList;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.challenges.Challenge;
 
 public class Stage  implements Serializable {
@@ -131,7 +130,7 @@ public class Stage  implements Serializable {
         return mChallenge.size();
     }
 
-    Challenge nextChallenge(ChallengeDriver dri, Game g)
+    Challenge nextChallenge(HostActivity dri, Game g)
     {
         mStep++;
         if(mStep<mChallenge.size())

+ 2 - 4
app/src/main/java/macampcorp/macamp/game/challenges/Challenge.java

@@ -1,7 +1,6 @@
 package macampcorp.macamp.game.challenges;
 
 import android.app.Activity;
-import android.util.Log;
 
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -12,9 +11,8 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.exceptions.BadChallengeConfigException;
-import macampcorp.macamp.exceptions.BadResourceTypeException;
 import macampcorp.macamp.game.Event;
 import macampcorp.macamp.game.Game;
 import macampcorp.macamp.game.Indice;
@@ -128,7 +126,7 @@ public abstract class Challenge implements Serializable{
     }
 
 
-    public void exec(Game g, ChallengeDriver act)
+    public void exec(Game g, HostActivity act)
     {
         act.setFragment(this);
     }

+ 2 - 2
app/src/main/java/macampcorp/macamp/game/scheduler/ChallengeTask.java

@@ -1,6 +1,6 @@
 package macampcorp.macamp.game.scheduler;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.Game;
 import macampcorp.macamp.game.challenges.Challenge;
 
@@ -20,7 +20,7 @@ public class ChallengeTask extends Task {
     }
 
     @Override
-    public int exec(Scheduler s, ChallengeDriver cd, Game g) {
+    public int exec(Scheduler s, HostActivity cd, Game g) {
         mChallenge.exec(g, cd);
         return TASK_CHALLENGE;
     }

+ 2 - 2
app/src/main/java/macampcorp/macamp/game/scheduler/EventTask.java

@@ -1,7 +1,7 @@
 package macampcorp.macamp.game.scheduler;
 
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.Event;
 import macampcorp.macamp.game.Game;
 
@@ -20,7 +20,7 @@ public class EventTask extends Task {
     }
 
     @Override
-    public int exec(Scheduler s, ChallengeDriver cd, Game g) {
+    public int exec(Scheduler s, HostActivity cd, Game g) {
         mEvent.exec(cd, g);
         cd.save();
         return s.schedule(cd, g);

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

@@ -1,6 +1,6 @@
 package macampcorp.macamp.game.scheduler;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.Game;
 import macampcorp.macamp.game.Resource;
 
@@ -20,7 +20,7 @@ public class ResourceTask extends Task {
     }
 
     @Override
-    public int exec(Scheduler s, ChallengeDriver cd, Game g) {
+    public int exec(Scheduler s, HostActivity cd, Game g) {
         cd.startResource(mResource);
         return TASK_RESOURCE;
     }

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

@@ -2,12 +2,10 @@ package macampcorp.macamp.game.scheduler;
 
 import android.app.Activity;
 import android.content.Intent;
-import android.util.Log;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 
-import macampcorp.macamp.activities.ChallengeDriver;
 import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.Event;
 import macampcorp.macamp.game.Game;
@@ -72,7 +70,7 @@ public class Scheduler implements Serializable {
 
 
 
-    public int schedule(ChallengeDriver cd, Game g)
+    public int schedule(HostActivity cd, Game g)
     {
         Task t = mStart;
         mLastTask=t;

+ 2 - 2
app/src/main/java/macampcorp/macamp/game/scheduler/SpecialTask.java

@@ -4,7 +4,7 @@ import android.app.Activity;
 import android.content.Intent;
 
 import macampcorp.macamp.activities.BombActivity;
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.Game;
 
 public class SpecialTask extends Task {
@@ -29,7 +29,7 @@ public class SpecialTask extends Task {
     }
 
     @Override
-    public int exec(Scheduler s, ChallengeDriver cd, Game g) {
+    public int exec(Scheduler s, HostActivity cd, Game g) {
         switch(mState)
         {
             case FINISHED_SUCESS:

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

@@ -2,7 +2,7 @@ package macampcorp.macamp.game.scheduler;
 
 import java.io.Serializable;
 
-import macampcorp.macamp.activities.ChallengeDriver;
+import macampcorp.macamp.activities.HostActivity;
 import macampcorp.macamp.game.Game;
 
 public abstract class Task implements Serializable {
@@ -17,7 +17,7 @@ public abstract class Task implements Serializable {
 
     public Task(int type){ mType=type;}
 
-    public abstract int exec(Scheduler s, ChallengeDriver cd, Game g);
+    public abstract int exec(Scheduler s, HostActivity cd, Game g);
 
 
     public Task end()

+ 1 - 10
app/src/main/res/layout/fragment_qrcode.xml

@@ -21,16 +21,7 @@
 
         </com.journeyapps.barcodescanner.DecoratedBarcodeView>
 
-        <Button
-            android:id="@+id/switch_flashlight"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_centerHorizontal="true"
-            android:onClick="switchFlashlight"
-            android:text="On"
-            app:layout_anchor="@+id/zxing_barcode_scanner"
-            app:layout_anchorGravity="bottom|center" />
+
 
         <LinearLayout
             android:id="@+id/ll_rootIndices2"