package com.lianxin.pubqq.setup;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.lianxin.pubqq.R;
//import com.lianxin.panqq.chat.entity.EMMessage;
import com.lianxin.panqq.common.BaseActivity;
import com.lianxin.panqq.common.DefineChat;
import com.lianxin.panqq.common.utils.SelectUtils;
import com.lianxin.panqq.picker.CommonPickerDialog;

//注册
public class NewNoticeActivity extends BaseActivity implements OnClickListener {

	private ImageView img_back;	
	private TextView txt_identity,txt_target,txt_belongs,txt_reply;
	private RelativeLayout lay_identity,lay_target,lay_belongs,lay_reply;	
	private int chatType = 0;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.setup_newnotice);
		super.onCreate(savedInstanceState);

		initControl();
		initView();
		initData();
		setListener();		
	}

	protected void initControl() {
		img_back = (ImageView) findViewById(R.id.img_back);		
		
		txt_identity = (TextView) findViewById(R.id.tv_identity);
		txt_target = (TextView) findViewById(R.id.tv_target);
		txt_belongs = (TextView) findViewById(R.id.tv_belongs);
		txt_reply = (TextView) findViewById(R.id.tv_reply);			
		lay_identity = (RelativeLayout) findViewById(R.id.rl_identity);
		lay_target = (RelativeLayout) findViewById(R.id.rl_target);
		lay_belongs = (RelativeLayout) findViewById(R.id.rl_belongs);
		lay_reply = (RelativeLayout) findViewById(R.id.rl_reply);        
	
		RadioButton rbt_a1=(RadioButton)findViewById(R.id.rb_a1);
		RadioButton rbt_a2=(RadioButton)findViewById(R.id.rb_a2);		
		RadioButton rbt_a3=(RadioButton)findViewById(R.id.rb_a3);
		RadioButton rbt_a4=(RadioButton)findViewById(R.id.rb_a4);
		RadioButton rbt_a5=(RadioButton)findViewById(R.id.rb_a5);
		RadioButton rbt_a6=(RadioButton)findViewById(R.id.rb_a6);
	
	}

	protected void initView() {

	}

	protected void initData() {
	}

	protected void setListener() {

		img_back.setOnClickListener(this);
		lay_identity.setOnClickListener(this);		
		lay_target.setOnClickListener(this); 
		lay_belongs.setOnClickListener(this);		
		lay_reply.setOnClickListener(this); 		
	}

	@Override
	public void onClick(View v) {
		int id = v.getId();
		if (id == R.id.img_back) {
			super.onBackPressed();
		} else if (id == R.id.rl_identity) {
			new CommonPickerDialog(NewNoticeActivity.this, SelectUtils.TYPE_ADMIN,
					new CommonPickerDialog.OnSetListener() {
						@Override
						public void onSelect(int id, String option) {
							txt_identity.setText(option);
						}
					}).show();
		} else if (id == R.id.rl_target) {
			new CommonPickerDialog(NewNoticeActivity.this, SelectUtils.TYPE_OBLY,
					new CommonPickerDialog.OnSetListener() {
						@Override
						public void onSelect(int id, String option) {
							switch (id) {
								case 0:
									chatType = DefineChat.ChatType_DEPART;
									break;
								case 1:
									chatType = DefineChat.ChatType_PARTY;
									break;
								case 2:
									chatType = DefineChat.ChatType_CLASS;
									break;
								case 3:
									chatType = DefineChat.ChatType_CROWD;
									break;
								case 4:
									chatType = DefineChat.ChatType_CITY;
									break;
								case 5:
									chatType = DefineChat.ChatType_GROUP;
									break;
								default:
									break;
							}
							txt_target.setText(option);
						}
					}).show();
		} else if (id == R.id.rl_belongs) {
			new CommonPickerDialog(NewNoticeActivity.this, SelectUtils.TYPE_BELONG, chatType,
					new CommonPickerDialog.OnSetListener() {
						@Override
						public void onSelect(int id, String option) {
							txt_belongs.setText(option);
						}
					}).show();
		} else if (id == R.id.rl_reply) {
			new CommonPickerDialog(NewNoticeActivity.this, SelectUtils.TYPE_REPLY,
					new CommonPickerDialog.OnSetListener() {
						@Override
						public void onSelect(int id, String option) {
							txt_reply.setText(option);
						}
					}).show();
		}
	}

}
