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