package com.example.mountaintravel.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

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

public class TeamListAdapter extends MyBaseAdapter<TeamListInfo> {

	public TeamListAdapter(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		Info info = null;
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.team_list, null);
			info = new Info();
			info.teamlist_tvname = (TextView) convertView
					.findViewById(R.id.teamlist_tvname);
			info.teamlist_tvnum = (TextView) convertView
					.findViewById(R.id.teamlist_tvnum);
			info.teamlist_tvapply = (TextView) convertView
					.findViewById(R.id.teamlist_tvapply);
			convertView.setTag(info);
		} else {
			info = (Info) convertView.getTag();
		}
		//if (getItem(position).getApplyAdd().equals("加入团队")) {
			info.teamlist_tvapply.setTextColor(context.getResources().getColor(
					R.color.blue));
//			// info.teamlist_tvapply.setBackgroundColor(context.getResources().getColor(R.color.green));
//		} else {
//			info.teamlist_tvapply.setTextColor(context.getResources().getColor(
//					R.color.red));
//			// info.teamlist_tvapply.setBackgroundColor(context.getResources().getColor(R.color.red));
//		}
		info.teamlist_tvname.setText(getItem(position).getTeamName());
		info.teamlist_tvnum.setText(getItem(position).getTeamNumber());
		info.teamlist_tvapply.setText(getItem(position).getApplyAdd());

		return convertView;
	}

	class Info {
		TextView teamlist_tvname;
		TextView teamlist_tvnum;
		TextView teamlist_tvapply;

	}
}
