Exemplo n.º 1
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;
  }
Exemplo n.º 2
0
  @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;
  }
Exemplo n.º 3
0
  @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;
  }
Exemplo n.º 4
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;
  }