François Gautrais 7 роки тому
батько
коміт
2c32629025

+ 5 - 1
app/src/main/AndroidManifest.xml

@@ -67,7 +67,11 @@
         <activity
             android:name=".BombActivity"
             android:label="@string/title_activity_bomb"
-            android:theme="@style/AppTheme.NoActionBar"></activity>
+            android:theme="@style/AppTheme.NoActionBar" />
+        <activity android:name=".ErrorActivity"
+            android:theme="@style/AppTheme.NoActionBar.Fullscreen" />
+        <activity android:name=".LoadingActivity"
+            android:theme="@style/AppTheme.NoActionBar.Fullscreen" />
     </application>
 
 </manifest>

+ 0 - 1
app/src/main/assets/bib.res

@@ -1 +0,0 @@
-{"type" : "Image"}

+ 0 - 1
app/src/main/assets/creche.res

@@ -1 +0,0 @@
-{"type" : "Image"}

+ 0 - 6
app/src/main/assets/fin.res

@@ -1,6 +0,0 @@
-{
-	"comment" : "Nous avons réussi !",
-	"title" : "On a gagné",
-	"type" : "Audio",
-	"display" : true
-}

+ 0 - 6
app/src/main/assets/intro.res

@@ -1,6 +0,0 @@
-{
-	"comment" : "Nous avons reçu un étrange message...",
-	"title" : "Un étrange message",
-	"type" : "Audio",
-	"display" : true
-}

+ 0 - 6
app/src/main/assets/milieu.res

@@ -1,6 +0,0 @@
-{
-	"comment" : "Nous avons reçu un  nouveau message !",
-	"title" : "Un nouveau message",
-	"type" : "Audio",
-	"display" : true
-}

+ 0 - 1
app/src/main/assets/mjc.res

@@ -1 +0,0 @@
-{"type" : "Image"}

+ 0 - 1
app/src/main/assets/question.res

@@ -1 +0,0 @@
-{"type" : "Image"}

+ 34 - 0
app/src/main/assets/ressources.res

@@ -0,0 +1,34 @@
+{
+	"intro_fin" : { "type" : "Audio"},
+	"mpg" : { "type" : "Image" } ,
+	"question" : {"type" : "Image"}, 
+	"mjc" : {"type" : "Image"},
+	"milieu" : {
+		"comment" : "Nous avons reçu un  nouveau message !",
+		"title" : "Un nouveau message",
+		"type" : "Audio",
+		"display" : true
+	},	
+	"_intro" : {
+		"comment" : "Nous avons reçu un étrange message...",
+		"title" : "Un étrange message",
+		"type" : "Audio",
+		"display" : true
+	},
+	"intro" : {
+		"comment" : "Nous avons reçu un étrange message...",
+		"title" : "Un étrange message",
+		"type" : "Image",
+		"display" : true,
+		"file" : "creche.jpg"
+	},
+	"fin" : {
+		"comment" : "Nous avons réussi !",
+		"title" : "On a gagné",
+		"type" : "Audio",
+		"display" : true
+	},
+	"creche": {"type" : "Image"},
+	"bib" : {"type" : "Image"},
+	"ludo" :  {"type" : "Image"}
+}

+ 4 - 2
app/src/main/java/app/mar/activities/ChallengeFragment.java

@@ -77,12 +77,14 @@ public abstract class ChallengeFragment extends Fragment {
         if(r!=null && r.isImage() )
         {
             String name = r.getName();
+            String path = r.getFile();
+
             Bitmap bmp=null;
             try {
-                bmp = FileManager.openImage(getActivity(), name);
+                 bmp = FileManager.openImage(getActivity(), path);
             } catch (Exception e) {
                 e.printStackTrace();
-                Toast.makeText(getActivity(), "Impossible de charger '"+name+"'", Toast.LENGTH_LONG).show();
+                Toast.makeText(getActivity(), "Impossible de charger '"+name+"' ('"+path+"')", Toast.LENGTH_LONG).show();
             }
 
             mImage.setImageBitmap(bmp);

+ 68 - 0
app/src/main/java/app/mar/activities/ErrorActivity.java

@@ -0,0 +1,68 @@
+package app.mar.activities;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import app.mar.game.Game;
+import app.mar.game.scheduler.Scheduler;
+
+public class ErrorActivity extends AppCompatActivity {
+
+    protected Game mGame;
+    protected String mText="";
+    protected String mTitle="";
+    protected TextView mEt;
+    protected TextView mTvTitle;
+    public static int REQUEST_CODE=-1;
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_error);
+        mEt=(TextView)findViewById(R.id.message);
+        mTvTitle=(TextView)findViewById(R.id.title);
+        mText=getIntent().getExtras().getString("text", "");
+        mTitle=getIntent().getExtras().getString("title", "Error");
+        mEt.setText(mText);
+        mTvTitle.setText(mTitle);
+    }
+
+    public void onOk(View v)
+    {
+        setResult(0);
+        finish();
+    }
+
+    public static void error(Activity ctx, String text)
+    {
+        Intent intent = new Intent(ctx, ErrorActivity.class);
+        intent.putExtra("text", text);
+        ctx.startActivityForResult(intent, REQUEST_CODE);
+    }
+
+    public static void error(Activity ctx, String title, String text)
+    {
+        Intent intent = new Intent(ctx, ErrorActivity.class);
+        intent.putExtra("text", text);
+        intent.putExtra("title", title);
+        ctx.startActivityForResult(intent, REQUEST_CODE);
+    }
+
+    public static void dumpLog(Activity ctx)
+    {
+        String x =  Game.dumpLog();
+        error(ctx,x);
+    }
+
+    @Override
+    public void onBackPressed() {
+        setResult(0);
+        super.onBackPressed();
+    }
+
+}

+ 2 - 1
app/src/main/java/app/mar/activities/HostActivity.java

@@ -73,9 +73,10 @@ public class HostActivity extends Activity implements ChallengeDriver{
         mUIButtonIndice = (Button) findViewById(R.id.btn_indice);
         mUIButtonValid = (Button) findViewById(R.id.btn_valid);
 
+        ErrorActivity.error(this, "Salut", "ça va ?");
+        Log.e("-----", "Game.game()");
         mGame=Game.game();
 
-
         mUITimeLeft = findViewById(R.id.tv_car);
         mUICode = findViewById(R.id.tv_code);
 

+ 3 - 18
app/src/main/java/app/mar/activities/ImageViewerActivity.java

@@ -59,10 +59,10 @@ public class ImageViewerActivity extends AppCompatActivity {
                 Bitmap bmp=null;
                 Toast.makeText(this, "Chargement de '"+mResource.getName()+"'", Toast.LENGTH_SHORT).show();
                 try {
-                    bmp = FileManager.openImage(this, mResource.getName());
+                    bmp = FileManager.openImage(this, mResource.getFile());
                 } catch (Exception e) {
                     e.printStackTrace();
-                    Toast.makeText(this, "Impossible de charger '"+mResource.getName()+"'", Toast.LENGTH_LONG).show();
+                    Toast.makeText(this, "Impossible de charger '"+mResource.getName()+"' ('"+mResource.getFile()+"')", Toast.LENGTH_LONG).show();
                 }
 
                 mImageView.setImageBitmap(bmp);
@@ -71,25 +71,10 @@ public class ImageViewerActivity extends AppCompatActivity {
 
             }
 
-        } else if(getIntent().hasExtra("map") )
-        {
-            mContent=CONTENT_MAP;
-            Bitmap bmp=null;
-            try {
-                bmp = FileManager.openImage(this, "map");
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            title.setVisibility(View.GONE);
-            mImageView.setImageBitmap(bmp);
-            mAttacher = new PhotoViewAttacher(mImageView);
-            mAttacher.setMaximumScale(20);
-            mButton.setVisibility(View.GONE);
-        }else
+        } else
         {
             title.setText("Erreur");
         }
-        FontChangeCrawler.setFont(this);
 
     }
 

+ 68 - 0
app/src/main/java/app/mar/activities/LoadingActivity.java

@@ -0,0 +1,68 @@
+package app.mar.activities;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Toast;
+
+import app.mar.game.Game;
+
+
+
+public class LoadingActivity extends AppCompatActivity {
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data){
+        Log.e("----------", "result"+requestCode);
+        if(requestCode==HostActivity.REQUEST_CODE)
+            finish();
+        else
+            startGame();
+    }
+
+
+    public void startGame()
+    {
+        Intent intent = new Intent(this, HostActivity.class);
+        startActivityForResult(intent, HostActivity.REQUEST_CODE);
+        finish();
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_loading);
+
+        Game game=null;
+        if(Game.game()==null)
+        {
+            Game g = Game.load(this);
+            if (g != null ) {
+                game = g;
+                Game.setGame(game);
+                game.newSensorManager(this);
+                Toast.makeText(this, "Chargement", Toast.LENGTH_SHORT).show();
+            } else {
+                game = new Game("game_medium", this);
+                Game.setGame(game);
+                Toast.makeText(this, "Nouveau Jeu", Toast.LENGTH_SHORT).show();
+            }
+        }
+
+        if(Game.isFailed())
+            ErrorActivity.dumpLog(this);
+        else
+            startGame();
+
+
+    }
+
+    public void go(View v)
+    {
+        startGame();
+    }
+
+
+}

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

@@ -68,7 +68,7 @@ public class MediaViewerAcitvity extends AppCompatActivity implements MediaPlaye
 
             mTitle.setText(mResource.getTitle());
 
-            String path=mResource.getName();
+            String path=mResource.getFile();
             if(mResource.isAudio())
             {
                 mImageView.setVisibility(View.VISIBLE);

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

@@ -17,6 +17,7 @@ import android.widget.TextView;
 import java.util.ArrayList;
 
 import app.mar.game.Game;
+import app.mar.game.Resource;
 import app.mar.utils.files.FileManager;
 
 public class PermissionActivity extends AppCompatActivity {
@@ -88,6 +89,7 @@ public class PermissionActivity extends AppCompatActivity {
                 builder.setPositiveButton("Oui", new DialogInterface.OnClickListener() {
                     public void onClick(DialogInterface dialog, int id) {
                         startGame();
+                        Resource.logNotFound();
                     }
                 });
                 builder.setNegativeButton("Non", new DialogInterface.OnClickListener() {
@@ -95,6 +97,7 @@ public class PermissionActivity extends AppCompatActivity {
                         Game.erase(t);
                         Game.setGame(null);
                         startGame();
+                        Resource.logNotFound();
                     }
                 });
         // Set other dialog properties
@@ -127,7 +130,7 @@ public class PermissionActivity extends AppCompatActivity {
 
     public void startGame()
     {
-        Intent intent = new Intent(this, MenuActivity.class);
+        Intent intent = new Intent(this, LoadingActivity.class);
         startActivity(intent);
         finish();
     }

+ 4 - 4
app/src/main/java/app/mar/activities/QRCodeFragment.java

@@ -49,6 +49,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
     private CaptureManager capture;
     private DecoratedBarcodeView barcodeScannerView;
     private Button switchFlashlightButton;
+    private TextView tvQuestion;
     private Button goToScan;
     private BeepManager beepManager;
     private View vPresRoot;
@@ -97,15 +98,14 @@ public class QRCodeFragment extends ChallengeFragment  implements
 
         if(c instanceof QRCodeTreasure) {
             mQr = (QRCodeTreasure) c;
+            tvQuestion.setText(mQr.getComment());
         }else
         {
             mQr=null;
         }
-        if( (c instanceof QRCodeGeoTreasure) )
-        {
+        if( (c instanceof QRCodeGeoTreasure) ) {
             getDriver().startLocalisation();
         }
-
         getDriver().setVisibilityView(R.id.btn_valid, View.INVISIBLE);
 
     }
@@ -141,7 +141,7 @@ public class QRCodeFragment extends ChallengeFragment  implements
         goToScan.setOnClickListener(this);
         vPresRoot=v.findViewById(R.id.presentation);
         vScanRoot=v.findViewById(R.id.root_qr);
-
+        tvQuestion=v.findViewById(R.id.tv_question);
 
         mUITextIndices2= (LinearLayout) v.findViewById(R.id.ll_textIndices2);
         mUIGeoIndice2= (TextView) v.findViewById(R.id.tv_geoIndice2);

+ 26 - 0
app/src/main/java/app/mar/game/Event.java

@@ -1,6 +1,8 @@
 package app.mar.game;
 
 import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.util.Log;
 import android.widget.Toast;
 
@@ -150,6 +152,30 @@ public class Event implements Serializable {
         return new EventReturn(0,"OK");
     }
 
+    public EventReturn alert(final Activity a, final Game g)
+    {
+        String message = argAsString(0, "");
+        AlertDialog.Builder builder = new AlertDialog.Builder(a);
+        // Add the buttons
+        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int id) {
+                g.getScheduler().schedule((ChallengeDriver)a, g);
+            }
+        });
+        builder.setNegativeButton("Non", new DialogInterface.OnClickListener() {
+            public void onClick(DialogInterface dialog, int id) {
+                g.getScheduler().schedule((ChallengeDriver)a, g);
+            }
+        });
+        // Set other dialog properties
+        builder.setMessage(message);
+
+        // Create the AlertDialog
+        AlertDialog dialog = builder.create();
+        dialog.show();
+        return new EventReturn(0,"OK");
+    }
+
     public String getMethod() {
         return mMethod;
     }

+ 55 - 0
app/src/main/java/app/mar/game/Game.java

@@ -2,6 +2,7 @@ package app.mar.game;
 
 import android.app.Activity;
 import android.content.Context;
+import android.util.Log;
 import android.widget.Toast;
 
 import org.json.JSONArray;
@@ -63,6 +64,9 @@ public class Game  implements Serializable {
                 mStages.add(new Stage(this, arr.getJSONObject(i), act));
         } catch (JSONException e) {
             e.printStackTrace();
+            loge("Erreur le nombre d'étape n'est pas renseigné:");
+            loge(e.getMessage());
+            loge(e.getStackTrace().toString());
         }
 
 
@@ -70,6 +74,9 @@ public class Game  implements Serializable {
             mBomb=new Bomb(root.getString("password"), root.getInt("max_time"));
         } catch (JSONException e) {
             e.printStackTrace();
+            loge("Erreur le password:");
+            loge(e.getMessage());
+            loge(e.getStackTrace().toString());
         }
 
         mCurrentStageIndex=-1;
@@ -312,6 +319,8 @@ public class Game  implements Serializable {
         return gGame;
     }
 
+
+
     public boolean hasResource(String name)
     {
         return mResources.contains(name);
@@ -378,4 +387,50 @@ public class Game  implements Serializable {
     public Scheduler getScheduler(){
         return mSched;
     }
+
+
+
+
+
+
+
+    private static String sLog="";
+
+    public static String getlog(){ return sLog; }
+
+    public static String dumpLog(){
+        String log = sLog;
+        sLog="";
+        return log;
+    }
+
+    public static void loge(String text)
+    {
+        log(text);
+        Log.e("custom_log", text);
+    }
+    public static void logw(String text)
+    {
+        log(text);
+        Log.w("custom_log", text);
+    }
+    public static void logv(String text)
+    {
+        if(false) log(text);
+        Log.v("custom_log", text);
+    }
+    public static void logi(String text)
+    {
+        if(false) log(text);
+        Log.i("custom_log", text);
+    }
+
+    public static void log(String text)
+    {
+        sLog+=text+"\n";
+    }
+    protected static boolean sFail=false;
+    public static void fail() {sFail=true;}
+    public static boolean isFailed(){return sFail;}
+    public static void resetFail(){sFail=false;}
 }

+ 77 - 2
app/src/main/java/app/mar/game/Resource.java

@@ -1,13 +1,17 @@
 package app.mar.game;
 
 import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.graphics.Bitmap;
 import android.util.Log;
 
+import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 
 import app.mar.utils.files.JSONAssetsManager;
 import min3d.core.Object3d;
@@ -31,19 +35,79 @@ public class Resource implements Serializable {
     protected int   mStage;
     protected String mType = ""; //3D Image Audio Video
     protected String mTitle= ""; //3D Image Audio Video
+    private  static JSONObject mRessourcesList = null;
+    public static ArrayList<String> mNotFound = new ArrayList<>();
+    protected String mFile = null;
+
+    public String getFile() {
+        if(mFile!=null)
+            return mFile;
+        return mName;
+    }
+
+    public boolean isFile() {
+        return mFile!=null;
+    }
+
+    public static void initResourceList(Activity act)
+    {
+        if(mRessourcesList!=null) return;
+        Game.logv( "Chargement de la liste des ressources...");
+        JSONObject obj = JSONAssetsManager.load(act, "ressources.res");
+        if(obj==null)
+        {
+            Game.logw("Attention il n'existe pas de fichier pour la liste des ressrouecs");
+            return;
+        }
+        mRessourcesList=obj;
+    }
+
+    public static JSONObject getRessourceDataFromList(String name)
+    {
+        try {
+            if(mRessourcesList!=null)
+                return mRessourcesList.getJSONObject(name);
+        } catch (JSONException e) {
+            Game.logw("Impossiblle de trouver la ressource '"+name+"' dans la liste des ressources");
+        }
+        return null;
+    }
+
+    public static void logNotFound()
+    {
+        Log.e("LoadingRes", "Liste des ressources non-trouvées:");
+        for(int i=0; i<mNotFound.size(); i++)
+            Log.e("LoadingRes", "\t'"+mNotFound.get(i)+"'");
+    }
+
+    public static void setNotFound(String name)
+    {
+        for(int i=0; i< mNotFound.size(); i++)
+            if(mNotFound.get(i).compareTo(name)==0) return;
+        mNotFound.add(name);
+    }
 
     protected void loadResourceData(Activity act)
     {
-        Log.w("-----", "Loading resource '"+mName+"'");
+        initResourceList(act);
+        Game.logv( "--- Chargement de la ressource '"+mName+"' --- ");
         JSONObject obj = JSONAssetsManager.load(act, mName+"_res");
         if(obj==null) obj = JSONAssetsManager.load(act, mName+".res");
+        if(obj==null) obj = getRessourceDataFromList(mName);
+        if(obj == null)
+        {
+            Game.loge("\tLa ressource '"+mName+"' est introuvable.");
+            setNotFound(mName);
+            Game.fail();
+            return;
+        }
 
         //mandatory
         try {
             mType = obj.getString("type");
         } catch(JSONException e)
         {
-            Log.e("-----", "Enable to load resource '"+mName+"'");
+            Game.loge("\tLa ressource '"+mName+"' n'a pas d'attribut 'type' valide (String)");
             e.printStackTrace();
         }
 
@@ -62,6 +126,13 @@ public class Resource implements Serializable {
         } catch (JSONException e) {
         }
 
+        try{
+            mFile = obj.getString("file");
+        }catch (JSONException e)
+        {
+            mFile=null;
+        }
+
 
         try {
             mPosition.x = (float) obj.getJSONArray("position").getDouble(0);
@@ -87,6 +158,10 @@ public class Resource implements Serializable {
         }
     }
 
+    public boolean hasFile(){
+        return mFile!=null;
+    }
+
     public void loadModel(Activity context)
     {
         get3DModel(context);

+ 3 - 0
app/src/main/java/app/mar/game/challenges/QRCodeTreasure.java

@@ -39,6 +39,9 @@ public class QRCodeTreasure extends Treasure {
         }
     }
 
+    public String getComment() {
+        return mComment;
+    }
 
     public String getQRValue() {
         return mQRValue;

+ 9 - 0
app/src/main/java/app/mar/game/scheduler/Scheduler.java

@@ -1,11 +1,14 @@
 package app.mar.game.scheduler;
 
+import android.app.Activity;
+import android.content.Intent;
 import android.util.Log;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 
 import app.mar.activities.ChallengeDriver;
+import app.mar.activities.HostActivity;
 import app.mar.game.Event;
 import app.mar.game.Game;
 import app.mar.game.Resource;
@@ -84,6 +87,12 @@ public class Scheduler implements Serializable {
         return Task.TASK_NONE;
     }
 
+    public void scheduleFromActivity(Activity cd, Game g)
+    {
+        Intent it = new Intent(cd, HostActivity.class);
+        cd.startActivity(it);
+    }
+
     public ArrayList<Task> getTaskList()
     {
         ArrayList<Task> at = new ArrayList<Task>();

+ 59 - 26
app/src/main/java/app/mar/utils/files/JSONAssetsManager.java

@@ -3,6 +3,7 @@ package app.mar.utils.files;
 import android.app.Activity;
 import android.util.Log;
 
+import org.json.JSONArray;
 import org.json.JSONObject;
 
 import java.io.ByteArrayOutputStream;
@@ -12,36 +13,68 @@ import java.io.InputStream;
  * Created by ptitcois on 27/03/17.
  */
 public class JSONAssetsManager {
-        public static JSONObject load(Activity context, String name)
-        {
-            InputStream inputStream = null;
-            try {
-                inputStream = FileManager.openFile(context, name);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+    public static JSONObject load(Activity context, String name)
+    {
+        InputStream inputStream = null;
+        try {
+            inputStream = FileManager.openFile(context, name);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
 
-            int ctr;
-            try {
+        int ctr;
+        try {
+            ctr = inputStream.read();
+            while (ctr != -1) {
+                byteArrayOutputStream.write(ctr);
                 ctr = inputStream.read();
-                while (ctr != -1) {
-                    byteArrayOutputStream.write(ctr);
-                    ctr = inputStream.read();
-                }
-                inputStream.close();
-            } catch (Exception e) {
-                e.printStackTrace();
             }
-            Log.v("Text Data", byteArrayOutputStream.toString());
-            try {
-                // Parse the data into jsonobject to get original data in form of json.
-                JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());
-                return jObject;
-            } catch (Exception e) {
-                e.printStackTrace();
+            inputStream.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Log.v("Text Data", byteArrayOutputStream.toString());
+        try {
+            // Parse the data into jsonobject to get original data in form of json.
+            JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());
+            return jObject;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static JSONArray loadArray(Activity context, String name)
+    {
+        InputStream inputStream = null;
+        try {
+            inputStream = FileManager.openFile(context, name);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+
+        int ctr;
+        try {
+            ctr = inputStream.read();
+            while (ctr != -1) {
+                byteArrayOutputStream.write(ctr);
+                ctr = inputStream.read();
             }
-            return null;
+            inputStream.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Log.v("Text Data", byteArrayOutputStream.toString());
+        try {
+            // Parse the data into jsonobject to get original data in form of json.
+            JSONArray jObject = new JSONArray(byteArrayOutputStream.toString());
+            return jObject;
+        } catch (Exception e) {
+            e.printStackTrace();
         }
+        return null;
+    }
 
 }

+ 48 - 0
app/src/main/res/layout/activity_error.xml

@@ -0,0 +1,48 @@
+<?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:gravity="top"
+    android:orientation="vertical"
+    tools:context="app.mar.activities.ErrorActivity">
+
+
+    <TextView
+        android:id="@+id/title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:text="Erreur:"
+        android:textSize="24sp"
+        android:textStyle="bold" />
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_weight="1">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="top"
+            android:orientation="vertical">
+
+            <TextView
+                android:id="@+id/message"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:text="TextView" />
+        </LinearLayout>
+    </ScrollView>
+
+    <Button
+        android:id="@+id/button"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:onClick="onOk"
+        android:text="Ok" />
+
+</LinearLayout>

+ 22 - 0
app/src/main/res/layout/activity_loading.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context="app.mar.activities.LoadingActivity">
+
+    <Button
+        android:id="@+id/button10"
+        android:layout_width="314dp"
+        android:layout_height="118dp"
+        android:layout_marginEnd="8dp"
+        android:layout_marginLeft="8dp"
+        android:layout_marginRight="8dp"
+        android:layout_marginStart="8dp"
+        android:onClick="go"
+        android:text="lancer"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        tools:layout_editor_absoluteY="-14dp" />
+</android.support.constraint.ConstraintLayout>