package com.example.mountaintravel.adapter;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.mountaintravel.base.MyBaseAdapter;
import com.example.mountaintravel.kind.Fragment5Info;
import com.smart.gtstrvl.R;

public class Fragment5Adapter extends MyBaseAdapter<Fragment5Info> {
	
	
	
	public Fragment5Adapter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
		
	}

	@Override
	public View getView( final int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		HoldView holdView = null;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.frag5_info, null);
			
			holdView = new HoldView();
			
			
			holdView.textView1 = (TextView) convertView
					.findViewById(R.id.frag5_text1);
			holdView.textView2 = (TextView) convertView
					.findViewById(R.id.frag5_text2);
			holdView.textView3 = (TextView) convertView
					.findViewById(R.id.frag5_text3);
			holdView.textView4 = (TextView) convertView
					.findViewById(R.id.frag5_text4);
			convertView.setTag(holdView);
		} else {
			holdView = (HoldView) convertView.getTag();
		}
		holdView.textView1
				.setText(getItem(position).getName());
		holdView.textView2
		.setText(getItem(position).getPhone());
		holdView.textView3
		.setText(getItem(position).getState());
		if (getItem(position).getState().equals("已通过")) {
			holdView.textView3.setTextColor(context.getResources().getColor(R.color.blue));
		}
		if (getItem(position).getState().equals("未通过")) {
			holdView.textView3.setTextColor(context.getResources().getColor(R.color.huise));
		}
		if (getItem(position).getState().equals("已拒绝")) {
			holdView.textView3.setTextColor(context.getResources().getColor(R.color.holo_red_dark));
		}
		holdView.textView4
		.setText(getItem(position).getTime());
		
		return convertView;
	}

	

	class HoldView {
		
		TextView textView1;
		TextView textView2;
		TextView textView3;
		TextView textView4;
	}


}
