package com.lianxin.pubqq.extend;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.lianxin.pubqq.R;
import com.lianxin.pubqq.chat.EMChatActivity;
//import com.lianxin.panqq.chat.entity.EMMessage;
import com.lianxin.panqq.common.Utils;
import com.lianxin.panqq.common.BaseActivity;
//好友详情
public class UploadFileActivity extends BaseActivity implements OnClickListener {
	private TextView txt_title, tv_name, tv_accout;
	private ImageView img_back, img_right;
	private String Name, UserId;
	private Button btn_sendmsg;
	
	private int userId;
	private int userType;
	private String userName;// 群名称	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_friendmsg);
		//setContentView(R.layout.activity_usersearch);		
		super.onCreate(savedInstanceState);
		
		initControl();
		initView();
		initData();
		setListener();		
	}

//	@Override
	protected void initControl() {
		txt_title = (TextView) findViewById(R.id.txt_title);
		txt_title.setText("详细资料");
		img_back = (ImageView) findViewById(R.id.img_back);
		img_back.setVisibility(View.VISIBLE);

		btn_sendmsg = (Button) findViewById(R.id.btn_sendmsg);
		btn_sendmsg.setTag("1");
		tv_name = (TextView) findViewById(R.id.tv_name);
		tv_accout = (TextView) findViewById(R.id.tv_accout);
	}

	protected void initView() {

	}

	protected void initData() {
		// 获取传过来的groupid		
		userId = getIntent().getIntExtra("USER_ID",10002);
		userType = getIntent().getIntExtra("USER_Type", 1);
		userName = getIntent().getStringExtra("USER_Name");	

		tv_name.setText(userName);
		tv_accout.setText("联信号：" + userId);		
	}

	protected void setListener() {
		img_back.setOnClickListener(this);
	//	img_right.setOnClickListener(this);
		btn_sendmsg.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		int id = v.getId();
		if (id == R.id.img_back) {
			Utils.finish(UploadFileActivity.this);
		} else if (id == R.id.btn_sendmsg) {
			if ("1".equals(v.getTag().toString())) {
				Intent intent = new Intent(this, EMChatActivity.class);
				intent.putExtra("Chat_ID", userId);
				intent.putExtra("Chat_Type", userType);
				intent.putExtra("Chat_Name", userName);
				//startActivity(intent);
				Utils.start_Activity(context, intent);
			} else {
				// TODO 添加好友
			}
		}
	}

}
