public MessageConverter(
      Context context, Preferences preferences, String userEmail, PersonLookup personLookup) {
    mContext = context;
    mMarkAsRead = preferences.getMarkAsRead();
    mPersonLookup = personLookup;
    mMarkAsReadOnRestore = preferences.getMarkAsReadOnRestore();

    String referenceUid = preferences.getReferenceUid();
    if (referenceUid == null) {
      referenceUid = generateReferenceValue();
      preferences.setReferenceUid(referenceUid);
    }

    final ContactGroup backupContactGroup = preferences.getBackupContactGroup();
    ContactGroupIds allowedIds =
        ContactAccessor.Get.instance()
            .getGroupContactIds(context.getContentResolver(), backupContactGroup);
    if (LOCAL_LOGV) Log.v(TAG, "whitelisted ids for backup: " + allowedIds);

    mMessageGenerator =
        new MessageGenerator(
            mContext,
            new Address(userEmail),
            AddressStyle.getEmailAddressStyle(preferences),
            new HeaderGenerator(referenceUid, preferences.getVersion(true)),
            mPersonLookup,
            preferences.getMailSubjectPrefix(),
            allowedIds,
            new MmsSupport(mContext.getContentResolver(), mPersonLookup));
  }
Esempio n. 2
0
 static CallLogTypes getCallLogType(Context ctx) {
   return Preferences.getDefaultType(
       ctx, CALLLOG_TYPES, CallLogTypes.class, CallLogTypes.EVERYTHING);
 }