mirror of https://github.com/tasks/tasks
Upgrade to Dagger 2
parent
bd02529d2c
commit
bce22ca4a0
@ -0,0 +1,65 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.dao.MetadataDaoTests;
|
||||
import com.todoroo.astrid.dao.TaskDaoTests;
|
||||
import com.todoroo.astrid.gtasks.GtasksIndentActionTest;
|
||||
import com.todoroo.astrid.gtasks.GtasksListServiceTest;
|
||||
import com.todoroo.astrid.gtasks.GtasksMetadataServiceTest;
|
||||
import com.todoroo.astrid.gtasks.GtasksTaskListUpdaterTest;
|
||||
import com.todoroo.astrid.gtasks.GtasksTaskMovingTest;
|
||||
import com.todoroo.astrid.model.TaskTest;
|
||||
import com.todoroo.astrid.provider.Astrid3ProviderTests;
|
||||
import com.todoroo.astrid.reminders.NotificationTests;
|
||||
import com.todoroo.astrid.reminders.ReminderServiceTest;
|
||||
import com.todoroo.astrid.repeats.NewRepeatTests;
|
||||
import com.todoroo.astrid.service.QuickAddMarkupTest;
|
||||
import com.todoroo.astrid.service.TitleParserTest;
|
||||
import com.todoroo.astrid.subtasks.SubtasksHelperTest;
|
||||
import com.todoroo.astrid.subtasks.SubtasksTestCase;
|
||||
import com.todoroo.astrid.sync.NewSyncTestCase;
|
||||
|
||||
import org.tasks.scheduling.BackupServiceTests;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = TestModule.class)
|
||||
public interface TestComponent {
|
||||
void inject(ReminderServiceTest reminderServiceTest);
|
||||
|
||||
void inject(TaskTest taskTest);
|
||||
|
||||
void inject(TaskDaoTests taskDaoTests);
|
||||
|
||||
void inject(MetadataDaoTests metadataDaoTests);
|
||||
|
||||
void inject(Astrid3ProviderTests astrid3ProviderTests);
|
||||
|
||||
void inject(NewSyncTestCase newSyncTestCase);
|
||||
|
||||
void inject(SubtasksTestCase subtasksTestCase);
|
||||
|
||||
void inject(SubtasksHelperTest subtasksHelperTest);
|
||||
|
||||
void inject(QuickAddMarkupTest quickAddMarkupTest);
|
||||
|
||||
void inject(TitleParserTest titleParserTest);
|
||||
|
||||
void inject(NewRepeatTests newRepeatTests);
|
||||
|
||||
void inject(BackupServiceTests backupServiceTests);
|
||||
|
||||
void inject(GtasksIndentActionTest gtasksIndentActionTest);
|
||||
|
||||
void inject(GtasksTaskMovingTest gtasksTaskMovingTest);
|
||||
|
||||
void inject(GtasksListServiceTest gtasksListServiceTest);
|
||||
|
||||
void inject(GtasksTaskListUpdaterTest gtasksTaskListUpdaterTest);
|
||||
|
||||
GtasksMetadataServiceTest.GtasksMetadataServiceTestComponent plus(GtasksMetadataServiceTest.GtasksMetadataServiceTestModule gtasksMetadataServiceTestModule);
|
||||
|
||||
NotificationTests.NotificationTestsComponent plus(NotificationTests.NotificationTestsModule notificationTestsModule);
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.actfm.FilterSettingsActivity;
|
||||
import com.todoroo.astrid.actfm.TagSettingsActivity;
|
||||
import com.todoroo.astrid.activity.BeastModePreferences;
|
||||
import com.todoroo.astrid.activity.FilterShortcutActivity;
|
||||
import com.todoroo.astrid.activity.ShareLinkActivity;
|
||||
import com.todoroo.astrid.activity.ShortcutActivity;
|
||||
import com.todoroo.astrid.activity.TaskListActivity;
|
||||
import com.todoroo.astrid.core.CustomFilterActivity;
|
||||
import com.todoroo.astrid.core.DefaultsPreferences;
|
||||
import com.todoroo.astrid.core.OldTaskPreferences;
|
||||
import com.todoroo.astrid.files.AACRecordingActivity;
|
||||
import com.todoroo.astrid.gcal.CalendarReminderActivity;
|
||||
import com.todoroo.astrid.gtasks.GtasksPreferences;
|
||||
import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
|
||||
import com.todoroo.astrid.reminders.ReminderPreferences;
|
||||
import com.todoroo.astrid.service.UpgradeActivity;
|
||||
import com.todoroo.astrid.widget.WidgetConfigActivity;
|
||||
|
||||
import org.tasks.activities.AddAttachmentActivity;
|
||||
import org.tasks.activities.CalendarSelectionActivity;
|
||||
import org.tasks.activities.CameraActivity;
|
||||
import org.tasks.activities.ClearAllDataActivity;
|
||||
import org.tasks.activities.ClearGtaskDataActivity;
|
||||
import org.tasks.activities.DateAndTimePickerActivity;
|
||||
import org.tasks.activities.DatePickerActivity;
|
||||
import org.tasks.activities.DeleteAllCalendarEventsActivity;
|
||||
import org.tasks.activities.DeleteCompletedActivity;
|
||||
import org.tasks.activities.DeleteCompletedEventsActivity;
|
||||
import org.tasks.activities.DonationActivity;
|
||||
import org.tasks.activities.ExportTaskActivity;
|
||||
import org.tasks.activities.FilterSelectionActivity;
|
||||
import org.tasks.activities.ImportTaskActivity;
|
||||
import org.tasks.activities.PurgeDeletedActivity;
|
||||
import org.tasks.activities.ResetPreferencesActivity;
|
||||
import org.tasks.activities.SortActivity;
|
||||
import org.tasks.activities.TimePickerActivity;
|
||||
import org.tasks.files.FileExplore;
|
||||
import org.tasks.preferences.AppearancePreferences;
|
||||
import org.tasks.preferences.BackupPreferences;
|
||||
import org.tasks.preferences.BasicPreferences;
|
||||
import org.tasks.preferences.DateShortcutPreferences;
|
||||
import org.tasks.preferences.HelpAndFeedbackActivity;
|
||||
import org.tasks.preferences.MiscellaneousPreferences;
|
||||
import org.tasks.reminders.MissedCallActivity;
|
||||
import org.tasks.reminders.NotificationActivity;
|
||||
import org.tasks.reminders.SnoozeActivity;
|
||||
import org.tasks.voice.VoiceCommandActivity;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Singleton
|
||||
@Subcomponent(modules = ActivityModule.class)
|
||||
public interface ActivityComponent {
|
||||
|
||||
FragmentComponent plus(FragmentModule module);
|
||||
|
||||
DialogFragmentComponent plus(DialogFragmentModule dialogFragmentModule);
|
||||
|
||||
void inject(AACRecordingActivity aacRecordingActivity);
|
||||
|
||||
void inject(CustomFilterActivity customFilterActivity);
|
||||
|
||||
void inject(CalendarReminderActivity calendarReminderActivity);
|
||||
|
||||
void inject(FilterSettingsActivity filterSettingsActivity);
|
||||
|
||||
void inject(TagSettingsActivity tagSettingsActivity);
|
||||
|
||||
void inject(UpgradeActivity upgradeActivity);
|
||||
|
||||
void inject(ShareLinkActivity shareLinkActivity);
|
||||
|
||||
void inject(TaskListActivity taskListActivity);
|
||||
|
||||
void inject(ShortcutActivity shortcutActivity);
|
||||
|
||||
void inject(BeastModePreferences beastModePreferences);
|
||||
|
||||
void inject(NotificationActivity notificationActivity);
|
||||
|
||||
void inject(SnoozeActivity snoozeActivity);
|
||||
|
||||
void inject(MissedCallActivity missedCallActivity);
|
||||
|
||||
void inject(FileExplore fileExplore);
|
||||
|
||||
void inject(ClearAllDataActivity clearAllDataActivity);
|
||||
|
||||
void inject(CalendarSelectionActivity calendarSelectionActivity);
|
||||
|
||||
void inject(SortActivity sortActivity);
|
||||
|
||||
void inject(DeleteAllCalendarEventsActivity deleteAllCalendarEventsActivity);
|
||||
|
||||
void inject(DeleteCompletedEventsActivity deleteCompletedEventsActivity);
|
||||
|
||||
void inject(FilterSelectionActivity filterSelectionActivity);
|
||||
|
||||
void inject(ResetPreferencesActivity resetPreferencesActivity);
|
||||
|
||||
void inject(PurgeDeletedActivity purgeDeletedActivity);
|
||||
|
||||
void inject(DateAndTimePickerActivity dateAndTimePickerActivity);
|
||||
|
||||
void inject(ExportTaskActivity exportTaskActivity);
|
||||
|
||||
void inject(ImportTaskActivity importTaskActivity);
|
||||
|
||||
void inject(AddAttachmentActivity addAttachmentActivity);
|
||||
|
||||
void inject(DeleteCompletedActivity deleteCompletedActivity);
|
||||
|
||||
void inject(DatePickerActivity datePickerActivity);
|
||||
|
||||
void inject(CameraActivity cameraActivity);
|
||||
|
||||
void inject(TimePickerActivity timePickerActivity);
|
||||
|
||||
void inject(VoiceCommandActivity voiceCommandActivity);
|
||||
|
||||
void inject(GtasksLoginActivity gtasksLoginActivity);
|
||||
|
||||
void inject(DonationActivity donationActivity);
|
||||
|
||||
void inject(ClearGtaskDataActivity clearGtaskDataActivity);
|
||||
|
||||
void inject(ReminderPreferences reminderPreferences);
|
||||
|
||||
void inject(WidgetConfigActivity widgetConfigActivity);
|
||||
|
||||
void inject(OldTaskPreferences oldTaskPreferences);
|
||||
|
||||
void inject(DefaultsPreferences defaultsPreferences);
|
||||
|
||||
void inject(FilterShortcutActivity filterShortcutActivity);
|
||||
|
||||
void inject(BackupPreferences backupPreferences);
|
||||
|
||||
void inject(MiscellaneousPreferences miscellaneousPreferences);
|
||||
|
||||
void inject(BasicPreferences basicPreferences);
|
||||
|
||||
void inject(HelpAndFeedbackActivity helpAndFeedbackActivity);
|
||||
|
||||
void inject(DateShortcutPreferences dateShortcutPreferences);
|
||||
|
||||
void inject(AppearancePreferences appearancePreferences);
|
||||
|
||||
void inject(GtasksPreferences gtasksPreferences);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import org.tasks.Tasks;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = ApplicationModule.class)
|
||||
public interface ApplicationComponent {
|
||||
|
||||
Tasks inject(Tasks tasks);
|
||||
|
||||
ActivityComponent plus(ActivityModule module);
|
||||
|
||||
BroadcastComponent plus(BroadcastModule module);
|
||||
|
||||
IntentServiceComponent plus(IntentServiceModule module);
|
||||
|
||||
RemoteViewsServiceComponent plus(RemoteViewsServiceModule remoteViewsServiceModule);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module
|
||||
public class ApplicationModule {
|
||||
private Context context;
|
||||
|
||||
public ApplicationModule(Context context) {
|
||||
this.context = context.getApplicationContext();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ForApplication
|
||||
public Context getApplicationContext() {
|
||||
return context;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.alarms.AlarmTaskRepeatListener;
|
||||
import com.todoroo.astrid.calls.PhoneStateChangedReceiver;
|
||||
import com.todoroo.astrid.gcal.CalendarAlarmReceiver;
|
||||
import com.todoroo.astrid.gcal.GCalTaskCompleteListener;
|
||||
import com.todoroo.astrid.repeats.RepeatTaskCompleteListener;
|
||||
import com.todoroo.astrid.timers.TimerTaskCompleteListener;
|
||||
import com.todoroo.astrid.widget.TasksWidget;
|
||||
|
||||
import org.tasks.receivers.BootCompletedReceiver;
|
||||
import org.tasks.receivers.CompleteTaskReceiver;
|
||||
import org.tasks.receivers.FirstLaunchReceiver;
|
||||
import org.tasks.receivers.ListNotificationReceiver;
|
||||
import org.tasks.receivers.MyPackageReplacedReceiver;
|
||||
import org.tasks.receivers.RefreshReceiver;
|
||||
import org.tasks.receivers.TaskNotificationReceiver;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent(modules = BroadcastModule.class)
|
||||
public interface BroadcastComponent {
|
||||
|
||||
void inject(TimerTaskCompleteListener timerTaskCompleteListener);
|
||||
|
||||
void inject(PhoneStateChangedReceiver phoneStateChangedReceiver);
|
||||
|
||||
void inject(AlarmTaskRepeatListener alarmTaskRepeatListener);
|
||||
|
||||
void inject(GCalTaskCompleteListener gCalTaskCompleteListener);
|
||||
|
||||
void inject(CalendarAlarmReceiver calendarAlarmReceiver);
|
||||
|
||||
void inject(RepeatTaskCompleteListener repeatTaskCompleteListener);
|
||||
|
||||
void inject(MyPackageReplacedReceiver myPackageReplacedReceiver);
|
||||
|
||||
void inject(RefreshReceiver refreshReceiver);
|
||||
|
||||
void inject(TaskNotificationReceiver taskNotificationReceiver);
|
||||
|
||||
void inject(CompleteTaskReceiver completeTaskReceiver);
|
||||
|
||||
void inject(FirstLaunchReceiver firstLaunchReceiver);
|
||||
|
||||
void inject(ListNotificationReceiver listNotificationReceiver);
|
||||
|
||||
void inject(BootCompletedReceiver bootCompletedReceiver);
|
||||
|
||||
void inject(TasksWidget tasksWidget);
|
||||
}
|
@ -1,40 +1,7 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.alarms.AlarmTaskRepeatListener;
|
||||
import com.todoroo.astrid.calls.PhoneStateChangedReceiver;
|
||||
import com.todoroo.astrid.gcal.CalendarAlarmReceiver;
|
||||
import com.todoroo.astrid.gcal.GCalTaskCompleteListener;
|
||||
import com.todoroo.astrid.repeats.RepeatTaskCompleteListener;
|
||||
import com.todoroo.astrid.timers.TimerTaskCompleteListener;
|
||||
import com.todoroo.astrid.widget.TasksWidget;
|
||||
|
||||
import org.tasks.receivers.BootCompletedReceiver;
|
||||
import org.tasks.receivers.CompleteTaskReceiver;
|
||||
import org.tasks.receivers.FirstLaunchReceiver;
|
||||
import org.tasks.receivers.ListNotificationReceiver;
|
||||
import org.tasks.receivers.MyPackageReplacedReceiver;
|
||||
import org.tasks.receivers.RefreshReceiver;
|
||||
import org.tasks.receivers.RepeatConfirmationReceiver;
|
||||
import org.tasks.receivers.TaskNotificationReceiver;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(addsTo = TasksModule.class,
|
||||
injects = {
|
||||
TasksWidget.class,
|
||||
TaskNotificationReceiver.class,
|
||||
ListNotificationReceiver.class,
|
||||
GCalTaskCompleteListener.class,
|
||||
TimerTaskCompleteListener.class,
|
||||
RepeatTaskCompleteListener.class,
|
||||
AlarmTaskRepeatListener.class,
|
||||
PhoneStateChangedReceiver.class,
|
||||
CalendarAlarmReceiver.class,
|
||||
BootCompletedReceiver.class,
|
||||
FirstLaunchReceiver.class,
|
||||
MyPackageReplacedReceiver.class,
|
||||
RefreshReceiver.class,
|
||||
CompleteTaskReceiver.class
|
||||
})
|
||||
@Module
|
||||
public class BroadcastModule {
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.provider.Astrid2TaskProvider;
|
||||
import com.todoroo.astrid.provider.Astrid3ContentProvider;
|
||||
import com.todoroo.astrid.provider.SqlContentProvider;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
ApplicationModule.class,
|
||||
ContentProviderModule.class
|
||||
})
|
||||
public interface ContentProviderComponent {
|
||||
void inject(Astrid3ContentProvider astrid3ContentProvider);
|
||||
|
||||
void inject(Astrid2TaskProvider astrid2TaskProvider);
|
||||
|
||||
void inject(SqlContentProvider sqlContentProvider);
|
||||
}
|
@ -1,16 +1,7 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.provider.Astrid2TaskProvider;
|
||||
import com.todoroo.astrid.provider.Astrid3ContentProvider;
|
||||
import com.todoroo.astrid.provider.SqlContentProvider;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(addsTo = TasksModule.class,
|
||||
injects = {
|
||||
Astrid2TaskProvider.class,
|
||||
Astrid3ContentProvider.class,
|
||||
SqlContentProvider.class
|
||||
})
|
||||
@Module
|
||||
public class ContentProviderModule {
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import dagger.ObjectGraph;
|
||||
|
||||
public final class Dagger {
|
||||
private static ObjectGraph objectGraph;
|
||||
|
||||
static ObjectGraph getObjectGraph(Context context) {
|
||||
if (objectGraph == null) {
|
||||
objectGraph = ObjectGraph.create(new TasksModule(context));
|
||||
}
|
||||
return objectGraph;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import org.tasks.activities.CalendarSelectionDialog;
|
||||
import org.tasks.dialogs.AccountSelectionDialog;
|
||||
import org.tasks.dialogs.AddAttachmentDialog;
|
||||
import org.tasks.reminders.MissedCallDialog;
|
||||
import org.tasks.reminders.NotificationDialog;
|
||||
import org.tasks.reminders.SnoozeDialog;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Subcomponent(modules = DialogFragmentModule.class)
|
||||
public interface DialogFragmentComponent {
|
||||
void inject(NotificationDialog notificationDialog);
|
||||
|
||||
void inject(MissedCallDialog missedCallDialog);
|
||||
|
||||
void inject(CalendarSelectionDialog calendarSelectionDialog);
|
||||
|
||||
void inject(AddAttachmentDialog addAttachmentDialog);
|
||||
|
||||
void inject(AccountSelectionDialog accountSelectionDialog);
|
||||
|
||||
void inject(SnoozeDialog snoozeDialog);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import com.todoroo.astrid.activity.TaskEditFragment;
|
||||
import com.todoroo.astrid.activity.TaskListFragment;
|
||||
import com.todoroo.astrid.files.FilesControlSet;
|
||||
import com.todoroo.astrid.repeats.RepeatControlSet;
|
||||
import com.todoroo.astrid.tags.TagsControlSet;
|
||||
import com.todoroo.astrid.timers.TimerControlSet;
|
||||
import com.todoroo.astrid.ui.EditTitleControlSet;
|
||||
import com.todoroo.astrid.ui.HideUntilControlSet;
|
||||
import com.todoroo.astrid.ui.ReminderControlSet;
|
||||
|
||||
import org.tasks.fragments.CommentBarFragment;
|
||||
import org.tasks.ui.CalendarControlSet;
|
||||
import org.tasks.ui.DeadlineControlSet;
|
||||
import org.tasks.ui.DescriptionControlSet;
|
||||
import org.tasks.ui.NavigationDrawerFragment;
|
||||
import org.tasks.ui.PriorityControlSet;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@Singleton
|
||||
@Subcomponent(modules = FragmentModule.class)
|
||||
public interface FragmentComponent {
|
||||
|
||||
void inject(TimerControlSet timerControlSet);
|
||||
|
||||
void inject(TaskEditFragment taskEditFragment);
|
||||
|
||||
void inject(NavigationDrawerFragment navigationDrawerFragment);
|
||||
|
||||
void inject(PriorityControlSet priorityControlSet);
|
||||
|
||||
void inject(RepeatControlSet repeatControlSet);
|
||||
|
||||
void inject(CommentBarFragment commentBarFragment);
|
||||
|
||||
void inject(EditTitleControlSet editTitleControlSet);
|
||||
|
||||
void inject(FilesControlSet filesControlSet);
|
||||
|
||||
void inject(TagsControlSet tagsControlSet);
|
||||
|
||||
void inject(HideUntilControlSet hideUntilControlSet);
|
||||
|
||||
void inject(ReminderControlSet reminderControlSet);
|
||||
|
||||
void inject(DeadlineControlSet deadlineControlSet);
|
||||
|
||||
void inject(DescriptionControlSet descriptionControlSet);
|
||||
|
||||
void inject(CalendarControlSet calendarControlSet);
|
||||
|
||||
void inject(TaskListFragment taskListFragment);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
public interface InjectingActivity {
|
||||
void inject(ActivityComponent component);
|
||||
|
||||
ActivityComponent getComponent();
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue