package com.example.TreballFiGrau;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

import com.squareup.picasso.Picasso;

public class NoticiaCreadaGAFotos extends BaseAdapter {
	public static Context mContext;
	public static ArrayList<String> mThumbIds = new ArrayList<String>();

    public NoticiaCreadaGAFotos(Context c) {
        mContext = c;
    }

    @Override
    public int getCount() {
        return mThumbIds.size();
    }

    @Override
    public String getItem(int posicion) {
    	Log.d("aki","dintre fet item ");
        return mThumbIds.get(posicion);
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(8, 8, 8, 8);
        } else {
            imageView = (ImageView) convertView;
        }

        //imageView.setImageResource(mThumbIds.get(position));
        Log.d("aki","dintre adapter "+mThumbIds.get(position));
        Log.d("aki","dintre adapter "+mThumbIds.size());
        imageView.setImageBitmap(BitmapFactory.decodeFile(mThumbIds.get(position)));
        return imageView;
    }
    
   
    

 
    
}
