/**
	 * 有新消息进来,最近联系人界面更新
	 */
	@Override
	protected void msgReceive(Notice notice) {
		for (ChartHisBean ch : inviteNotices) {
			if (ch.getFrom().equals(notice.getFrom())) {
				ch.setContent(notice.getContent());
				ch.setNoticeTime(notice.getNoticeTime());
				Integer x = ch.getNoticeSum() == null ? 0 : ch.getNoticeSum();
				ch.setNoticeSum(x + 1);
			}
		}
		noticeAdapter.setNoticeList(inviteNotices);
		noticeAdapter.notifyDataSetChanged();
		setPaoPao();

	}
	/**
	 * 刷新当前的列表
	 */
	private void refreshList() {
		/** 刷新好友列表 */
		rGroups = ContacterManager.getGroups(XmppConnectionManager
				.getInstance().getConnection().getRoster());
		for (String newGroupName : newNames) {
			MRosterGroup mg = new MRosterGroup(newGroupName,
					new ArrayList<User>());
			rGroups.add(rGroups.size() - 1, mg);
		}
		expandAdapter.setContacter(rGroups);
		expandAdapter.notifyDataSetChanged();

		/** 刷新最近联系人列表 */
		inviteNotices = MessageManager.getInstance(this)
				.getRecentContactsWithLastMsg();
		noticeAdapter.setNoticeList(inviteNotices);
		noticeAdapter.notifyDataSetChanged();
		/**
		 * 有新消息进来的气泡设置
		 */
		setPaoPao();

	}
	private void init() {
		initData();

		// 初始化UIheader
		iv_status = (ImageView) findViewById(R.id.imageView1);
		noticePaopao = (TextView) findViewById(R.id.notice_paopao);
		imageView = (ImageView) findViewById(R.id.top_bar_select);

		headIcon = (ImageView) findViewById(R.id.head_icon);
		headIcon.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(ContacterMainActivity.this, UserInfoActivity.class);
				startActivity(intent);
			}
		});

		

		// 初始化UIbody
		tab1 = (ImageView) findViewById(R.id.tab1);
		tab2 = (ImageView) findViewById(R.id.tab2);
		tab3 = (ImageView) findViewById(R.id.tab3);

		getMyApplication().addActivity(this);
		inflater = LayoutInflater.from(this);
		layout = (ScrollLayout) findViewById(R.id.scrolllayout);
		layout.addChangeListener(this);
		View contacterTab1 = inflater.inflate(R.layout.contacter_tab1, null);
		View contacterTab2 = inflater.inflate(R.layout.contacter_tab2, null);
		View contacterTab3 = inflater.inflate(R.layout.contacter_tab3, null);
		layout.addView(contacterTab1);
		layout.addView(contacterTab2);
		layout.addView(contacterTab3);
		layout.setToScreen(1);

		// 我的好友
		contacterList = (ExpandableListView) findViewById(R.id.main_expand_list);
		expandAdapter = new ContacterExpandAdapter(this, rGroups);
		contacterList.setAdapter(expandAdapter);
		contacterList.setOnCreateContextMenuListener(onCreateContextMenuListener);
		contacterList.setOnChildClickListener(new OnChildClickListener() {

			@Override
			public boolean onChildClick(ExpandableListView parent, View v,
					int groupPosition, int childPosition, long id) {
				createChat((User) v.findViewById(R.id.username).getTag());
				return false;
			}
		});

		// 最近联系人
		inviteList = (ListView) findViewById(R.id.main_invite_list);
		inviteNotices = MessageManager.getInstance(this)
				.getRecentContactsWithLastMsg();
		noticeAdapter = new RecentChartAdapter(this, inviteNotices);
		inviteList.setAdapter(noticeAdapter);
		noticeAdapter.setOnClickListener(contacterOnClickJ);

		// 聊天室列表
		chatRoomListView = (ListView) findViewById(R.id.main_chat_room_list);
		chatRoomAdapter = new ArrayAdapter<String>(this,
				R.layout.chat_room_listview_item, roomNames);
		chatRoomListView.setAdapter(chatRoomAdapter);
		chatRoomListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
		chatRoomListView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
			}
		});
		textViewCreateRoom = (TextView) findViewById(R.id.textView_create_room);
		textViewCreateRoom.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				addChatRoom();
			}
		});

	}