MessageGenerator(Context context, Address userAddress, AddressStyle addressStyle, HeaderGenerator headerGenerator, PersonLookup personLookup, boolean mailSubjectPrefix, @Nullable ContactGroupIds contactsToBackup, MmsSupport mmsSupport, CallLogTypes callLogTypes, DataTypePreferences dataTypePreferences) { this.headerGenerator = headerGenerator; this.userAddress = userAddress; this.addressStyle = addressStyle; this.context = context; this.personLookup = personLookup; this.prefix = mailSubjectPrefix; this.contactGroupIds = contactsToBackup; this.callFormatter = new CallFormatter(this.context.getResources()); this.mmsSupport = mmsSupport; this.dataTypePreferences = dataTypePreferences; this.callLogTypes = callLogTypes; }
@Before public void before() { formatter = new CallFormatter(RuntimeEnvironment.application.getResources()); }
BackupTask(@NonNull SmsBackupService service) { final Context context = service.getApplicationContext(); this.service = service; this.authPreferences = service.getAuthPreferences(); this.preferences = service.getPreferences(); this.fetcher = new BackupItemsFetcher( context.getContentResolver(), new BackupQueryBuilder(preferences.getDataTypePreferences())); PersonLookup personLookup = new PersonLookup(service.getContentResolver()); this.contactAccessor = new ContactAccessor(); this.converter = new MessageConverter(context, service.getPreferences(), authPreferences.getUserEmail(), personLookup, contactAccessor); if (preferences.isCallLogCalendarSyncEnabled()) { calendarSyncer = new CalendarSyncer( CalendarAccessor.Get.instance(service.getContentResolver()), preferences.getCallLogCalendarId(), personLookup, new CallFormatter(context.getResources()) ); } else { calendarSyncer = null; } this.tokenRefresher = new TokenRefresher(service, new OAuth2Client(authPreferences.getOAuth2ClientId()), authPreferences); }