Ejemplo n.º 1
0
	@Override
	public void onClick(View v) {

		if (v == tab1) {
			layout.snapToScreen(0);

		} else if (v == tab2) {
			layout.snapToScreen(1);

		} else if (v == tab3) {
			layout.snapToScreen(2);

		}
	}
Ejemplo n.º 2
0
	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();
			}
		});

	}