private void updatePresenceInfo() {
    // update the presence ring
    IMXStore store = mSession.getDataHandler().getStore();
    User user = store.getUser(mMemberId);

    ImageView presenceRingView = (ImageView) findViewById(R.id.imageView_presenceRing);

    String presence = null;

    if (null != user) {
      presence = user.presence;
    }

    if (User.PRESENCE_ONLINE.equals(presence)) {
      presenceRingView.setColorFilter(this.getResources().getColor(R.color.presence_online));
    } else if (User.PRESENCE_UNAVAILABLE.equals(presence)) {
      presenceRingView.setColorFilter(this.getResources().getColor(R.color.presence_unavailable));
    } else if (User.PRESENCE_OFFLINE.equals(presence)) {
      presenceRingView.setColorFilter(this.getResources().getColor(R.color.presence_unavailable));
    } else {
      presenceRingView.setColorFilter(android.R.color.transparent);
    }

    TextView presenceTextView = (TextView) findViewById(R.id.textView_lastPresence);

    if ((user == null) || (user.lastActiveAgo == null)) {
      presenceTextView.setVisibility(View.GONE);
    } else {
      presenceTextView.setVisibility(View.VISIBLE);

      if (User.PRESENCE_OFFLINE.equals(user.presence)) {
        presenceTextView.setText(User.PRESENCE_OFFLINE);
        presenceTextView.setTextColor(Color.RED);
      } else {
        presenceTextView.setText(buildLastActiveDisplay(user.getRealLastActiveAgo()));
        presenceTextView.setTextColor(Color.BLACK);
      }
    }
  }
  /**
   * Init the dialog view.
   *
   * @param v the dialog view.
   */
  void initView(View v) {
    mListView = ((ListView) v.findViewById(R.id.listView_members));

    IMXStore store = mSession.getDataHandler().getStore();

    // remove the current room members
    ArrayList<String> idsToIgnore = new ArrayList<String>();
    Room room = store.getRoom(mRoomId);
    Collection<RoomMember> currentMembers = room.getMembers();

    for (RoomMember member : currentMembers) {
      idsToIgnore.add(member.getUserId());
    }

    // get the members list
    ArrayList<RoomMember> members_OneToOne = new ArrayList<RoomMember>();
    ArrayList<String> ids_OneToOne = new ArrayList<String>();

    ArrayList<RoomMember> members_MaxTenMembers = new ArrayList<RoomMember>();
    ArrayList<String> ids_MaxTenMembers = new ArrayList<String>();

    ArrayList<RoomMember> members_BigRooms = new ArrayList<RoomMember>();
    ArrayList<String> ids_BigRooms = new ArrayList<String>();

    Collection<RoomSummary> summaries = store.getSummaries();

    for (RoomSummary summary : summaries) {
      // not the current summary
      if (!summary.getRoomId().equals(mRoomId)) {
        Collection<RoomMember> otherRoomMembers = room.getMembers();

        for (RoomMember member : otherRoomMembers) {
          String userID = member.getUserId();

          // accepted User ID or still active users
          if ((idsToIgnore.indexOf(userID) < 0)
              && (RoomMember.MEMBERSHIP_JOIN.equals(member.membership))) {
            int posOneToOne = ids_OneToOne.indexOf(userID);
            int posTenMembers = ids_MaxTenMembers.indexOf(userID);
            int posBigRooms = ids_BigRooms.indexOf(userID);

            if (otherRoomMembers.size() <= 2) {
              if (posBigRooms >= 0) {
                members_BigRooms.remove(posBigRooms);
                ids_BigRooms.remove(posBigRooms);
              }

              if (posTenMembers >= 0) {
                members_MaxTenMembers.remove(posTenMembers);
                ids_MaxTenMembers.remove(posTenMembers);
              }

              if (posOneToOne < 0) {
                members_OneToOne.add(member);
                ids_OneToOne.add(member.getUserId());
              }
            } else if (otherRoomMembers.size() <= 10) {
              if (posBigRooms >= 0) {
                members_BigRooms.remove(posBigRooms);
                ids_BigRooms.remove(posBigRooms);
              }

              if ((posTenMembers < 0) && (posOneToOne < 0)) {
                members_MaxTenMembers.add(member);
                ids_MaxTenMembers.add(member.getUserId());
              }
            } else {
              if ((posBigRooms < 0) && (posTenMembers < 0) && (posOneToOne < 0)) {
                members_BigRooms.add(member);
                ids_BigRooms.add(member.getUserId());
              }
            }
          }
        }
      }
    }

    mAdapter =
        new MembersInvitationAdapter(
            getActivity(), R.layout.adapter_item_members_invitation, getMXMediasCache());

    Collections.sort(members_OneToOne, alphaComparator);
    Collections.sort(members_MaxTenMembers, alphaComparator);
    Collections.sort(members_BigRooms, alphaComparator);

    mAdapter.addAll(members_OneToOne);
    mAdapter.addAll(members_MaxTenMembers);
    mAdapter.addAll(members_BigRooms);

    ArrayList<Integer> bounds = new ArrayList<Integer>();
    ArrayList<String> sectionTitles = new ArrayList<String>();

    int index = 0;

    if (members_OneToOne.size() > 0) {
      bounds.add(index);
      sectionTitles.add(getActivity().getResources().getString(R.string.members_one_to_one));
      index += members_OneToOne.size();
    }

    if (members_MaxTenMembers.size() > 0) {
      bounds.add(index);
      sectionTitles.add(
          getActivity().getResources().getString(R.string.members_small_room_members));
      index += members_MaxTenMembers.size();
    }

    if (members_BigRooms.size() > 0) {
      bounds.add(index);
      sectionTitles.add(
          getActivity().getResources().getString(R.string.members_large_room_members));
      index += members_BigRooms.size();
    }

    mAdapter.setSectionTiles(bounds, sectionTitles);

    mListView.setAdapter(mAdapter);
  }