package it.unipr.dsg.mobdev;

import android.os.Bundle;
//Support Package import to hadle platform version prior to HoneyComb !
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.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

public class BookmarkGridFragment extends Fragment {
	
	private static String TAG = "ADSource2";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		Log.d(MainActivity.TAG, "BookmarkGridFragment --> onCreate()");
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onDestroy() {
		Log.d(MainActivity.TAG, "BookmarkGridFragment --> onDestroy()");
		super.onDestroy();
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
		
		Log.d(MainActivity.TAG, "BookmarkGridFragment --> onCreateView()");
		
		View view = inflater.inflate(R.layout.grid_view,container, false);
     
        GridView gridview = (GridView)view.findViewById(R.id.gridview);
        gridview.setAdapter(new ImageAdapter(this.getActivity()));

        gridview.setOnItemClickListener(new OnItemClickListener() {
        	@Override
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                Log.d(TAG, "" + position);
            }
        });
        
        return view;
    }
    
    @Override
	public void onDestroyView() {
		Log.d(MainActivity.TAG, "BookmarkGridFragment --> onDestroyView()");
		super.onDestroyView();
	}
}