package com.example.fragment;

import java.util.List;

import com.example.adapter.KCAdapter;
import com.example.kechengbiao.MainActivity;
import com.example.kechengbiao.R;
import com.example.utils.KC_List;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
/**
 * 显示课程表的
 * @author user
 *
 */
public class KCB_Fragment extends Fragment {


	KCAdapter kcAdapter;
	private List<String[]> list;
    TextView textView;
    ListView listView;
    MainActivity acyivity;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.kcb, container, false);
		textView = (TextView) view.findViewById(R.id.topText_id);
		listView = (ListView) view.findViewById(R.id.KC_List_id);
		acyivity = (MainActivity) getActivity();
		setData();
		return view;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		initView();
		initEvent();
	}
	private void initView() {
		kcAdapter = new KCAdapter(acyivity, list);
	}
	
	private void initEvent() {
		listView.setAdapter(kcAdapter);
	}
    //设置list数据
   public void setData(){
	   Intent intent = acyivity.getIntent();
	   KC_List html = (KC_List) intent.getSerializableExtra("KC_List");
	   list = html.getKc_list();
	   System.out.println("----------List数据----------");
		for(int j=0;j<list.size();j++){
			
			String[] strs = list.get(j);
			for(int m=0;m<strs.length;m++){
				System.out.println("strs"+m+":"+strs[m]);
			}
		}
   }
	
	
}
