package com.example.mountaintravel.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

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

public class GamelistAdapter extends MyBaseAdapter<GameInfo> {

	public GamelistAdapter(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.game_list, null);
			info = new Info();
			info.textView1 = (TextView) convertView
					.findViewById(R.id.gamelist_tv1);
			info.textView2 = (TextView) convertView
					.findViewById(R.id.gamelist_tv2);
			info.textView3 = (TextView) convertView
					.findViewById(R.id.gamelist_tv3);
			info.textView4 = (TextView) convertView
					.findViewById(R.id.gamelist_tv4);
			info.textView5 = (TextView) convertView
					.findViewById(R.id.gamelist_tv5);
			info.gamelist_nametv = (TextView) convertView
					.findViewById(R.id.gamelist_nametv);

			convertView.setTag(info);
		} else {
			info = (Info) convertView.getTag();
		}
		info.textView1.setText(getItem(position).getOrganizer());

		info.textView2.setText(getItem(position).getEventStartTime());
		info.textView3.setText(getItem(position).getIfBegin());
		info.textView4.setText(getItem(position).getLength());
		info.textView5.setText(getItem(position).getNumber());
		info.gamelist_nametv.setText(getItem(position).getName());

		return convertView;
	}

	class Info {
		TextView textView1;
		TextView textView2;
		TextView textView3;
		TextView textView4;
		TextView textView5;
		TextView gamelist_nametv;
	}
}
