@Override public int getChildrenCount(int groupPosition) { switch (groupPosition) { case 0: return completeData.getGroups() != null ? completeData.getGroups().size() : 0; case 1: return completeData.getUsers() != null ? completeData.getUsers().size() : 0; default: return 0; } }
@Override public Object getChild(int groupPosition, int childPosition) { switch (groupPosition) { case 0: return completeData.getGroups() != null ? completeData.getGroups().get(childPosition).getName() : null; case 1: return completeData.getUsers() != null ? completeData.getUsers().get(childPosition).fullName() : null; default: return null; } }
private void update(SocialContainer userData) { if (userData != null) { if (userData.getGroups() != null && completeData.getGroups() != null) { for (int i = 0; i < completeData.getGroups().size(); i++) { for (Group g : userData.getGroups()) { if (completeData.getGroups().get(i).getSocialId().equals(g.getSocialId())) checked[0].add(i); } } } if (userData.getUsers() != null && completeData.getUsers() != null) { for (int i = 0; i < completeData.getUsers().size(); i++) { for (PictureProfile p : userData.getUsers()) { if (completeData.getUsers().get(i).getId().equals(p.getId())) checked[1].add(i); } } } } }
public List<Community> getCommunities() { return completeData.getCommunities(); }
public List<PictureProfile> getUsers() { List<PictureProfile> list = new ArrayList<PictureProfile>(); for (Integer item : checked[1]) list.add(completeData.getUsers().get(item)); return list; }
public List<Group> getGroups() { List<Group> list = new ArrayList<Group>(); for (Integer item : checked[0]) list.add(completeData.getGroups().get(item)); return list; }