@Override
  protected DataKind inflatePhone(Context context, int inflateLevel) {
    final DataKind kind = super.inflatePhone(context, ContactsSource.LEVEL_MIMETYPES);
    Log.d(TAG, "in ExchangeSource inflatePhone, inflateLevel=" + inflateLevel);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeColumn = Phone.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildPhoneType(Phone.TYPE_HOME).setSpecificMax(2));
      kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE).setSpecificMax(1));
      kind.typeList.add(buildPhoneType(Phone.TYPE_WORK).setSpecificMax(2));
      kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(
          buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true).setSpecificMax(1));
      kind.typeList.add(
          buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(Phone.LABEL));
      // kind.typeList.add(buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true)
      //        .setSpecificMax(1).setCustomColumn(Phone.LABEL));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
    }

    return kind;
  }
  @Override
  protected DataKind inflateNote(Context context, int inflateLevel) {
    final DataKind kind = super.inflateNote(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
    }

    return kind;
  }
  protected DataKind inflateEvent(int inflateLevel) {
    DataKind kind = getKindForMimetype(Event.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(new DataKind(Event.CONTENT_ITEM_TYPE, R.string.eventLabelsGroup, -1, 150, false));
      kind.secondary = true;
      kind.actionHeader = new EventActionInflater();
      kind.actionBody = new SimpleInflater(Event.START_DATE);
    }

    return kind;
  }
  protected DataKind inflatePhoto(int inflateLevel) {
    DataKind kind = getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, -1, true));
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
    }

    return kind;
  }
  @Override
  protected DataKind inflateWebsite(Context context, int inflateLevel) {
    final DataKind kind = super.inflateWebsite(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.isList = false;

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
    }

    return kind;
  }
  @Override
  protected DataKind inflateEmail(Context context, int inflateLevel) {
    final DataKind kind = super.inflateEmail(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeOverallMax = 3;

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
    }

    return kind;
  }
  @Override
  protected DataKind inflatePhoto(Context context, int inflateLevel) {
    final DataKind kind = super.inflatePhoto(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeOverallMax = 1;

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
    }

    return kind;
  }
  @Override
  protected DataKind inflateNickname(Context context, int inflateLevel) {
    final DataKind kind = super.inflateNickname(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.isList = false;

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(Nickname.NAME, R.string.nicknameLabelsGroup, FLAGS_PERSON_NAME));
    }

    return kind;
  }
  protected DataKind inflateStructuredName(int inflateLevel) {
    DataKind kind = getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  StructuredName.CONTENT_ITEM_TYPE, R.string.nameLabelsGroup, -1, -1, true));
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(StructuredName.PREFIX, R.string.name_prefix, FLAGS_PERSON_NAME)
              .setOptional(true));
      kind.fieldList.add(
          new EditField(StructuredName.GIVEN_NAME, R.string.name_given, FLAGS_PERSON_NAME));
      kind.fieldList.add(
          new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle, FLAGS_PERSON_NAME)
              .setOptional(true));
      kind.fieldList.add(
          new EditField(StructuredName.FAMILY_NAME, R.string.name_family, FLAGS_PERSON_NAME));
      kind.fieldList.add(
          new EditField(StructuredName.SUFFIX, R.string.name_suffix, FLAGS_PERSON_NAME)
              .setOptional(true));
      kind.fieldList.add(
          new EditField(
                  StructuredName.PHONETIC_GIVEN_NAME, R.string.name_phonetic_given, FLAGS_PHONETIC)
              .setOptional(true));
      kind.fieldList.add(
          new EditField(
                  StructuredName.PHONETIC_MIDDLE_NAME,
                  R.string.name_phonetic_middle,
                  FLAGS_PHONETIC)
              .setOptional(true));
      kind.fieldList.add(
          new EditField(
                  StructuredName.PHONETIC_FAMILY_NAME,
                  R.string.name_phonetic_family,
                  FLAGS_PHONETIC)
              .setOptional(true));
    }

    return kind;
  }
  protected DataKind inflateNote(int inflateLevel) {
    DataKind kind = getKindForMimetype(Note.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  Note.CONTENT_ITEM_TYPE, R.string.label_notes, R.drawable.sym_note, 110, true));
      kind.secondary = true;
      kind.actionHeader = new SimpleInflater(R.string.label_notes);
      kind.actionBody = new SimpleInflater(Note.NOTE);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
    }

    return kind;
  }
示例#11
0
  @Override
  protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
    final DataKind kind = super.inflateStructuredPostal(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      final boolean useJapaneseOrder =
          Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
      kind.typeColumn = StructuredPostal.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK).setSpecificMax(1));
      kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME).setSpecificMax(1));
      kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER).setSpecificMax(1));

      kind.fieldList = Lists.newArrayList();
      if (useJapaneseOrder) {
        kind.fieldList.add(
            new EditField(StructuredPostal.COUNTRY, R.string.postal_country, FLAGS_POSTAL)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(StructuredPostal.POSTCODE, R.string.postal_postcode, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.REGION, R.string.postal_region, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.CITY, R.string.postal_city, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.STREET, R.string.postal_street, FLAGS_POSTAL));
      } else {
        kind.fieldList.add(
            new EditField(StructuredPostal.STREET, R.string.postal_street, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.CITY, R.string.postal_city, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.REGION, R.string.postal_region, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.POSTCODE, R.string.postal_postcode, FLAGS_POSTAL));
        kind.fieldList.add(
            new EditField(StructuredPostal.COUNTRY, R.string.postal_country, FLAGS_POSTAL)
                .setOptional(true));
      }
    }

    return kind;
  }
  protected DataKind inflateEmail(int inflateLevel) {
    DataKind kind = getKindForMimetype(Email.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  Email.CONTENT_ITEM_TYPE,
                  R.string.emailLabelsGroup,
                  android.R.drawable.sym_action_email,
                  15,
                  true));
      kind.actionHeader = new EmailActionInflater();
      kind.actionBody = new SimpleInflater(Email.DATA);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeColumn = Email.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildEmailType(Email.TYPE_HOME));
      kind.typeList.add(buildEmailType(Email.TYPE_WORK));
      kind.typeList.add(buildEmailType(Email.TYPE_OTHER));
      kind.typeList.add(buildEmailType(Email.TYPE_MOBILE));
      kind.typeList.add(
          buildEmailType(Email.TYPE_CUSTOM).setSecondary(true).setCustomColumn(Email.LABEL));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Email.DATA, R.string.emailLabelsGroup, FLAGS_EMAIL));
    }

    return kind;
  }
  protected DataKind inflatePhone(int inflateLevel) {
    DataKind kind = getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  Phone.CONTENT_ITEM_TYPE,
                  R.string.phoneLabelsGroup,
                  android.R.drawable.sym_action_call,
                  10,
                  true));
      kind.iconAltRes = R.drawable.sym_action_sms;
      kind.actionHeader = new PhoneActionInflater();
      kind.actionAltHeader = new PhoneActionAltInflater();
      kind.actionBody = new SimpleInflater(Phone.NUMBER);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeColumn = Phone.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
      kind.typeList.add(buildPhoneType(Phone.TYPE_MOBILE));
      kind.typeList.add(buildPhoneType(Phone.TYPE_WORK));
      kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_WORK).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_FAX_HOME).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_PAGER).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER));
      kind.typeList.add(
          buildPhoneType(Phone.TYPE_CUSTOM).setSecondary(true).setCustomColumn(Phone.LABEL));
      kind.typeList.add(buildPhoneType(Phone.TYPE_CALLBACK).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_CAR).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_COMPANY_MAIN).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_ISDN).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_MAIN).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_OTHER_FAX).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_RADIO).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_TELEX).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_TTY_TDD).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_MOBILE).setSecondary(true));
      kind.typeList.add(buildPhoneType(Phone.TYPE_WORK_PAGER).setSecondary(true));
      kind.typeList.add(
          buildPhoneType(Phone.TYPE_ASSISTANT).setSecondary(true).setCustomColumn(Phone.LABEL));
      kind.typeList.add(buildPhoneType(Phone.TYPE_MMS).setSecondary(true));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Phone.NUMBER, R.string.phoneLabelsGroup, FLAGS_PHONE));
    }

    return kind;
  }
示例#14
0
  @Override
  protected DataKind inflateIm(Context context, int inflateLevel) {
    final DataKind kind = super.inflateIm(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeOverallMax = 3;

      // NOTE: even though a traditional "type" exists, for editing
      // purposes we're using the protocol to pick labels

      kind.defaultValues = new ContentValues();
      kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);

      kind.typeColumn = Im.PROTOCOL;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
      kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
      kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
      kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
      kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
      kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
      kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
      kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
      kind.typeList.add(
          buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(Im.CUSTOM_PROTOCOL));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
    }

    return kind;
  }
  protected DataKind inflateOrganization(int inflateLevel) {
    DataKind kind = getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  Organization.CONTENT_ITEM_TYPE,
                  R.string.organizationLabelsGroup,
                  R.drawable.sym_action_organization,
                  30,
                  true));
      kind.actionHeader = new SimpleInflater(Organization.COMPANY);
      kind.actionBody = new SimpleInflater(Organization.TITLE);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeColumn = Organization.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildOrgType(Organization.TYPE_WORK));
      kind.typeList.add(buildOrgType(Organization.TYPE_OTHER));
      kind.typeList.add(
          buildOrgType(Organization.TYPE_CUSTOM)
              .setSecondary(true)
              .setCustomColumn(Organization.LABEL));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(Organization.COMPANY, R.string.ghostData_company, FLAGS_GENERIC_NAME));
      kind.fieldList.add(
          new EditField(Organization.TITLE, R.string.ghostData_title, FLAGS_GENERIC_NAME));
    }

    return kind;
  }
示例#16
0
  @Override
  protected DataKind inflateOrganization(Context context, int inflateLevel) {
    final DataKind kind = super.inflateOrganization(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.isList = false;
      kind.typeColumn = Organization.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildOrgType(Organization.TYPE_WORK).setSpecificMax(1));
      kind.typeList.add(buildOrgType(Organization.TYPE_OTHER).setSpecificMax(1));
      kind.typeList.add(
          buildOrgType(Organization.TYPE_CUSTOM).setSecondary(true).setSpecificMax(1));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(Organization.COMPANY, R.string.ghostData_company, FLAGS_GENERIC_NAME));
      kind.fieldList.add(
          new EditField(Organization.TITLE, R.string.ghostData_title, FLAGS_GENERIC_NAME));
    }

    return kind;
  }
  @Override
  void updateFromNative() {
    super.updateFromNative();

    // we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
    int[] dataBuffer = new int[5];
    mRS.nElementGetNativeData(getID(mRS), dataBuffer);

    mNormalized = dataBuffer[2] == 1 ? true : false;
    mVectorSize = dataBuffer[3];
    mSize = 0;
    for (DataType dt : DataType.values()) {
      if (dt.mID == dataBuffer[0]) {
        mType = dt;
        mSize = mType.mSize * mVectorSize;
      }
    }
    for (DataKind dk : DataKind.values()) {
      if (dk.mID == dataBuffer[1]) {
        mKind = dk;
      }
    }

    int numSubElements = dataBuffer[4];
    if (numSubElements > 0) {
      mElements = new Element[numSubElements];
      mElementNames = new String[numSubElements];
      mArraySizes = new int[numSubElements];
      mOffsetInBytes = new int[numSubElements];

      long[] subElementIds = new long[numSubElements];
      mRS.nElementGetSubElements(getID(mRS), subElementIds, mElementNames, mArraySizes);
      for (int i = 0; i < numSubElements; i++) {
        mElements[i] = new Element(subElementIds[i], mRS);
        mElements[i].updateFromNative();
        mOffsetInBytes[i] = mSize;
        mSize += mElements[i].mSize * mArraySizes[i];
      }
    }
    updateVisibleSubElements();
  }
  protected DataKind inflateStructuredPostal(int inflateLevel) {
    DataKind kind = getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  StructuredPostal.CONTENT_ITEM_TYPE,
                  R.string.postalLabelsGroup,
                  R.drawable.sym_action_map,
                  25,
                  true));
      kind.actionHeader = new PostalActionInflater();
      kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.typeColumn = StructuredPostal.TYPE;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME));
      kind.typeList.add(buildPostalType(StructuredPostal.TYPE_WORK));
      kind.typeList.add(buildPostalType(StructuredPostal.TYPE_OTHER));
      kind.typeList.add(
          buildPostalType(StructuredPostal.TYPE_CUSTOM)
              .setSecondary(true)
              .setCustomColumn(StructuredPostal.LABEL));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(StructuredPostal.STREET, R.string.postal_street, FLAGS_POSTAL));
      kind.fieldList.add(
          new EditField(StructuredPostal.POBOX, R.string.postal_pobox, FLAGS_POSTAL)
              .setOptional(true));
      kind.fieldList.add(
          new EditField(StructuredPostal.NEIGHBORHOOD, R.string.postal_neighborhood, FLAGS_POSTAL)
              .setOptional(true));
      kind.fieldList.add(new EditField(StructuredPostal.CITY, R.string.postal_city, FLAGS_POSTAL));
      kind.fieldList.add(
          new EditField(StructuredPostal.REGION, R.string.postal_region, FLAGS_POSTAL));
      kind.fieldList.add(
          new EditField(StructuredPostal.POSTCODE, R.string.postal_postcode, FLAGS_POSTAL));
      kind.fieldList.add(
          new EditField(StructuredPostal.COUNTRY, R.string.postal_country, FLAGS_POSTAL)
              .setOptional(true));
    }

    return kind;
  }
  protected DataKind inflateIm(int inflateLevel) {
    DataKind kind = getKindForMimetype(Im.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  Im.CONTENT_ITEM_TYPE,
                  R.string.imLabelsGroup,
                  android.R.drawable.sym_action_chat,
                  20,
                  true));
      kind.actionHeader = new ImActionInflater();
      kind.actionBody = new SimpleInflater(Im.DATA);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      // NOTE: even though a traditional "type" exists, for editing
      // purposes we're using the protocol to pick labels

      kind.defaultValues = new ContentValues();
      kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);

      kind.typeColumn = Im.PROTOCOL;
      kind.typeList = Lists.newArrayList();
      kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
      kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
      kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
      kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
      kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
      kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
      kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
      kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
      kind.typeList.add(
          buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(Im.CUSTOM_PROTOCOL));

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
    }

    return kind;
  }
  protected DataKind inflateWebsite(int inflateLevel) {
    DataKind kind = getKindForMimetype(Website.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(Website.CONTENT_ITEM_TYPE, R.string.websiteLabelsGroup, -1, 120, true));
      kind.secondary = true;
      kind.actionHeader = new SimpleInflater(R.string.websiteLabelsGroup);
      kind.actionBody = new SimpleInflater(Website.URL);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.defaultValues = new ContentValues();
      kind.defaultValues.put(Website.TYPE, Website.TYPE_OTHER);

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(new EditField(Website.URL, R.string.websiteLabelsGroup, FLAGS_WEBSITE));
    }

    return kind;
  }
  protected DataKind inflateNickname(int inflateLevel) {
    DataKind kind = getKindForMimetype(Nickname.CONTENT_ITEM_TYPE);
    if (kind == null) {
      kind =
          addKind(
              new DataKind(
                  Nickname.CONTENT_ITEM_TYPE, R.string.nicknameLabelsGroup, -1, 115, true));
      kind.secondary = true;
      kind.actionHeader = new SimpleInflater(R.string.nicknameLabelsGroup);
      kind.actionBody = new SimpleInflater(Nickname.NAME);
    }

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      kind.defaultValues = new ContentValues();
      kind.defaultValues.put(Nickname.TYPE, Nickname.TYPE_DEFAULT);

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(Nickname.NAME, R.string.nicknameLabelsGroup, FLAGS_PERSON_NAME));
    }

    return kind;
  }
示例#22
0
  @Override
  protected DataKind inflateStructuredName(Context context, int inflateLevel) {
    final DataKind kind = super.inflateStructuredName(context, ContactsSource.LEVEL_MIMETYPES);

    if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
      boolean displayOrderPrimary =
          context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
      kind.typeOverallMax = 1;

      kind.fieldList = Lists.newArrayList();
      kind.fieldList.add(
          new EditField(StructuredName.PREFIX, R.string.name_prefix, FLAGS_PERSON_NAME)
              .setOptional(true));
      if (!displayOrderPrimary) {
        kind.fieldList.add(
            new EditField(StructuredName.FAMILY_NAME, R.string.name_family, FLAGS_PERSON_NAME));
        kind.fieldList.add(
            new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle, FLAGS_PERSON_NAME)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(StructuredName.GIVEN_NAME, R.string.name_given, FLAGS_PERSON_NAME));
        kind.fieldList.add(
            new EditField(StructuredName.SUFFIX, R.string.name_suffix, FLAGS_PERSON_NAME)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(
                    StructuredName.PHONETIC_FAMILY_NAME,
                    R.string.name_phonetic_family,
                    FLAGS_PHONETIC)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(
                    StructuredName.PHONETIC_GIVEN_NAME,
                    R.string.name_phonetic_given,
                    FLAGS_PHONETIC)
                .setOptional(true));
      } else {
        kind.fieldList.add(
            new EditField(StructuredName.GIVEN_NAME, R.string.name_given, FLAGS_PERSON_NAME));
        kind.fieldList.add(
            new EditField(StructuredName.MIDDLE_NAME, R.string.name_middle, FLAGS_PERSON_NAME)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(StructuredName.FAMILY_NAME, R.string.name_family, FLAGS_PERSON_NAME));
        kind.fieldList.add(
            new EditField(StructuredName.SUFFIX, R.string.name_suffix, FLAGS_PERSON_NAME)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(
                    StructuredName.PHONETIC_GIVEN_NAME,
                    R.string.name_phonetic_given,
                    FLAGS_PHONETIC)
                .setOptional(true));
        kind.fieldList.add(
            new EditField(
                    StructuredName.PHONETIC_FAMILY_NAME,
                    R.string.name_phonetic_family,
                    FLAGS_PHONETIC)
                .setOptional(true));
      }
    }

    return kind;
  }