package com.example.liste_custom;

import java.util.ArrayList;





import com.example.menu.R;

import android.app.Application;



public class ApplicationDataShare extends Application{
    
    private static ApplicationDataShare applicationInstance;
    private Individu personne;
    private ArrayList<Individu> maListeIndividu =new  ArrayList<Individu> ();
    
    @Override
    public void onCreate() {
        super.onCreate();
        //Assign a reference to this specific instance of the application
        if(applicationInstance == null){
            applicationInstance = this;
        	Individu coco1;
    		coco1= new Individu("Amel", "Oscar");
    		coco1.setAttributs(new AttributsPhysiques(55, 177));
    		coco1.setExtras(new IndividuExtras("pseudo1", getResources().getDrawable(R.drawable.avatar1)));
    		maListeIndividu.add(coco1);
    		
    		coco1=new Individu("Copter", "Eli");
    		coco1.setAttributs(new AttributsPhysiques(90, 165));
    		coco1.setExtras(new IndividuExtras("pseudo2", getResources().getDrawable(R.drawable.avatar2)));
    		maListeIndividu.add(coco1);
    		personne=maListeIndividu.get(0);
        }
    }
    
    //You can call this method from anywhere to get a reference to the application instance
    //you will always get a reference because in order for your component to exist, the application
    //instance MUST already exist
    public static ApplicationDataShare getInstance(){
        return applicationInstance;
    }
    
    public void setIndividu(Individu unePersonne){
        this.personne = unePersonne;
    }
    
    public Individu getIndividu(){
        return this.personne;
    }
    
    public ArrayList<Individu> getListeIndividu(){
        return this.maListeIndividu;
    }
    
    
}