Exemplo n.º 1
0
 public void setTypeList(boolean isList) {
   mKind.isList = isList;
 }
    @Override
    protected void inflate(Context context, int inflateLevel) {
      this.accountType = TEST_ACCOUNT_TYPE;
      this.setInflatedLevel(ContactsSource.LEVEL_CONSTRAINTS);

      // Phone allows maximum 2 home, 1 work, and unlimited other, with
      // constraint of 5 numbers maximum.
      DataKind kind = new DataKind(Phone.CONTENT_ITEM_TYPE, -1, -1, 10, true);

      kind.typeOverallMax = 5;
      kind.typeColumn = Phone.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(new EditType(Phone.TYPE_HOME, -1).setSpecificMax(2));
      kind.typeList.add(new EditType(Phone.TYPE_WORK, -1).setSpecificMax(1));
      kind.typeList.add(new EditType(Phone.TYPE_FAX_WORK, -1).setSecondary(true));
      kind.typeList.add(new EditType(Phone.TYPE_OTHER, -1));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Phone.NUMBER, -1, -1));
      kind.fieldList.add(new EditField(Phone.LABEL, -1, -1));

      addKind(kind);

      // Email is unlimited
      kind = new DataKind(Email.CONTENT_ITEM_TYPE, -1, -1, 10, true);
      kind.typeOverallMax = -1;
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Email.DATA, -1, -1));
      addKind(kind);

      // IM is only one
      kind = new DataKind(Im.CONTENT_ITEM_TYPE, -1, -1, 10, true);
      kind.typeOverallMax = 1;
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Im.DATA, -1, -1));
      addKind(kind);

      // Organization is only one
      kind = new DataKind(Organization.CONTENT_ITEM_TYPE, -1, -1, 10, true);
      kind.typeOverallMax = 1;
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Organization.COMPANY, -1, -1));
      kind.fieldList.add(new EditField(Organization.TITLE, -1, -1));
      addKind(kind);
    }
Exemplo n.º 3
0
 public void setTypeOverallMax(int num) {
   mKind.typeOverallMax = num;
 }