François Gautrais 8 yıl önce
ebeveyn
işleme
7590195613

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

@@ -34,7 +34,10 @@
             android:label="@string/title_activity_settings" />
         <activity android:name=".TransferActivity" />
         <activity android:name=".EndActivity" />
-        <activity android:name=".NewMenuActivity">
+        <activity android:name=".MARMenuActivity">
+        </activity>
+
+        <activity android:name=".SEMenuActivity">
         </activity>
 
         <activity

+ 69 - 6
app/src/main/java/app/brest/app/brest/ui/ResourceArrayAdapter.java

@@ -5,16 +5,23 @@ import android.content.Context;
 import android.content.Intent;
 import android.graphics.Color;
 import android.graphics.Typeface;
+import android.util.Log;
+import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import java.util.List;
 
+import app.brest.testmin3d.R;
 import app.brest.testmin3d.ResourceListActivity;
 import app.brest.testmin3d.ViewerActivity;
+import app.brest.utils.FontChangeCrawler;
 import app.brest.utils.app.brest.game.Resource;
 
 /**
@@ -24,45 +31,101 @@ public class ResourceArrayAdapter extends ArrayAdapter<Object> implements  Adapt
     protected Context mContext;
     protected List<Object> mList;
     public ResourceArrayAdapter(Context context, int resource, List<Object> objects) {
-        super(context, resource, objects);
+        super(context, R.layout.array_layout, objects);
         mContext=context;
         mList=objects;
+
     }
 
     @Override
     public View getView(int position, View convertView,
                         ViewGroup parent) {
+
+        /*
         View view =super.getView(position, convertView, parent);
 
         TextView textView=(TextView) view.findViewById(android.R.id.text1);
 
-            /*YOUR CHOICE OF COLOR*/
-        textView.setTextColor(Color.rgb(0x33, 0xb5, 0xe5));
+        textView.setTextColor(Color.rgb(0, 0, 0));
 
         if(mList.get(position) instanceof String){
             textView.setTextSize(30);
-            textView.setTypeface(null, Typeface.BOLD);
+            //textView.setTypeface(null, Typeface.BOLD);
         }else{
             textView.setTextSize(15);
-            textView.setTypeface(null, Typeface.NORMAL);
+            //textView.setTypeface(null, Typeface.NORMAL);
+        }
+        LinearLayout ll = new LinearLayout(mContext);
+        ImageButton ib = new ImageButton(mContext);
+        ib.setImageResource(R.drawable.fleche);
+        ll.addView(ib);
+        ll.addView(view);
+        FontChangeCrawler.setFont(view, mContext);
+
+        return ll;*/
+        //Android nous fournit un convertView null lorsqu'il nous demande de la créer
+        //dans le cas contraire, cela veux dire qu'il nous fournit une vue recyclée
+        if(convertView == null){
+            //Nous récupérons notre row_tweet via un LayoutInflater,
+            //qui va charger un layout xml dans un objet View
+            convertView = LayoutInflater.from(getContext()).inflate(R.layout.array_layout, parent, false);
+        }
+
+        TextView textView=(TextView) convertView.findViewById(R.id.textObject);
+
+        textView.setTextColor(Color.rgb(0, 0, 0));
+
+        if(mList.get(position) instanceof String){
+            textView.setTextSize(30);
+            String title  = (String) mList.get(position);
+            textView.setText(title);
+            //textView.setTypeface(null, Typeface.BOLD);
+        }else{
+            textView.setTextSize(22);
+            final Resource re  = (Resource) mList.get(position);
+            //textView.setTypeface(null, Typeface.NORMAL);
+            textView.setText(re.getTitle());
+            convertView.setOnClickListener(new View.OnClickListener(){
+
+                @Override
+                public void onClick(View view) {
+                    Intent intent = new Intent(mContext, ViewerActivity.class);
+                    intent.putExtra("resource", re);
+                    mContext.startActivity(intent);
+                }
+            });
+
         }
+        FontChangeCrawler.setFont(textView, mContext);
+
+
+        //nous renvoyons notre vue à l'adapter, afin qu'il l'affiche
+        //et qu'il puisse la mettre à recycler lorsqu'elle sera sortie de l'écran
+        return convertView;
 
 
-        return view;
     }
 
     @Override
     public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+        Log.e("__________", "OK");
         if (adapterView.getItemAtPosition(i) instanceof Resource) {
             Resource item = (Resource) adapterView.getItemAtPosition(i);
+            Log.e("__________", "ItemClick: "+i+" "+l+ " Ressource");
 
             Intent intent = new Intent(mContext, ViewerActivity.class);
             intent.putExtra("resource", item);
             mContext.startActivity(intent);
 
         }else if(adapterView.getItemAtPosition(i) instanceof String)
+        {
+            Log.e("__________", "ItemClick: "+i+" "+l+ " String");
+
+        }
+        else
         {
 
+            Log.e("__________", "ItemClick: "+i+" "+l+ " Autre");
         }
     }
 }

+ 7 - 7
app/src/main/java/app/brest/testmin3d/ARActivity.java

@@ -153,9 +153,9 @@ public class ARActivity extends RendererActivity
     {
         float radius = _radius;
         return new Number3d((float)(radius*Math.sin(deltaAngle)),
-                            0,
-                            (float)(15+radius*Math.cos(deltaAngle))
-                        );
+                0,
+                (float)(15+radius*Math.cos(deltaAngle))
+        );
     }
 
     private Runnable updateTimerThread = new Runnable() {
@@ -343,7 +343,7 @@ public class ARActivity extends RendererActivity
         String toDisplay ="";
         boolean detected = false;
         boolean isAR = mGame.getmSettings().isARMode();
-       // String dete = "Detected:\n";
+        // String dete = "Detected:\n";
         scene.clear();
 
 
@@ -410,7 +410,7 @@ public class ARActivity extends RendererActivity
     }
 
 
-     @Override
+    @Override
     protected void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);
@@ -508,7 +508,7 @@ public class ARActivity extends RendererActivity
                     NumberFormat formatter = new DecimalFormat("#0.0");
                     mTvAngle.setText("X : "+formatter.format(mGame.getPlayer().getOrientation())+"°\nY : "+
                             formatter.format(mGame.getPlayer().getOrientationY())
-                                    +"°\nZ : "+formatter.format(mGame.getPlayer().getOrientationZ())+"°");
+                            +"°\nZ : "+formatter.format(mGame.getPlayer().getOrientationZ())+"°");
                 }
             });
 
@@ -605,7 +605,7 @@ public class ARActivity extends RendererActivity
 
         if(stageFinished)
         {
-           finished = mGame.nextStage();
+            finished = mGame.nextStage();
         }
 
         if(finished)

+ 60 - 0
app/src/main/java/app/brest/testmin3d/MARMenuActivity.java

@@ -0,0 +1,60 @@
+package app.brest.testmin3d;
+
+import android.content.res.Resources;
+import android.util.TypedValue;
+import android.widget.Button;
+
+/**
+ * Created by ptitcois on 06/06/17.
+ */
+public class MARMenuActivity extends MenuActivity{
+    protected  void refreshMenuStyle()
+    {
+        mRootLayout.setBackgroundResource(R.drawable.background);
+        int h4 = mHeight/3;
+        int w4 = mWidth/3;
+        int w = (int)(w4*1.25);
+        int h = dpToPx((int)(mBBriefing.getTextSize()*1.5));
+
+        moveView(mBBriefing, w4-2*w/3, mHOffset+h4-h,w,h);
+        moveView(mBInvotory, 2*w4-w/3, mHOffset+h4-h,w,h);
+        moveView(mBMap, w4-2*w/3, mHOffset+2*h4,w,h);
+        moveView(mBOptions, 2*w4-w/3, mHOffset+2*h4,w,h);
+        moveView(mBSend, mWidth/2-w, mHOffset+2*h4+4*h/3, 2*w, h);
+        ((Button)mBMenu).setTextSize(25);
+        //mBMenu.setTypeface(null,Typeface.BOLD);
+        sendVisibility();
+
+    }
+
+
+
+    protected void setUpMenuStyle()
+    {
+        mIbScanner = new Button(this);
+        //mIbScanner.setImageResource(R.drawable.scanner);
+        //mIbScanner.setScaleType(ImageView.ScaleType.FIT_CENTER);
+        mRootLayout.addView(mIbScanner);
+        mIbScanner.setBackgroundResource(R.drawable.uibuttoncircle);
+        mIbScanner.setText("Scanner");
+        mIbScanner.setTextColor(getResources().getColor(R.color.dull_4));
+        mIbScanner.setTextSize(22);
+        mIbScanner.setOnClickListener(this);
+
+        moveView(mIbScanner, mWidth / 2 - mHeight / 8, mHOffset + mHeight / 2 - mHeight / 8, mHeight / 4, mHeight / 4);
+
+        mBBriefing = newButton("Briefing");
+        mBInvotory = newButton("Inventaire");
+        mBMap = newButton("Carte");
+        mBOptions = newButton("Options");
+        mBMenu = newButton("Menu Principal");
+        mBMenu.setBackgroundResource(R.drawable.title);
+        mBSend = newButton("Envoyer les données");
+        Resources r = getResources();
+        float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, r.getDisplayMetrics());
+        moveView(mBMenu, 0, 0, mWidth, (int) px);
+
+        mGame.pickResource("aecolepublique");
+
+    }
+}

+ 50 - 117
app/src/main/java/app/brest/testmin3d/NewMenuActivity.java → app/src/main/java/app/brest/testmin3d/MenuActivity.java

@@ -30,49 +30,33 @@ import app.brest.utils.app.brest.game.Game;
 import app.brest.utils.app.brest.game.Resource;
 import app.brest.utils.app.brest.game.Stage;
 
-public class NewMenuActivity extends Activity implements View.OnClickListener{
+public abstract class  MenuActivity extends Activity implements View.OnClickListener{
 
-    private int mWidth;
-    private int mHeight;
+    protected int mWidth;
+    protected int mHeight;
     protected Game mGame;
 
-    private RelativeLayout mRootLayout;
-    private Handler mCustomHandler = new Handler();
+    protected RelativeLayout mRootLayout;
+    protected Handler mCustomHandler = new Handler();
     //private final int COLOR_BACKGROUND = ;
-    private final int COLOR_SHAPE = R.color.dull_2;
-    private final int COLOR_BACKGROUND_SECOND = R.color.dull_3;
-    private final int COLOR_OTHER = R.color.dull_4;
-    private final int COLOR_TEXT = R.color.dull_5;
-
-    private Button mIbScanner;
-    private Button mBBriefing;
-    private Button mBInvotory;
-    private Button mBMap;
-    private Button mBOptions;
-    private Button mBMenu;
-    private Button mBSend;
-    private int mHOffset=0;
-
-    private void setUpStyle()
-    {
-        mRootLayout.setBackgroundResource(R.drawable.background);
-        int h4 = mHeight/3;
-        int w4 = mWidth/3;
-        int w = (int)(w4*1.25);
-        int h = dpToPx((int)(mBBriefing.getTextSize()*1.5));
-
-        moveView(mBBriefing, w4-2*w/3, mHOffset+h4-h,w,h);
-        moveView(mBInvotory, 2*w4-w/3, mHOffset+h4-h,w,h);
-        moveView(mBMap, w4-2*w/3, mHOffset+2*h4,w,h);
-        moveView(mBOptions, 2*w4-w/3, mHOffset+2*h4,w,h);
-        moveView(mBSend, mWidth/2-w, mHOffset+2*h4+4*h/3, 2*w, h);
-        mBMenu.setTextSize(25);
-        //mBMenu.setTypeface(null,Typeface.BOLD);
-        sendVisibility();
+    protected final int COLOR_SHAPE = R.color.dull_2;
+    protected final int COLOR_BACKGROUND_SECOND = R.color.dull_3;
+    protected final int COLOR_OTHER = R.color.dull_4;
+    protected final int COLOR_TEXT = R.color.dull_5;
 
-    }
+    protected Button mIbScanner;
+    protected Button mBBriefing;
+    protected Button mBInvotory;
+    protected Button mBMap;
+    protected Button mBOptions;
+    protected View mBMenu;
+    protected Button mBSend;
+    protected int mHOffset=0;
 
 
+    protected  void refreshMenuStyle(){}
+
+    protected void setUpMenuStyle(){}
 
     private void updateSize()
     {
@@ -122,85 +106,33 @@ public class NewMenuActivity extends Activity implements View.OnClickListener{
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-            setContentView(R.layout.activity_new_menu);
-            mRootLayout = (RelativeLayout) findViewById(R.id.menu_root);
-
-
-            Game g = Game.load(this);
-            System.out.println( (g != null) + " == " + (mGame == null) );
-            if (g != null && mGame == null) {
-                mGame = g;
-                Game.setGame(mGame);
-                mGame.newSensorManager(this);
-                Toast.makeText(this, "Chargement", Toast.LENGTH_LONG).show();
-            } else if (mGame == null) {
-                mGame = new Game("game_medium", this);
-                Game.setGame(mGame);
-                Toast.makeText(this, "Nouveau Jeu", Toast.LENGTH_LONG).show();
-            } else if (mGame == null) {
-                Toast.makeText(this, "Erreur", Toast.LENGTH_LONG).show();
-                throw new Error("Le jeu n'est pas sauvegardé");
-            }
-
-            updateSize();
-            Settings.setSettings(mGame.getmSettings());
-
-            mIbScanner = new Button(this);
-            //mIbScanner.setImageResource(R.drawable.scanner);
-            //mIbScanner.setScaleType(ImageView.ScaleType.FIT_CENTER);
-            mRootLayout.addView(mIbScanner);
-            mIbScanner.setBackgroundResource(R.drawable.uibuttoncircle);
-            mIbScanner.setText("Scanner");
-            mIbScanner.setTextColor(getResources().getColor(R.color.dull_4));
-            mIbScanner.setTextSize(22);
-            mIbScanner.setOnClickListener(this);
-
-            moveView(mIbScanner, mWidth / 2 - mHeight / 8, mHOffset + mHeight / 2 - mHeight / 8, mHeight / 4, mHeight / 4);
-
-            mBBriefing = newButton("Briefing");
-            mBInvotory = newButton("Inventaire");
-            mBMap = newButton("Carte");
-            mBOptions = newButton("Options");
-            mBMenu = newButton("Menu Principal");
-            mBMenu.setBackgroundResource(R.drawable.title);
-            mBSend = newButton("Envoyer les données");
-            Resources r = getResources();
-            float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, r.getDisplayMetrics());
-            moveView(mBMenu, 0, 0, mWidth, (int) px);
-            //mBSend = newButton("Envoyer");
-
-
-            setUpStyle();
-            mCustomHandler.postDelayed(updateTimerThread, 10);
-
-/*
-        mGame.pickResource("aa");
-        mGame.pickResource("ab");
-        mGame.pickResource("ac");
-        mGame.pickResource("ad");
-        mGame.pickResource("ae");
-        mGame.pickResource("ag");
-        mGame.pickResource("ah");
-        mGame.pickResource("ai");
-        mGame.nextStage();
-        mGame.pickResource("ba");
-        mGame.pickResource("bb");
-        mGame.pickResource("bc");
-        mGame.pickResource("bd");
-        mGame.pickResource("be");
-        mGame.pickResource("bf");
-        mGame.pickResource("bg");
-        mGame.pickResource("bh");
-        mGame.nextStage();
-        mGame.pickResource("ca");
-        mGame.pickResource("cb");
-        mGame.pickResource("cc");
-        mGame.pickResource("cd");
-        mGame.pickResource("ce");
-        mGame.pickResource("cf");
-        mGame.pickResource("cg");
-            FontChangeCrawler.setFont(this);
-*/
+        setContentView(R.layout.activity_new_menu);
+        mRootLayout = (RelativeLayout) findViewById(R.id.menu_root);
+
+
+        Game g = Game.load(this);
+        System.out.println( (g != null) + " == " + (mGame == null) );
+        if (g != null && mGame == null) {
+            mGame = g;
+            Game.setGame(mGame);
+            mGame.newSensorManager(this);
+            Toast.makeText(this, "Chargement", Toast.LENGTH_LONG).show();
+        } else if (mGame == null) {
+            mGame = new Game("game_medium", this);
+            Game.setGame(mGame);
+            Toast.makeText(this, "Nouveau Jeu", Toast.LENGTH_LONG).show();
+        } else if (mGame == null) {
+            Toast.makeText(this, "Erreur", Toast.LENGTH_LONG).show();
+            throw new Error("Le jeu n'est pas sauvegardé");
+        }
+
+        updateSize();
+        Settings.setSettings(mGame.getmSettings());
+
+        setUpMenuStyle();
+        refreshMenuStyle();
+
+        mCustomHandler.postDelayed(updateTimerThread, 10);
         FontChangeCrawler.setFont(this);
     }
 
@@ -292,10 +224,10 @@ public class NewMenuActivity extends Activity implements View.OnClickListener{
     {
         super.onResume();
         mGame = Game.game();
-        setUpStyle();
+        refreshMenuStyle();
     }
 
-    private void sendVisibility()
+    protected void sendVisibility()
     {
         if(mGame.canSendData()) mBSend.setVisibility(View.VISIBLE);
         else mBSend.setVisibility(View.INVISIBLE);
@@ -321,4 +253,5 @@ public class NewMenuActivity extends Activity implements View.OnClickListener{
     }
 
 
+
 }

+ 2 - 6
app/src/main/java/app/brest/testmin3d/PermissionActivity.java

@@ -3,17 +3,13 @@ package app.brest.testmin3d;
 import android.Manifest;
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.location.LocationManager;
 import android.support.v4.app.ActivityCompat;
 import android.support.v4.content.ContextCompat;
 import android.support.v7.app.AppCompatActivity;
 import android.os.Bundle;
 import android.text.Html;
-import android.util.Log;
 import android.view.View;
-import android.widget.ImageView;
 import android.widget.TextView;
-import android.widget.Toast;
 
 import app.brest.utils.FontChangeCrawler;
 import app.brest.utils.files.FileManager;
@@ -39,7 +35,7 @@ public class PermissionActivity extends AppCompatActivity {
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_permission);
-        FontChangeCrawler.setFont(this);
+        //FontChangeCrawler.setFont(this);
 
         FileManager.init(this);
         mText = (TextView) findViewById(R.id.disclamer);
@@ -102,7 +98,7 @@ public class PermissionActivity extends AppCompatActivity {
     {
         if(m_nPerm==0)
         {
-            Intent intent = new Intent(this, NewMenuActivity.class);
+            Intent intent = new Intent(this, SEMenuActivity.class);
             startActivity(intent);
         }
     }

+ 4 - 4
app/src/main/java/app/brest/testmin3d/ResourceListActivity.java

@@ -83,15 +83,15 @@ public class ResourceListActivity extends Activity {
             ArrayList< ArrayList<Resource> > resources = mGame.getResourceByStage();
             ArrayList<Object> obs = new ArrayList<Object>();
             for(int i = 0; i< resources.size(); i++) {
-                obs.add("Étape "+i);
+                //obs.add("Étape "+i);
                 for(int j=0; j<resources.get(i).size(); j++)
                     obs.add(resources.get(i).get(j));
             }
             ResourceArrayAdapter aa;
-            aa = new ResourceArrayAdapter(this, android.R.layout.simple_list_item_1, obs);
-            mList.setOnItemClickListener(aa);
+            aa = new ResourceArrayAdapter(this, R.layout.array_layout, obs);
 
             mList.setAdapter(aa);
+            mList.setOnItemClickListener(aa);
         }
     }
 
@@ -100,11 +100,11 @@ public class ResourceListActivity extends Activity {
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_resource_list);
-        FontChangeCrawler.setFont(this);
         mGame = (Game)getIntent().getSerializableExtra("game");
 
         mList = (ListView) findViewById(R.id.list_layout);
         fill();
+        FontChangeCrawler.setFont(this);
     }
 
 

+ 92 - 0
app/src/main/java/app/brest/testmin3d/SEMenuActivity.java

@@ -0,0 +1,92 @@
+package app.brest.testmin3d;
+
+import android.content.res.Resources;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+/**
+ * Created by ptitcois on 26/06/17.
+ */
+public class SEMenuActivity extends MenuActivity {
+
+    protected TextView mTVmenu;
+
+    protected  void refreshMenuStyle()
+    {
+        int size =  15;
+        int offset=mWidth/5;
+        mRootLayout.setBackgroundResource(R.drawable.background);
+        int h4 = mHeight/3+mHeight/100;
+        int w4 = mWidth/5;
+        int w = (int)(mHeight/ 4);
+        int h = dpToPx((int)(mBBriefing.getTextSize()*1.5));
+        int H = (int)(h*1.24);
+
+        moveView(mBBriefing, mWidth/8, offset+h4,          w*2,h);
+        moveView(mBInvotory, mWidth/8, offset+h4+H,        w*2,h);
+        moveView(mBMap, mWidth/8, offset+h4+2*H,           w*2,h);
+        moveView(mBOptions, mWidth/8, offset+h4+3*H,       w*2,h);
+        moveView(mIbScanner, mWidth/8, offset+h4+4*H,      w*2, h);
+        moveView(mBSend, mWidth/8, offset+h4+5*H,          w*2, h);
+        ((TextView)mBMenu).setTextSize(25);
+        moveView(mBMenu, mWidth/10, 0, mWidth, mHeight/3);
+        moveView(mTVmenu, mWidth/7, h4);
+
+        mBBriefing.setTextSize(size);
+        mBInvotory.setTextSize(size);
+        mBMap.setTextSize(size);
+        mBOptions.setTextSize(size);
+        mIbScanner.setTextSize(size);
+        mBSend.setTextSize(size);
+        ((TextView)mBMenu).setTextSize(30);
+        ((TextView)mBMenu).setGravity(Gravity.CENTER);
+        //mBMenu.setTypeface(null,Typeface.BOLD);
+        //sendVisibility();
+        mBSend.setVisibility(View.INVISIBLE);
+
+    }
+
+    protected void setUpMenuStyle()
+    {
+        /*mIbScanner = new Button(this);
+        //mIbScanner.setImageResource(R.drawable.scanner);
+        //mIbScanner.setScaleType(ImageView.ScaleType.FIT_CENTER);
+        mRootLayout.addView(mIbScanner);
+        mIbScanner.setBackgroundResource(R.drawable.uibuttoncircle);
+        mIbScanner.setText("Scanner");
+        mIbScanner.setTextColor(getResources().getColor(R.color.dull_4));
+        mIbScanner.setTextSize(22);
+        mIbScanner.setOnClickListener(this);*/
+
+        //moveView(mIbScanner, mWidth / 2 - mHeight / 8, mHOffset + mHeight / 2 - mHeight / 8, mHeight / 4, mHeight / 4);
+        mTVmenu = new TextView(this);
+        mTVmenu.setText("Menu");
+        moveView(mTVmenu, mWidth/7, mHeight/5);
+        mRootLayout.addView(mTVmenu);
+        mTVmenu.setTextSize(20);
+
+        mBMenu = new TextView(this);
+        ((TextView)mBMenu).setText("Une terreur dans la ville");
+        mRootLayout.addView(((TextView)mBMenu));
+        moveView(mBMenu, mWidth/10, 0, mWidth, 600);
+        ((TextView)mBMenu).setTextSize(30);
+
+        mIbScanner = newButton("Rechercher");
+        mBBriefing = newButton("Résumé");
+        mBInvotory = newButton("Inventaire");
+        mBMap = newButton("Carte");
+        mBOptions = newButton("Options");
+        //mBMenu = newButton("Menu Principal");
+        mBSend = newButton("Envoyer les données");
+        Resources r = getResources();
+        float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, r.getDisplayMetrics());
+        //moveView(mBMenu, 0, 0, mWidth, (int) px);
+
+        if(!mGame.hasResource("intro"))
+            mGame.pickResource("intro");
+
+    }
+}

+ 1 - 1
app/src/main/java/app/brest/testmin3d/ViewerActivity.java

@@ -94,7 +94,7 @@ public class ViewerActivity extends RendererActivity implements View.OnTouchList
             {
                 Bitmap bmp=null;
                 try {
-                     bmp = FileManager.openImage(mResource.getName());
+                    bmp = FileManager.openImage(mResource.getName());
                 } catch (Exception e) {
                     e.printStackTrace();
                 }

+ 40 - 1
app/src/main/java/app/brest/utils/FontChangeCrawler.java

@@ -1,6 +1,7 @@
 package app.brest.utils;
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.res.AssetManager;
 import android.graphics.Typeface;
 import android.view.View;
@@ -24,7 +25,7 @@ public class FontChangeCrawler
         typeface = Typeface.createFromAsset(assets, assetsFontFileName);
     }
 
-    public void replaceFonts(ViewGroup viewTree)
+    public  void replaceFonts(ViewGroup viewTree)
     {
         View child;
         for(int i = 0; i < viewTree.getChildCount(); ++i)
@@ -43,6 +44,15 @@ public class FontChangeCrawler
         }
     }
 
+    public  void replaceFontsOnView(View child)
+    {
+        if(child instanceof TextView)
+        {
+            ((TextView) child).setTypeface(typeface);
+        }
+
+    }
+
     public static void setFont(Activity app, String font)
     {
         FontChangeCrawler fontChanger = new FontChangeCrawler(app.getAssets(), font);
@@ -55,4 +65,33 @@ public class FontChangeCrawler
         fontChanger.replaceFonts((ViewGroup)app.findViewById(android.R.id.content));
     }
 
+    public static void setFont(ViewGroup v, Context app)
+    {
+        FontChangeCrawler fontChanger = new FontChangeCrawler(app.getAssets(), "font.ttf");
+        fontChanger.replaceFonts(v);
+    }
+
+    public static void setFont(ViewGroup v, Context app, String font)
+    {
+        FontChangeCrawler fontChanger = new FontChangeCrawler(app.getAssets(), font);
+        fontChanger.replaceFonts(v);
+    }
+
+
+
+    public static void setFont(View v, Context app)
+    {
+        FontChangeCrawler fontChanger = new FontChangeCrawler(app.getAssets(), "font.ttf");
+        fontChanger.replaceFontsOnView(v);
+    }
+
+    public static void setFont(View v, Context app, String font)
+    {
+        FontChangeCrawler fontChanger = new FontChangeCrawler(app.getAssets(), font);
+        fontChanger.replaceFontsOnView(v);
+    }
+
+
+
+
 }

+ 47 - 0
app/src/main/java/app/brest/utils/ResourceManager.java

@@ -21,6 +21,7 @@ public class ResourceManager implements Serializable{
     protected ArrayList<Resource> mAllResources = new ArrayList<Resource>();
     protected ArrayList< ArrayList<Resource> > mResourcesAquiered  = new ArrayList<ArrayList<Resource> >();
     protected ArrayList<Resource> mResourcesLeft  = new ArrayList<Resource>();
+    protected ArrayList<Resource> m_otherResources = new ArrayList<Resource>();
     protected Resource mLatestResource = null;
     protected ArrayList<Resource> mResourcesPickedUp = new ArrayList<Resource>();
     protected int mNStages;
@@ -30,9 +31,27 @@ public class ResourceManager implements Serializable{
         mNStages = n;
     }
 
+    public ResourceManager()
+    {
+    }
 
+    public void set(ArrayList<Resource> x, int n)
+    {
+        mAllResources =x;
+        mNStages = n;
+    }
 
 
+    public void addOtherResource(Resource r)
+    {
+        m_otherResources.add(r);
+    }
+
+    public ArrayList<Resource> getOtherResource()
+    {
+        return m_otherResources;
+    }
+
     public Resource getResourceLeftByName(String name)
     {
         for(int i=0; i<mResourcesLeft.size(); i++)
@@ -79,6 +98,13 @@ public class ResourceManager implements Serializable{
                 return true;
             }
         }
+        for(int i=0; i<m_otherResources.size(); i++)
+            if(m_otherResources.get(i).getName().compareTo(name)==0)
+            {
+                mResourcesPickedUp.add(m_otherResources.get(i));
+                if(mResourcesAquiered.size()-1>=0)mResourcesAquiered.get(mResourcesAquiered.size()-1).add(m_otherResources.get(i));
+            }
+
         return false;
     }
 
@@ -103,6 +129,14 @@ public class ResourceManager implements Serializable{
         return mResourcesAquiered;
     }
 
+    public int getNResourceAquired()
+    {
+        int n=0;
+        for(int i=0; i<mResourcesAquiered.size(); i++)
+            n+=mResourcesAquiered.get(i).size();
+        return n;
+    }
+
     public void pickAllResoucres()
     {
         mResourcesLeft.clear();
@@ -131,6 +165,7 @@ public class ResourceManager implements Serializable{
         return 0;
     }
 
+
     public int getNResourceLeft()
     {
         return mResourcesLeft.size();
@@ -140,4 +175,16 @@ public class ResourceManager implements Serializable{
     {
         return mLatestResource;
     }
+
+
+    public boolean hasResource(String name)
+    {
+        for(int i=0; i<mResourcesAquiered.size(); i++)
+        {
+            for(int j=0; j<mResourcesAquiered.get(i).size(); j++)
+                if(mResourcesAquiered.get(i).get(j).getName().compareTo(name)==0)
+                    return true;
+        }
+        return false;
+    }
 }

+ 21 - 6
app/src/main/java/app/brest/utils/app/brest/game/Game.java

@@ -33,7 +33,6 @@ public class Game  implements Serializable {
     protected ArrayList<Area>  mAreas = new ArrayList<Area>();
     protected ArrayList<Area>  mCurrentStageAreas = new ArrayList<Area>();
     protected ArrayList<Stage> mStages = new ArrayList<Stage>();
-    protected ArrayList<Resource> m_otherResources = new ArrayList<Resource>();
     protected int              mNStages;
     protected int              mCurrentStage=0;
     protected Player           mPlayer;
@@ -49,14 +48,16 @@ public class Game  implements Serializable {
     {
         JSONObject root = JSONAssetsManager.load(act, name);
         mName=name;
+        mResources = new ResourceManager();
         mPlayer = new Player(act);
         try {
             JSONArray areas = root.getJSONArray("areas");
             JSONArray stages = root.getJSONArray("stages_list");
             JSONArray others = root.getJSONArray("others");
 
+
             for(int i=0; i<others.length(); i++)
-                m_otherResources.add(new Resource(others.getString(i), act));
+                mResources.addOtherResource(new Resource(others.getString(i), act));
 
             for(int i=0; i<areas.length(); i++)
                 mAreas.add(new Area(areas.getJSONObject(i), act));
@@ -69,7 +70,9 @@ public class Game  implements Serializable {
                 mStages.add(s);
             }
             findMaxStage();
-            mResources = new ResourceManager( getAllResources(act), mNStages);
+            mResources.set( getAllResources(act), mNStages);
+
+
             nextStage();
         } catch (JSONException e) {
             e.printStackTrace();
@@ -315,9 +318,10 @@ public class Game  implements Serializable {
             for(int j=0; j<mAreas.get(i).countResource(); j++)
                 if(mAreas.get(i).getResourceNames().get(j).compareTo(name)==0)
                  return mAreas.get(i).getResource(j);
-        for(int i=0; i<m_otherResources.size(); i++)
-            if(m_otherResources.get(i).getName().compareTo(name)==0)
-                return m_otherResources.get(i);
+        if(mResources !=null)
+            for(int i=0; i<mResources.getOtherResource().size(); i++)
+                if(mResources.getOtherResource().get(i).getName().compareTo(name)==0)
+                    return mResources.getOtherResource().get(i);
         return null;
     }
 
@@ -486,10 +490,21 @@ public class Game  implements Serializable {
         Stage s =getCurrentStageObj();
         if(s==null) return false;
         return mResources.getNResourceAcquired()>=s.getNResourceStep() && !isFinished();
+        //return mResources.getNResourceLeft()<s.getNResourceStep() && !isFinished();
     }
 
     public boolean isFinished() { return mFinished; }
 
     public void finish() { mFinished=true; }
 
+    public int getNResourcesAquired()
+    {
+        return mResources.getNResourceAquired();
+    }
+
+    public boolean hasResource(String name)
+    {
+        return mResources.hasResource(name);
+    }
+
 }

+ 1 - 2
app/src/main/java/app/brest/utils/app/brest/game/Resource.java

@@ -139,8 +139,7 @@ public class Resource implements Serializable {
             //m3DModel.rotation().y+=-180;
 
             //m3DModel.rotation().y=90;
-            m3DModel.scale().x = mScale.x*2; m3DModel.scale().y = mScale.y*2; m3DModel.scale().z = mScale.z*2;
-            Log.e("MODEL", mName+" ("+m3DModel.scale().x+", "+m3DModel.scale().y+", "+m3DModel.scale().z+")");
+            m3DModel.scale().x = mScale.x; m3DModel.scale().y = mScale.y; m3DModel.scale().z = mScale.z;
         }
         return m3DModel;
 

+ 6 - 2
app/src/main/java/app/brest/utils/files/FileManager.java

@@ -6,6 +6,7 @@ import android.content.res.AssetManager;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.net.Uri;
+import android.util.Log;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -58,6 +59,7 @@ public class FileManager {
             ".mid", ".MID",
             ".midi", ".MIDI",
             ".mp3", ".MP3",
+            ".3gpp", ".3GPP",
             ".wav", ".WAV",
             ".ogg", ".OGG"};
 
@@ -94,14 +96,16 @@ public class FileManager {
         for(int i=0; i<MEDIA_EXT.length; i++)
         {
             AssetFileDescriptor is = null;
+            Log.e("________", "Start");
             try {
                 is = m_asset.openFd(path+MEDIA_EXT[i]);
 
-                System.out.println("Test = "+path+MEDIA_EXT[i]+" "+is);
+                Log.e("________", "Recherche de vidéo: '"+path+MEDIA_EXT[i]+"' OK");
                 if(is!=null)
                     return is;
             } catch (IOException e) {
-                e.printStackTrace();
+                //e.printStackTrace();
+                Log.e("________", "Recherche de vidéo: '"+path+MEDIA_EXT[i]+"' FAIL");
             }
         }
         return null;

BIN
app/src/main/res/drawable/background.png


BIN
app/src/main/res/drawable/button.png


BIN
app/src/main/res/drawable/button_tap.png


+ 1 - 1
app/src/main/res/layout/activity_new_menu.xml

@@ -7,7 +7,7 @@
     android:paddingLeft="0dp"
     android:paddingRight="0dp"
     android:paddingTop="0dp"
-    tools:context="app.brest.testmin3d.NewMenuActivity"
+    tools:context=".MenuActivity"
     android:id="@+id/menu_root"
     android:background="#000000">
 

+ 4 - 3
app/src/main/res/layout/activity_permission.xml

@@ -8,13 +8,12 @@
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
     tools:context="app.brest.testmin3d.PermissionActivity"
-    android:background="@drawable/background">
+    android:background="#000000">
 
     <Button
         android:layout_width="wrap_content"
         android:layout_height="60dp"
         android:id="@+id/understood"
-        android:background="@drawable/uibutton"
         android:textSize="25dp"
         android:textColor="#33b5e5"
         android:textStyle="bold"
@@ -22,7 +21,9 @@
         android:layout_alignParentEnd="true"
         android:layout_alignParentBottom="true"
         android:text="J&apos;ai compris"
-        android:onClick="onUnderstood" />
+        android:onClick="onUnderstood"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true" />
 
     <ScrollView
         android:layout_width="wrap_content"

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

@@ -25,13 +25,14 @@
         android:textSize="30dp" />
 
     <ListView
-        android:layout_width="match_parent"
+        android:layout_width="347dp"
         android:layout_height="match_parent"
         android:id="@+id/list_layout"
         android:scrollingCache="true"
         android:choiceMode="singleChoice"
         android:fastScrollEnabled="true"
         android:fastScrollAlwaysVisible="true"
-        android:longClickable="false" />
+        android:longClickable="false"
+        android:layout_marginLeft="72px" />
 
 </LinearLayout>

+ 2 - 3
app/src/main/res/layout/activity_viewer.xml

@@ -2,8 +2,8 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@drawable/background"
-    tools:context="app.brest.testmin3d.ViewerActivity">
+    tools:context="app.brest.testmin3d.ViewerActivity"
+    android:background="#000000">
 
     <!-- The primary full-screen view. This can be replaced with whatever view
          is needed to present your content, e.g. VideoView, SurfaceView,
@@ -32,7 +32,6 @@
         android:id="@+id/button_info"
         android:layout_alignParentBottom="true"
         android:layout_centerHorizontal="true"
-        android:background="@drawable/uibutton"
         android:textColor="#33b5e5"
         android:textStyle="bold"
         android:textSize="25dp"

+ 20 - 0
app/src/main/res/layout/array_layout.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal" android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:weightSum="1">
+
+    <ImageButton
+        android:layout_width="60dp"
+        android:layout_height="match_parent"
+        android:id="@+id/imageButton"
+        android:background="@drawable/fleche" />
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:text="Medium Text"
+        android:id="@+id/textObject"
+        android:layout_gravity="center_vertical" />
+</LinearLayout>

+ 2 - 2
app/src/main/res/values/strings.xml

@@ -74,7 +74,7 @@
     <string name="gps_stub__">-1.67609 48.10663;-1.67918 48.10971;-1.67929 48.11128;-1.68026 48.11461;</string>
     <string name="gps_stub_brest">-4.4931557 48.3852982;-4.4907396 48.3822208;-4.4913189 48.3821055;-4.5009306 48.3812175;-4.4994088 48.3816246;-4.5001176 48.3829454;-4.4998877 48.3861891;-4.4993333 48.3843879;-4.4981522 48.3837466;-4.4940766 48.3855502;-4.4934548 48.3850800;-4.4920585 48.3832195;-4.4925920 48.3818895;-4.4974687 48.3831305;-4.4977893 48.3839475;-4.4936559 48.3832834;-4.4947957 48.3844682;-4.4944665 48.3851339;-4.4940462 48.3842496;-4.4926676 48.3835729;-4.4927382 48.3826774;-4.4972925 48.3835206;-4.4956640 48.3843096;-4.4980210 48.3844962;      </string>
     <string name="gps_stub_">-1.6636940 48.0955401 ;-1.6648474 48.0958025;-1.6649627 48.0958487;-1.6652739 48.0958718;-1.6658446 48.0954599;-1.6658503 48.0947939;-1.6649685 48.0953636;-1.6635852 48.0952597;-1.6637062 48.0954137;-1.6637927 48.0955215;-1.6639079 48.0956793;-1.6641270 48.0957178;-1.6642653 48.0956139;-1.6644785 48.0957216;</string>
-    <string name="gps_stub">-1.654773 48.020967;-1.655274 48.021321;-1.655843 48.020494;</string>
-
+    <string name="gps_stub_se">-1.6552946 48.0210506;-1.6518083 48.0207201;-1.6584931 48.0200556;-1.6624308 48.0181617;-1.6538682 48.0224585;-1.6512439 48.0208696;-1.6510127 48.0213842;-1.6462995 48.0187739;-1.6507205 48.0179446;</string>
+    <string name="gps_stub">-1.6552002 48.0214484;-1.6556532 48.0204598;-1.6552002 48.0214484;</string>
     <string name="title_activity_puzzle">PuzzleActivity</string>
 </resources>