package com.example.TreballFiGrau;

import java.util.ArrayList;

import android.util.Log;

public class Noticia {
	public int idImatge=R.drawable.ic_launcher;
	public String id;
	public String titol=" ";
	public String contingut=" ";
	public String autor=" ";
	public String latitude="";
	public String longitude="";
	public String tags="";
	public ArrayList<String> categorias= new ArrayList<String>();
	public ArrayList<String> videos = new ArrayList<String>();
	public ArrayList<String> fotos = new ArrayList<String>();
	public String idMarker=null;

	public Noticia (String id,String titol, String contingut,String autor,String lati, String longi,String tags,String cate,String fot,String vi) { 
	    this.id=id;
	    this.titol=titol;
	    this.contingut=contingut;
	    this.autor=autor;
	    this.latitude=lati;
	    this.longitude=longi;
	    this.tags=tags;
	    
	    construirCategories(cate);
	    construirFotos(fot);
	    construirVideos(vi);
	}
	
	public void construirCategories(String categories){
        if(categories!=""){
        	String[] separated = categories.split(",");
        	for(int i=0;i<separated.length;i++){
        		categorias.add(separated[i]);
        	}       	
        }
	}
	
	public void construirFotos(String foto){
		Log.d("aki", "dintre construir fotoss");
        if(foto!="missingFoto"){
        	String[] separated = foto.split(",");
        	Log.d("aki", "longitud fotos"+separated.length);
        	for(int i=0;i<separated.length;i++){
        		Log.d("aki", "fotos"+separated[i]);
        		fotos.add(separated[i]);
        	}
        	Log.d("aki", "longitudd fotos"+separated.length);
        }
	}
	public void construirVideos(String video){
		Log.d("aki", "dintre construir fotoss");
        if(video!="missingVideo"){
        	String[] separated = video.split(",");
        	Log.d("aki", "longitud video"+separated.length);
        	for(int i=0;i<separated.length;i++){
        		Log.d("aki", "video"+separated[i]);
        		videos.add(separated[i]);
        	}
        	Log.d("aki", "longitudd videos"+separated.length);
        }
	}

}