package vn.edu.voer.fragment;

import java.util.ArrayList;
import java.util.List;

import vn.edu.voer.R;
import vn.edu.voer.activity.MainActivity;
import vn.edu.voer.adapter.LibraryAdapter;
import vn.edu.voer.database.dao.MaterialDAO;
import vn.edu.voer.object.Book;
import vn.edu.voer.object.Material;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class LibraryFragment extends BaseFragment {
	private ListView lsvBook;
	private ArrayList<Material> mMaterials;
	private LibraryAdapter mAdapter;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.fragment_library, container, false);

		initUI(view);
		initControl();
		return view;
	}

	@Override
	public void onHiddenChanged(boolean hidden) {
		super.onHiddenChanged(hidden);
//		if (!hidden) {
//			if (mMaterials.size() == 0) {
//				initData();
//			}
//		}
	}

	private void initUI(View view) {
		lsvBook = (ListView) view.findViewById(R.id.lsvBook);
	}

	private void initControl() {
		MaterialDAO md = new MaterialDAO(getActivity());
		mMaterials = md.getAllMaterial();
		mAdapter = new LibraryAdapter(getActivity(), R.layout.library_item, mMaterials);
		lsvBook.setAdapter(mAdapter);
//		lsvBook.setOnItemClickListener(new OnItemClickListener() {
//			@Override
//			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//				goToFragment(MainActivity.DETAIL_CONTENT);
//			}
//		});
	}
}
@@ -58,32 +58,8 @@
 st;%0D
-%0Aimport java.util.List;%0D
 %0A%0D%0Ai
@@ -217,41 +217,8 @@
 O;%0D%0A
-import vn.edu.voer.object.Book;%0D%0A
 impo
@@ -1436,18 +1436,16 @@
 pter);%0D%0A
-//
 %09%09lsvBoo
@@ -1498,18 +1498,16 @@
 er() %7B%0D%0A
-//
 %09%09%09@Over
@@ -1512,18 +1512,16 @@
 erride%0D%0A
-//
 %09%09%09publi
@@ -1595,26 +1595,24 @@
 long id) %7B%0D%0A
-//
 %09%09%09%09goToFrag
@@ -1647,26 +1647,22 @@
 TENT);%0D%0A
-//
 %09%09%09%7D%0D%0A
-//
 %09%09%7D);%0D%0A%09

Update library