package com.example.TreballFiGrau;

import com.squareup.picasso.Picasso;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class Foto extends Fragment {
	ImageView im;
	ViewGroup rootView;
	String url = "http://tfg-sharenews.rhcloud.com/media/";
	String path;
	
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState){
    	rootView = (ViewGroup) inflater.inflate(R.layout.foto, container, false);
    	
    	
    	im = (ImageView) rootView.findViewById(R.id.foto);
    	Log.d("aki", "dintre fragment foto");
    	if(PontFotoVideoFragment.urlPath.size()!=0){
    		path =PontFotoVideoFragment.urlPath.get(0);
    		PontFotoVideoFragment.urlPath.remove(0);
    		Log.d("aki", "despres remove");
    	}
    	
    	Log.d("aki", path);
    	Picasso.with(rootView.getContext()).load(url+path).into(im);
    	Log.d("aki", "despres fragment foto");
        return rootView;
    }
    public void mostrarFoto(String path){
    	
    	Log.d("aki", "dintre funcio mostrarFoto");
    	String url = "http://tfg-sharenews.rhcloud.com/media/";
    	Log.d("aki", url+path);
    	//Picasso.with(rootView.getContext()).load(url+path).into(im);
    	Picasso.with(rootView.getContext()).load("http://tfg-sharenews.rhcloud.com/media/img/2014/05/30/grey_knight_term_150_129.gif/").into(im);
    	Log.d("aki", "despres picaso");
    	
    }
}