コード例 #1
0
	/**
	 * UI更改组名
	 */
	private void updateGroupNameUI(String old, String newGroupName) {

		if (StringUtil.empty(old) || Constant.ALL_FRIEND.equals(old)
				|| Constant.NO_GROUP_FRIEND.equals(old)) {
			return;
		}
		if (StringUtil.empty(newGroupName)
				|| Constant.ALL_FRIEND.equals(newGroupName)
				|| Constant.NO_GROUP_FRIEND.equals(newGroupName)) {
			return;
		}

		if (newNames.contains(old)) {
			newNames.remove(old);
			newNames.add(newGroupName);
			return;
		}
		for (MRosterGroup g : rGroups) {
			if (g.getName().equals(old)) {
				g.setName(newGroupName);
			}
		}
		expandAdapter.notifyDataSetChanged();

	}
コード例 #2
0
	/**
	 * UI级移动用户,把用户加入某组
	 */
	private void addUserGroupUI(User user, String groupName) {
		for (MRosterGroup g : rGroups) {
			if (groupName.equals(g.getName())) {
				List<User> users = g.getUsers();
				users.add(user);
				g.setUsers(users);
			}
		}
		expandAdapter.setContacter(rGroups);
		expandAdapter.notifyDataSetChanged();

	}
コード例 #3
0
	/**
	 * UI级删除用户
	 */
	private void deleteUserUI(User user) {
		for (MRosterGroup g : rGroups) {
			List<User> us = g.getUsers();
			if (us != null && us.size() > 0) {
				if (us.contains(user)) {
					us.remove(user);
					g.setUsers(us);
				}
			}
		}
		expandAdapter.setContacter(rGroups);
		expandAdapter.notifyDataSetChanged();

	}
コード例 #4
0
	/**
	 * UI级移动用户,把用户移除某组
	 */
	private void removeUserFromGroupUI(User user) {

		for (MRosterGroup g : rGroups) {
			if (g.getUsers().contains(user)) {
				if (StringUtil.notEmpty(g.getName())
						&& !Constant.ALL_FRIEND.equals(g.getName())) {
					List<User> users = g.getUsers();
					users.remove(user);
					g.setUsers(users);

				}
			}
		}
		expandAdapter.setContacter(rGroups);
		expandAdapter.notifyDataSetChanged();
	}