コード例 #1
0
  private void updateGroupCheckStateForNumber(PhoneNumber phoneNumber, Group excludedGroup) {
    ArrayList<Group> phoneGroups = phoneNumber.getGroups();
    if (phoneGroups == null) {
      return;
    }

    if (phoneNumber.isChecked() && phoneNumber.isDefault()) {
      for (Group group : phoneGroups) {
        if (group == excludedGroup || group.isLocal()) {
          continue;
        }
        boolean checked = true;
        for (PhoneNumber number : group.getPhoneNumbers()) {
          if (number.isDefault() && !number.isChecked()) {
            checked = false;
            break;
          }
        }
        group.setChecked(checked);
      }
    } else if (!phoneNumber.isChecked()) {
      for (Group group : phoneGroups) {
        if (group != excludedGroup) {
          group.setChecked(false);
        }
      }
    }
  }
コード例 #2
0
  private void checkGroup(Group group, boolean check) {
    group.setChecked(check);
    if (group.isLocal()) {
      if (group.isChecked()) {
        mLocalGroups.add(group);
      } else {
        mLocalGroups.remove(group);
      }
      return;
    }
    ArrayList<PhoneNumber> phoneNumbers = group.getPhoneNumbers();

    if (phoneNumbers != null) {
      for (PhoneNumber phoneNumber : phoneNumbers) {
        if (phoneNumber.isDefault()) {
          selectPhoneNumber(phoneNumber, check);
          updateGroupCheckStateForNumber(phoneNumber, group);
        }
      }
    }
  }