Upgrade to Dagger 2

pull/384/head
Alex Baker 9 years ago
parent bd02529d2c
commit bce22ca4a0

@ -72,8 +72,8 @@ android {
}
dependencies {
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.google.dagger:dagger-compiler:2.1'
compile 'com.google.dagger:dagger:2.1'
compile 'com.nononsenseapps:filepicker:2.5.0'
compile 'com.android.support:design:23.1.1'

@ -12,6 +12,8 @@ import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import java.util.List;
import javax.inject.Inject;
@ -31,6 +33,11 @@ public class MetadataDaoTests extends DatabaseTestCase {
metadata = new Metadata();
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
/**
* Test basic creation, fetch, and save
*/

@ -12,6 +12,8 @@ import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import java.util.List;
import javax.inject.Inject;
@ -156,6 +158,11 @@ public class TaskDaoTests extends DatabaseTestCase {
assertEquals(0, taskDao.toList(Query.select(IDS)).size());
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
// TODO check eventing
}

@ -10,6 +10,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.Snippet;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
@ -53,4 +54,9 @@ public class TaskTest extends InjectingTestCase {
assertTrue(defaults.containsKey(Task.COMPLETION_DATE.name));
assertTrue(defaults.containsKey(Task.IMPORTANCE.name));
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
}

@ -18,6 +18,8 @@ import com.todoroo.astrid.data.StoreObject;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
public class Astrid3ProviderTests extends DatabaseTestCase {
String[] PROJECTION = new String[] {
@ -34,6 +36,11 @@ public class Astrid3ProviderTests extends DatabaseTestCase {
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
/** Test CRUD over tasks with the ALL ITEMS cursor */
public void testAllItemsCrud() {
ContentResolver resolver = getContext().getContentResolver();

@ -14,14 +14,14 @@ import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.Broadcaster;
import org.tasks.Notifier;
import org.tasks.injection.TestModule;
import org.tasks.injection.TestComponent;
import org.tasks.notifications.NotificationManager;
import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import dagger.Subcomponent;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
@ -31,21 +31,27 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
public class NotificationTests extends DatabaseTestCase {
@Module(addsTo = TestModule.class, injects = {NotificationTests.class})
static class NotificationTestsModule {
@Singleton
@Module
public static class NotificationTestsModule {
private final NotificationManager notificationManager = mock(NotificationManager.class);
private final Broadcaster broadcaster = mock(Broadcaster.class);
@Provides
public NotificationManager getNotificationManager() {
return mock(NotificationManager.class);
return notificationManager;
}
@Singleton
@Provides
public Broadcaster getBroadcaster() {
return mock(Broadcaster.class);
return broadcaster;
}
}
@Subcomponent(modules = NotificationTestsModule.class)
public interface NotificationTestsComponent {
void inject(NotificationTests notificationTests);
}
@Inject TaskDao taskDao;
@Inject NotificationManager notificationManager;
@Inject Broadcaster broadcaster;
@ -158,6 +164,13 @@ public class NotificationTests extends DatabaseTestCase {
// notificationReceiver.onReceive(getContext(), intent);
// }
@Override
protected void inject(TestComponent component) {
component
.plus(new NotificationTestsModule())
.inject(this);
}
@Override
protected Object getModule() {
return new NotificationTestsModule();

@ -13,6 +13,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.reminders.ReminderService.AlarmScheduler;
import org.tasks.injection.InjectingTestCase;
import org.tasks.injection.TestComponent;
import javax.inject.Inject;
@ -31,6 +32,11 @@ public class ReminderServiceTest extends InjectingTestCase {
freezeClock();
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
@Override
public void tearDown() {
thaw();

@ -22,6 +22,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.R;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences;
import org.tasks.time.DateTime;
@ -44,6 +45,11 @@ public class NewRepeatTests extends DatabaseTestCase {
preferences.setStringFromInteger(R.string.p_default_urgency_key, 0);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
private void saveAndTriggerRepeatListener(Task task) {
task.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
if(task.isSaved())

@ -8,6 +8,8 @@ package com.todoroo.astrid.service;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -23,6 +25,11 @@ public class QuickAddMarkupTest extends DatabaseTestCase {
super.setUp();
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
public void testTags() {
whenTitleIs("this #cool");
assertTitleBecomes("this");

@ -13,6 +13,7 @@ import com.todoroo.astrid.test.DatabaseTestCase;
import com.todoroo.astrid.utility.TitleParser;
import org.tasks.R;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences;
import org.tasks.time.DateTime;
@ -35,7 +36,12 @@ public class TitleParserTest extends DatabaseTestCase {
preferences.setStringFromInteger(R.string.p_default_urgency_key, 0);
}
/** test that completing a task w/ no regular expressions creates a simple task with no date, no repeat, no lists*/
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
/** test that completing a task w/ no regular expressions creates a simple task with no date, no repeat, no lists*/
public void testNoRegexes() throws Exception{
Task task = new Task();
Task nothing = new Task();

@ -4,6 +4,8 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.TaskListMetadata;
import com.todoroo.astrid.service.TaskService;
import org.tasks.injection.TestComponent;
import javax.inject.Inject;
public class SubtasksHelperTest extends SubtasksTestCase {
@ -52,4 +54,11 @@ public class SubtasksHelperTest extends SubtasksTestCase {
String mapped = SubtasksHelper.convertTreeToRemoteIds(taskService, DEFAULT_SERIALIZED_TREE).replaceAll("\\s", "");
assertEquals(EXPECTED_REMOTE, mapped);
}
@Override
protected void inject(TestComponent component) {
super.inject(component);
component.inject(this);
}
}

@ -9,6 +9,7 @@ import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.subtasks.AstridOrderedListUpdater.Node;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
@ -46,6 +47,11 @@ public class SubtasksTestCase extends DatabaseTestCase {
updater = new SubtasksFilterUpdater(taskListMetadataDao, taskService);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
protected void expectParentAndPosition(Task task, Task parent, int positionInParent) {
String parentId = (parent == null ? "-1" : parent.getUuid());
Node n = updater.findNodeForTask(task.getUuid());

@ -6,6 +6,8 @@ import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import javax.inject.Inject;
public class NewSyncTestCase extends DatabaseTestCase {
@ -40,4 +42,9 @@ public class NewSyncTestCase extends DatabaseTestCase {
protected TagData createTagData() {
return createTagData("new tag");
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
}

@ -2,8 +2,6 @@ package org.tasks.injection;
import android.test.AndroidTestCase;
import dagger.ObjectGraph;
import static org.tasks.TestUtilities.initializeMockito;
public abstract class InjectingTestCase extends AndroidTestCase {
@ -12,14 +10,18 @@ public abstract class InjectingTestCase extends AndroidTestCase {
protected void setUp() {
initializeMockito(getContext());
ObjectGraph objectGraph = ObjectGraph.create(new TestModule(getContext()));
TestComponent component = DaggerTestComponent.builder()
.testModule(new TestModule(getContext()))
.build();
Object extension = getModule();
if (extension != null) {
objectGraph = objectGraph.plus(extension);
// objectGraph = objectGraph.plus(extension);
}
objectGraph.inject(this);
inject(component);
}
protected abstract void inject(TestComponent component);
protected Object getModule() {
return null;
}

@ -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);
}

@ -27,26 +27,7 @@ import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module(injects = {
BackupServiceTests.class,
MetadataDaoTests.class,
TaskDaoTests.class,
GtasksIndentActionTest.class,
GtasksTaskListUpdaterTest.class,
GtasksTaskMovingTest.class,
Astrid3ProviderTests.class,
NewRepeatTests.class,
QuickAddMarkupTest.class,
TitleParserTest.class,
SubtasksTestCase.class,
NewSyncTestCase.class,
TaskTest.class,
ReminderServiceTest.class,
SubtasksHelperTest.class,
SubtasksMovingTest.class,
SyncModelTest.class,
GtasksListServiceTest.class
})
@Module
public class TestModule {
private Context context;

@ -12,6 +12,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.R;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences;
import java.io.File;
@ -55,6 +56,11 @@ public class BackupServiceTests extends DatabaseTestCase {
taskDao.createNew(task);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
@Override
protected void tearDown() {
super.tearDown();

@ -6,13 +6,14 @@
package com.todoroo.astrid.gtasks;
import com.google.api.services.tasks.model.TaskList;
import com.google.api.services.tasks.model.TaskLists;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import java.util.ArrayList;
import java.util.List;
@ -140,18 +141,21 @@ public class GtasksIndentActionTest extends DatabaseTestCase {
protected void setUp() {
super.setUp();
TaskLists lists = new TaskLists();
List<TaskList> items = new ArrayList<>();
TaskList list = new TaskList();
list.setId("list");
list.setTitle("Test Tasks");
items.add(list);
lists.setItems(items);
gtasksListService.updateLists(lists);
gtasksListService.updateLists(items);
storeList = gtasksListService.getLists().get(0);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
private Task taskWithMetadata(long order, int indentation) {
Task newTask = new Task();
taskService.save(newTask);

@ -7,6 +7,7 @@ import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import org.tasks.makers.RemoteGtaskListMaker;
import javax.inject.Inject;
@ -36,6 +37,11 @@ public class GtasksListServiceTest extends DatabaseTestCase {
gtasksListService = new GtasksListService(storeObjectDao);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
public void testCreateNewList() {
setLists(newRemoteList(
with(RemoteGtaskListMaker.REMOTE_ID, "1"),
@ -94,7 +100,6 @@ public class GtasksListServiceTest extends DatabaseTestCase {
}
private void setLists(TaskList... list) {
gtasksListService.updateLists(new TaskLists().setItems(
asList(list)));
gtasksListService.updateLists(asList(list));
}
}

@ -13,19 +13,20 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestModule;
import org.tasks.injection.TestComponent;
import org.tasks.preferences.Preferences;
import javax.inject.Inject;
import dagger.Module;
import dagger.Provides;
import dagger.Subcomponent;
@SuppressWarnings("nls")
public class GtasksMetadataServiceTest extends DatabaseTestCase {
@Module(addsTo = TestModule.class, injects = {GtasksMetadataServiceTest.class})
static class GtasksMetadataServiceTestModule {
@Module
public class GtasksMetadataServiceTestModule {
private final GtasksTestPreferenceService service;
public GtasksMetadataServiceTestModule(Context context) {
@ -43,6 +44,11 @@ public class GtasksMetadataServiceTest extends DatabaseTestCase {
}
}
@Subcomponent(modules = GtasksMetadataServiceTest.GtasksMetadataServiceTestModule.class)
public interface GtasksMetadataServiceTestComponent {
void inject(GtasksMetadataServiceTest gtasksMetadataServiceTest);
}
@Inject GtasksTestPreferenceService preferences;
@Inject GtasksMetadataService gtasksMetadataService;
@Inject MetadataDao metadataDao;
@ -61,6 +67,13 @@ public class GtasksMetadataServiceTest extends DatabaseTestCase {
}
}
@Override
protected void inject(TestComponent component) {
component
.plus(new GtasksMetadataServiceTestModule(getContext()))
.inject(this);
}
public void testMetadataFound() {
givenTask(taskWithMetadata(null));

@ -13,6 +13,8 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import java.util.ArrayList;
import java.util.List;
@ -124,14 +126,17 @@ public class GtasksTaskListUpdaterTest extends DatabaseTestCase {
protected void setUp() {
super.setUp();
TaskLists lists = new TaskLists();
List<TaskList> items = new ArrayList<>();
TaskList list = new TaskList();
list.setId("1");
list.setTitle("Tim's Tasks");
items.add(list);
lists.setItems(items);
gtasksListService.updateLists(lists);
gtasksListService.updateLists(items);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
private void whenCalculatingParentsAndSiblings() {

@ -6,13 +6,14 @@
package com.todoroo.astrid.gtasks;
import com.google.api.services.tasks.model.TaskList;
import com.google.api.services.tasks.model.TaskLists;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.test.DatabaseTestCase;
import org.tasks.injection.TestComponent;
import java.util.ArrayList;
import java.util.List;
@ -246,18 +247,21 @@ public class GtasksTaskMovingTest extends DatabaseTestCase {
protected void setUp() {
super.setUp();
TaskLists lists = new TaskLists();
List<TaskList> items = new ArrayList<>();
TaskList taskList = new TaskList();
taskList.setId("1");
taskList.setTitle("Tim's Tasks");
items.add(taskList);
lists.setItems(items);
gtasksListService.updateLists(lists);
gtasksListService.updateLists(items);
list = gtasksListService.getLists().get(0);
}
@Override
protected void inject(TestComponent component) {
component.inject(this);
}
/**
* A
* B

@ -7,13 +7,14 @@ package com.todoroo.astrid.gtasks;
import android.content.Context;
import org.tasks.AccountManager;
import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.Preferences;
public class GtasksTestPreferenceService extends GtasksPreferenceService {
public GtasksTestPreferenceService(Context context, Preferences preferences, PermissionChecker permissionChecker) {
super(context, preferences, permissionChecker);
public GtasksTestPreferenceService(Context context, Preferences preferences, AccountManager accountManager) {
super(context, preferences, accountManager);
}
@Override

@ -16,6 +16,7 @@ import com.todoroo.astrid.gtasks.auth.GtasksLoginActivity;
import org.tasks.R;
import org.tasks.activities.ClearGtaskDataActivity;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingPreferenceActivity;
import org.tasks.preferences.ActivityPermissionRequestor;
import org.tasks.preferences.PermissionRequestor;
@ -101,4 +102,9 @@ public class GtasksPreferences extends InjectingPreferenceActivity {
super.onPause();
backgroundScheduler.scheduleGtaskSync();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -19,6 +19,7 @@ import org.tasks.AccountManager;
import org.tasks.R;
import org.tasks.dialogs.AccountSelectionDialog;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import javax.inject.Inject;
@ -62,6 +63,11 @@ public class GtasksLoginActivity extends InjectingAppCompatActivity implements A
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void getAuthToken(String account) {
final ProgressDialog pd = dialogBuilder.newProgressDialog(R.string.gtasks_GLA_authenticating);
pd.show();

@ -7,6 +7,7 @@ import com.todoroo.astrid.gtasks.sync.GtasksSyncV2Provider;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import javax.inject.Inject;
@ -37,4 +38,9 @@ public class ClearGtaskDataActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -12,6 +12,7 @@ import org.tasks.billing.IabResult;
import org.tasks.billing.Inventory;
import org.tasks.billing.Purchase;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import java.util.ArrayList;
@ -73,6 +74,11 @@ public class DonationActivity extends InjectingAppCompatActivity implements IabH
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void initiateDonation(int amount) {
final String sku = String.format("%03d", amount);
if (inventory != null && inventory.hasPurchase(sku)) {

@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
import org.tasks.AccountManager;
import org.tasks.R;
import org.tasks.injection.DialogFragmentComponent;
import org.tasks.injection.InjectingDialogFragment;
import java.util.List;
@ -17,6 +18,11 @@ public class AccountSelectionDialog extends InjectingDialogFragment {
private AccountSelectionHandler handler;
@Override
protected void inject(DialogFragmentComponent component) {
component.inject(this);
}
public interface AccountSelectionHandler {
void accountSelected(String account);

@ -9,6 +9,7 @@ import com.todoroo.astrid.reminders.ReminderService;
import org.tasks.Notifier;
import org.tasks.injection.InjectingIntentService;
import org.tasks.injection.IntentServiceComponent;
import java.util.List;
@ -47,6 +48,11 @@ public class GeofenceTransitionsIntentService extends InjectingIntentService {
}
}
@Override
protected void inject(IntentServiceComponent component) {
component.inject(this);
}
private void triggerNotification(com.google.android.gms.location.Geofence triggeringGeofence) {
String requestId = triggeringGeofence.getRequestId();
try {

@ -5,6 +5,7 @@ import com.todoroo.astrid.gtasks.sync.GtasksSyncV2Provider;
import org.tasks.Broadcaster;
import org.tasks.R;
import org.tasks.injection.IntentServiceComponent;
import org.tasks.preferences.Preferences;
import org.tasks.sync.RecordSyncStatusCallback;
@ -51,4 +52,9 @@ public class GtasksBackgroundService extends RecurringIntervalIntentService {
String getLastRunPreference() {
return "gtasks_last_sync";
}
@Override
protected void inject(IntentServiceComponent component) {
component.inject(this);
}
}

@ -24,6 +24,7 @@ import com.todoroo.astrid.dao.StoreObjectDao;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.ui.MenuColorizer;
@ -70,6 +71,11 @@ public class FilterSettingsActivity extends InjectingAppCompatActivity {
filterName.setText(filter.listingTitle);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void save() {
String oldName = filter.listingTitle;
String newName = filterName.getText().toString().trim();

@ -34,6 +34,7 @@ import com.todoroo.astrid.tags.TaskToTagMetadata;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.ui.MenuColorizer;
@ -112,6 +113,11 @@ public class TagSettingsActivity extends InjectingAppCompatActivity {
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private String getNewName() {
return tagName.getText().toString().trim();
}

@ -25,6 +25,7 @@ import com.commonsware.cwac.tlv.TouchListView;
import com.commonsware.cwac.tlv.TouchListView.DropListener;
import org.tasks.R;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.preferences.Preferences;
@ -109,6 +110,11 @@ public class BeastModePreferences extends InjectingAppCompatActivity {
});
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.beast_mode, menu);

@ -23,6 +23,7 @@ import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.filters.FilterCounter;
import org.tasks.filters.FilterProvider;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.ForApplication;
import org.tasks.injection.InjectingListActivity;
import org.tasks.preferences.ActivityPreferences;
@ -137,4 +138,9 @@ public class FilterShortcutActivity extends InjectingListActivity {
super.onPause();
adapter.unregisterRecevier();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -11,6 +11,7 @@ import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.TaskCreator;
import com.todoroo.astrid.service.TaskService;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import javax.inject.Inject;
@ -37,6 +38,11 @@ public final class ShareLinkActivity extends InjectingAppCompatActivity {
readIntent();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);

@ -14,6 +14,7 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterWithCustomIntent;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import java.util.Set;
@ -58,6 +59,11 @@ public class ShortcutActivity extends InjectingAppCompatActivity {
launchShortcut();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);

@ -38,6 +38,7 @@ import org.tasks.analytics.Tracker;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.fragments.TaskEditControlSetFragmentManager;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.injection.InjectingFragment;
import org.tasks.notifications.NotificationManager;
import org.tasks.preferences.Preferences;
@ -104,6 +105,11 @@ public final class TaskEditFragment extends InjectingFragment implements Toolbar
callback = (TaskEditFragmentCallbackHandler) activity;
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_task_edit, container, false);

@ -34,6 +34,7 @@ import com.todoroo.astrid.timers.TimerControlSet;
import org.tasks.R;
import org.tasks.fragments.CommentBarFragment;
import org.tasks.fragments.TaskEditControlSetFragmentManager;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.intents.TaskIntents;
import org.tasks.preferences.ActivityPreferences;
@ -189,6 +190,11 @@ public class TaskListActivity extends InjectingAppCompatActivity implements
new IntentFilter(AstridApiConstants.BROADCAST_EVENT_TASK_REPEATED));
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
protected void onPause() {
super.onPause();

@ -82,6 +82,7 @@ import org.tasks.R;
import org.tasks.activities.SortActivity;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.injection.InjectingListFragment;
import org.tasks.notifications.NotificationManager;
import org.tasks.preferences.ActivityPreferences;
@ -203,6 +204,11 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
callbacks = (TaskListFragmentCallbackHandler) activity;
}
@Override
public void inject(FragmentComponent component) {
component.inject(this);
}
/**
* @return view to attach to the body of the task list. must contain two
* elements, a view with id android:id/empty and a list view with id

@ -13,6 +13,7 @@ import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.data.Metadata;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import java.util.LinkedHashSet;
@ -52,4 +53,9 @@ public class AlarmTaskRepeatListener extends InjectingBroadcastReceiver {
alarmService.synchronizeAlarms(taskId, alarms);
}
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
}

@ -18,6 +18,7 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import org.tasks.Notifier;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.preferences.Preferences;
@ -132,6 +133,11 @@ public class PhoneStateChangedReceiver extends InjectingBroadcastReceiver {
}
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
private String digitsOnly(String number) {
if (number == null) {
return "";

@ -28,7 +28,6 @@ import android.widget.ListView;
import com.todoroo.andlib.data.Property.CountProperty;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.sql.UnaryCriterion;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.actfm.TagSettingsActivity;
import com.todoroo.astrid.api.CustomFilter;
import com.todoroo.astrid.api.CustomFilterCriterion;
@ -45,6 +44,7 @@ import com.todoroo.astrid.data.Task;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.filters.FilterCriteriaProvider;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.ui.MenuColorizer;
@ -178,6 +178,11 @@ public class CustomFilterActivity extends InjectingAppCompatActivity {
setUpListeners();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private CriterionInstance getStartingUniverse() {
CriterionInstance instance = new CriterionInstance();
instance.criterion = new MultipleSelectCriterion(IDENTIFIER_UNIVERSE,

@ -14,6 +14,7 @@ import org.tasks.R;
import org.tasks.activities.CalendarSelectionActivity;
import org.tasks.calendars.AndroidCalendar;
import org.tasks.calendars.CalendarProvider;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingPreferenceActivity;
import org.tasks.preferences.ActivityPermissionRequestor;
import org.tasks.preferences.PermissionRequestor;
@ -91,4 +92,9 @@ public class DefaultsPreferences extends InjectingPreferenceActivity {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -10,6 +10,7 @@ import android.os.Bundle;
import com.todoroo.astrid.service.StartupService;
import org.tasks.R;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingPreferenceActivity;
import javax.inject.Inject;
@ -26,4 +27,9 @@ public class OldTaskPreferences extends InjectingPreferenceActivity {
addPreferencesFromResource(R.xml.preferences_oldtasks);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -14,6 +14,7 @@ import com.todoroo.astrid.voice.AACRecorder;
import com.todoroo.astrid.voice.AACRecorder.AACRecorderCallbacks;
import org.tasks.R;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPermissionRequestor;
import org.tasks.preferences.PermissionRequestor;
@ -49,6 +50,11 @@ public class AACRecordingActivity extends InjectingAppCompatActivity implements
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void startRecording() {
setContentView(R.layout.aac_record_activity);
ButterKnife.bind(this);

@ -36,6 +36,7 @@ import org.tasks.R;
import org.tasks.activities.AddAttachmentActivity;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.ui.TaskEditControlFragment;
import java.io.File;
@ -197,6 +198,11 @@ public class FilesControlSet extends TaskEditControlFragment {
addAttachment.setVisibility(View.GONE);
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
public interface PlaybackExceptionHandler {
void playbackFailed();
}

@ -13,6 +13,7 @@ import org.tasks.R;
import org.tasks.calendars.AndroidCalendarEvent;
import org.tasks.calendars.AndroidCalendarEventAttendee;
import org.tasks.calendars.CalendarEventProvider;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.preferences.Preferences;
import org.tasks.scheduling.CalendarNotificationIntentService;
@ -66,6 +67,11 @@ public class CalendarAlarmReceiver extends InjectingBroadcastReceiver {
}
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
private void showCalReminder(Context context, final long eventId, final boolean fromPostpone) {
final AndroidCalendarEvent event = calendarEventProvider.getEvent(eventId);
if (event == null) {

@ -15,6 +15,7 @@ import com.todoroo.astrid.service.StartupService;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.preferences.BasicPreferences;
@ -116,6 +117,11 @@ public class CalendarReminderActivity extends InjectingAppCompatActivity {
addListeners();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void setupUi() {
((TextView) findViewById(R.id.reminder_title))
.setText(getString(R.string.CRA_title));

@ -18,6 +18,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import javax.inject.Inject;
@ -57,4 +58,9 @@ public class GCalTaskCompleteListener extends InjectingBroadcastReceiver {
}
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
}

@ -24,6 +24,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.tags.TagService;
import org.tasks.injection.ContentProviderComponent;
import org.tasks.injection.InjectingContentProvider;
import org.tasks.ui.CheckBoxes;
@ -110,6 +111,11 @@ public class Astrid2TaskProvider extends InjectingContentProvider {
return false;
}
@Override
protected void inject(ContentProviderComponent component) {
component.inject(this);
}
/**
* Note: tag id is no longer a real column, so we pass in a UID
* generated from the tag string.

@ -27,6 +27,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.UserActivity;
import org.tasks.BuildConfig;
import org.tasks.injection.ContentProviderComponent;
import org.tasks.injection.InjectingContentProvider;
import java.util.HashSet;
@ -118,6 +119,11 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
}
}
@Override
protected void inject(ContentProviderComponent component) {
component.inject(this);
}
/* ======================================================================
* ========================================================== helpers ===
* ====================================================================== */

@ -14,6 +14,7 @@ import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database;
import org.tasks.BuildConfig;
import org.tasks.injection.ContentProviderComponent;
import org.tasks.injection.InjectingContentProvider;
import javax.inject.Inject;
@ -121,4 +122,9 @@ public class SqlContentProvider extends InjectingContentProvider {
return database.get();
}
@Override
protected void inject(ContentProviderComponent component) {
component.inject(this);
}
}

@ -17,6 +17,7 @@ import android.preference.PreferenceManager;
import org.tasks.R;
import org.tasks.activities.TimePickerActivity;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingPreferenceActivity;
import org.tasks.preferences.ActivityPermissionRequestor;
import org.tasks.preferences.Device;
@ -186,4 +187,9 @@ public class ReminderPreferences extends InjectingPreferenceActivity {
private TimePreference getTimePreference(int resId) {
return (TimePreference) findPreference(getString(resId));
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -42,6 +42,7 @@ import org.tasks.R;
import org.tasks.activities.DatePickerActivity;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.time.DateTime;
import org.tasks.ui.TaskEditControlFragment;
@ -291,6 +292,11 @@ public class RepeatControlSet extends TaskEditControlFragment {
callback = (RepeatChangedListener) activity;
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
@OnClick(R.id.clear)
void clearRepeat(View view) {
doRepeat = false;

@ -22,6 +22,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gcal.GCalHelper;
import com.todoroo.astrid.service.TaskService;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.time.DateTime;
@ -91,6 +92,11 @@ public class RepeatTaskCompleteListener extends InjectingBroadcastReceiver {
}
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
static boolean repeatFinished(long newDueDate, long repeatUntil) {
return repeatUntil > 0 && newDateTime(newDueDate).startOfDay().isAfter(newDateTime(repeatUntil).startOfDay());
}

@ -15,6 +15,7 @@ import com.todoroo.astrid.api.AstridApiConstants;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.Preferences;
@ -69,6 +70,11 @@ public class UpgradeActivity extends InjectingAppCompatActivity {
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
public void onBackPressed() {
// Don't allow the back button to finish this activity before things are done

@ -43,6 +43,7 @@ import com.todoroo.astrid.utility.Flags;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.FragmentComponent;
import org.tasks.ui.TaskEditControlFragment;
import java.util.ArrayList;
@ -401,4 +402,9 @@ public final class TagsControlSet extends TaskEditControlFragment {
TaskToTagMetadata.TASK_UUID.eq(taskUuid), TaskToTagMetadata.TAG_UUID.eq(tag.getUuid())), deleteTemplate);
}
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
}

@ -30,6 +30,7 @@ import com.todoroo.astrid.ui.TimeDurationControlSet;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.ui.TaskEditControlFragment;
@ -100,6 +101,11 @@ public class TimerControlSet extends TaskEditControlFragment {
callback = (TimerControlSetCallback) activity;
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);

@ -12,6 +12,7 @@ import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingBroadcastReceiver;
import org.tasks.notifications.NotificationManager;
@ -39,4 +40,9 @@ public class TimerTaskCompleteListener extends InjectingBroadcastReceiver {
TimerPlugin.stopTimer(notificationManager, taskService, context, task);
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
}

@ -22,6 +22,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.injection.FragmentComponent;
import org.tasks.ui.CheckBoxes;
import org.tasks.ui.TaskEditControlFragment;
@ -65,6 +66,11 @@ public class EditTitleControlSet extends TaskEditControlFragment {
checkBoxes = new CheckBoxes(activity);
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

@ -27,6 +27,7 @@ import org.tasks.R;
import org.tasks.activities.DateAndTimePickerActivity;
import org.tasks.activities.TimePickerActivity;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.time.DateTime;
import org.tasks.ui.HiddenTopArrayAdapter;
import org.tasks.ui.TaskEditControlFragment;
@ -203,6 +204,11 @@ public class HideUntilControlSet extends TaskEditControlFragment implements OnIt
outState.putInt(EXTRA_SELECTION, selection);
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
/**
* Container class for urgencies
*

@ -33,6 +33,7 @@ import org.tasks.R;
import org.tasks.activities.DateAndTimePickerActivity;
import org.tasks.activities.TimePickerActivity;
import org.tasks.injection.ForActivity;
import org.tasks.injection.FragmentComponent;
import org.tasks.location.Geofence;
import org.tasks.location.GeofenceService;
import org.tasks.location.PlacePicker;
@ -423,4 +424,9 @@ public class ReminderControlSet extends TaskEditControlFragment {
mode.setSelection(0);
}
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
}

@ -26,6 +26,7 @@ import com.todoroo.astrid.tags.TagFilterExposer;
import org.tasks.Broadcaster;
import org.tasks.R;
import org.tasks.injection.BroadcastComponent;
import org.tasks.injection.InjectingAppWidgetProvider;
import org.tasks.intents.TaskIntents;
import org.tasks.preferences.Preferences;
@ -75,6 +76,11 @@ public class TasksWidget extends InjectingAppWidgetProvider {
}
}
@Override
protected void inject(BroadcastComponent component) {
component.inject(this);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
try {

@ -24,6 +24,7 @@ import com.todoroo.astrid.api.FilterWithCustomIntent;
import org.tasks.R;
import org.tasks.filters.FilterCounter;
import org.tasks.filters.FilterProvider;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingListActivity;
import org.tasks.preferences.ActivityPreferences;
@ -164,4 +165,9 @@ public class WidgetConfigActivity extends InjectingListActivity {
}
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -21,6 +21,7 @@ import com.todoroo.astrid.tags.TagService;
import org.tasks.analytics.Tracker;
import org.tasks.filters.FilterCounter;
import org.tasks.injection.ApplicationComponent;
import org.tasks.injection.InjectingApplication;
import org.tasks.preferences.Preferences;
import org.tasks.sync.SyncThrottle;
@ -88,4 +89,9 @@ public class Tasks extends InjectingApplication {
}
}
}
@Override
protected void inject(ApplicationComponent component) {
component.inject(this);
}
}

@ -17,6 +17,7 @@ import com.todoroo.astrid.files.AACRecordingActivity;
import org.tasks.R;
import org.tasks.dialogs.AddAttachmentDialog;
import org.tasks.files.FileExplore;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.Preferences;
@ -58,6 +59,11 @@ public class AddAttachmentActivity extends InjectingAppCompatActivity implements
dialog.setAddAttachmentCallback(this);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
public void onCancel(DialogInterface dialog) {
finish();

@ -7,6 +7,7 @@ import android.os.Bundle;
import org.tasks.calendars.AndroidCalendar;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPermissionRequestor;
import org.tasks.preferences.ActivityPreferences;
@ -36,6 +37,11 @@ public class CalendarSelectionActivity extends InjectingAppCompatActivity implem
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
public void selectedCalendar(final AndroidCalendar androidCalendar) {
setResult(RESULT_OK, new Intent() {{

@ -13,6 +13,7 @@ import org.tasks.R;
import org.tasks.calendars.AndroidCalendar;
import org.tasks.calendars.CalendarProvider;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.DialogFragmentComponent;
import org.tasks.injection.InjectingDialogFragment;
import java.util.List;
@ -27,6 +28,11 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
enableNone = true;
}
@Override
protected void inject(DialogFragmentComponent component) {
component.inject(this);
}
public interface CalendarSelectionHandler {
void selectedCalendar(AndroidCalendar calendar);
void dismiss();

@ -9,6 +9,7 @@ import android.provider.MediaStore;
import android.widget.Toast;
import org.tasks.R;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.Preferences;
@ -58,6 +59,11 @@ public class CameraActivity extends InjectingAppCompatActivity {
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_CAMERA) {

@ -7,6 +7,7 @@ import com.todoroo.astrid.dao.Database;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import javax.inject.Inject;
@ -37,4 +38,9 @@ public class ClearAllDataActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -9,6 +9,7 @@ import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import org.tasks.R;
import org.tasks.dialogs.MyDatePickerDialog;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.time.DateTime;
@ -58,6 +59,11 @@ public class DateAndTimePickerActivity extends InjectingAppCompatActivity implem
datePickerDialog.setOnDateSetListener(this);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);

@ -9,6 +9,7 @@ import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import org.tasks.R;
import org.tasks.dialogs.MyDatePickerDialog;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.time.DateTime;
@ -49,6 +50,11 @@ public class DatePickerActivity extends InjectingAppCompatActivity
dialog.setOnDateSetListener(this);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
public void onDateSet(DatePickerDialog view, final int year, final int monthOfYear, final int dayOfMonth) {
setResult(RESULT_OK, new Intent() {{

@ -11,6 +11,7 @@ import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.ui.ProgressDialogAsyncTask;
@ -72,4 +73,9 @@ public class DeleteAllCalendarEventsActivity extends InjectingAppCompatActivity
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -13,6 +13,7 @@ import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.ui.ProgressDialogAsyncTask;
@ -68,4 +69,9 @@ public class DeleteCompletedActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -12,6 +12,7 @@ import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.ui.ProgressDialogAsyncTask;
@ -76,4 +77,9 @@ public class DeleteCompletedEventsActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -5,6 +5,7 @@ import android.os.Bundle;
import com.todoroo.astrid.backup.TasksXmlExporter;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import javax.inject.Inject;
@ -19,4 +20,9 @@ public class ExportTaskActivity extends InjectingAppCompatActivity {
super.onCreate(savedInstanceState);
xmlExporter.exportTasks(ExportTaskActivity.this, TasksXmlExporter.ExportType.EXPORT_TYPE_MANUAL, dialogBuilder);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -11,6 +11,7 @@ import com.todoroo.astrid.api.Filter;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.filters.FilterCounter;
import org.tasks.filters.FilterProvider;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
@ -66,4 +67,9 @@ public class FilterSelectionActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -7,6 +7,7 @@ import android.os.Bundle;
import com.todoroo.astrid.backup.TasksXmlImporter;
import org.tasks.files.FileExplore;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
@ -28,6 +29,11 @@ public class ImportTaskActivity extends InjectingAppCompatActivity {
}}, REQUEST_PICKER);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_PICKER) {

@ -14,6 +14,7 @@ import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.ui.ProgressDialogAsyncTask;
@ -71,4 +72,9 @@ public class PurgeDeletedActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -5,6 +5,7 @@ import android.os.Bundle;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.Preferences;
@ -36,4 +37,9 @@ public class ResetPreferencesActivity extends InjectingAppCompatActivity {
})
.show();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
}

@ -10,6 +10,7 @@ import com.todoroo.astrid.core.SortHelper;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.preferences.Preferences;
@ -101,6 +102,11 @@ public class SortActivity extends InjectingAppCompatActivity {
enableReverse();
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void enableReverse() {
if (manualEnabled) {
Button reverse = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);

@ -11,6 +11,7 @@ import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
import org.tasks.R;
import org.tasks.dialogs.MyTimePickerDialog;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPreferences;
import org.tasks.time.DateTime;
@ -53,6 +54,11 @@ public class TimePickerActivity extends InjectingAppCompatActivity implements Ti
dialog.setOnTimeSetListener(this);
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
@Override
public void onTimeSet(RadialPickerLayout radialPickerLayout, final int hours, final int minutes, int seconds) {
setResult(RESULT_OK, new Intent() {{

@ -5,6 +5,7 @@ import android.content.DialogInterface;
import android.os.Bundle;
import org.tasks.R;
import org.tasks.injection.DialogFragmentComponent;
import org.tasks.injection.InjectingDialogFragment;
import org.tasks.preferences.Device;
@ -16,6 +17,11 @@ import static com.google.common.collect.Lists.newArrayList;
public class AddAttachmentDialog extends InjectingDialogFragment {
@Override
protected void inject(DialogFragmentComponent component) {
component.inject(this);
}
public interface AddAttachmentCallback {
void takePicture();

@ -10,6 +10,7 @@ import android.os.Environment;
import com.google.common.base.Strings;
import com.nononsenseapps.filepicker.FilePickerActivity;
import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity;
import org.tasks.preferences.ActivityPermissionRequestor;
import org.tasks.preferences.PermissionRequestor;
@ -45,6 +46,11 @@ public class FileExplore extends InjectingAppCompatActivity {
}
}
@Override
public void inject(ActivityComponent component) {
component.inject(this);
}
private void launchPicker() {
File path = null;
if (!Strings.isNullOrEmpty(startPath)) {

@ -28,6 +28,7 @@ import org.json.JSONObject;
import org.tasks.R;
import org.tasks.activities.CameraActivity;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.FragmentComponent;
import org.tasks.preferences.Device;
import org.tasks.preferences.Preferences;
import org.tasks.ui.TaskEditControlFragment;
@ -85,6 +86,11 @@ public class CommentBarFragment extends TaskEditControlFragment {
callback = (CommentBarFragmentCallback) activity;
}
@Override
protected void inject(FragmentComponent component) {
component.inject(this);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

@ -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);
}

@ -2,109 +2,10 @@ package org.tasks.injection;
import android.app.Activity;
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 org.tasks.files.FileExplore;
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.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.Module;
import dagger.Provides;
@Module(addsTo = TasksModule.class,
injects = {
TaskListActivity.class,
ShareLinkActivity.class,
TagSettingsActivity.class,
FilterSettingsActivity.class,
CustomFilterActivity.class,
MissedCallActivity.class,
CalendarReminderActivity.class,
VoiceCommandActivity.class,
GtasksLoginActivity.class,
WidgetConfigActivity.class,
BasicPreferences.class,
GtasksPreferences.class,
OldTaskPreferences.class,
FilterShortcutActivity.class,
BeastModePreferences.class,
DefaultsPreferences.class,
AACRecordingActivity.class,
SnoozeActivity.class,
MiscellaneousPreferences.class,
ImportTaskActivity.class,
ExportTaskActivity.class,
ClearAllDataActivity.class,
ResetPreferencesActivity.class,
PurgeDeletedActivity.class,
DeleteCompletedActivity.class,
DeleteCompletedEventsActivity.class,
DeleteAllCalendarEventsActivity.class,
ClearGtaskDataActivity.class,
ReminderPreferences.class,
AppearancePreferences.class,
BackupPreferences.class,
NotificationActivity.class,
HelpAndFeedbackActivity.class,
DateShortcutPreferences.class,
SortActivity.class,
FilterSelectionActivity.class,
FileExplore.class,
DonationActivity.class,
UpgradeActivity.class,
CalendarSelectionActivity.class,
AddAttachmentActivity.class,
ShortcutActivity.class,
CameraActivity.class,
DatePickerActivity.class,
TimePickerActivity.class,
DateAndTimePickerActivity.class
})
@Module
public class ActivityModule {
private final Activity activity;
@ -113,7 +14,6 @@ public class ActivityModule {
this.activity = activity;
}
@Singleton
@Provides
public Activity getActivity() {
return activity;

@ -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);
}

@ -3,26 +3,10 @@ package org.tasks.injection;
import android.app.Activity;
import android.app.DialogFragment;
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.Module;
import dagger.Provides;
@Module(addsTo = TasksModule.class,
injects = {
NotificationDialog.class,
SnoozeDialog.class,
MissedCallDialog.class,
CalendarSelectionDialog.class,
AccountSelectionDialog.class,
AddAttachmentDialog.class
},
library = true)
@Module
public class DialogFragmentModule {
private DialogFragment dialogFragment;

@ -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);
}

@ -1,59 +1,13 @@
package org.tasks.injection;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.activity.TaskEditFragment;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.files.FilesControlSet;
import com.todoroo.astrid.gtasks.GtasksListFragment;
import com.todoroo.astrid.repeats.RepeatControlSet;
import com.todoroo.astrid.subtasks.SubtasksListFragment;
import com.todoroo.astrid.subtasks.SubtasksTagListFragment;
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.Module;
import dagger.Provides;
@Module(addsTo = TasksModule.class,
injects = {
TaskListFragment.class,
GtasksListFragment.class,
SubtasksListFragment.class,
SubtasksTagListFragment.class,
TagViewFragment.class,
TaskEditFragment.class,
NavigationDrawerFragment.class,
CalendarControlSet.class,
DeadlineControlSet.class,
PriorityControlSet.class,
DescriptionControlSet.class,
HideUntilControlSet.class,
ReminderControlSet.class,
FilesControlSet.class,
EditTitleControlSet.class,
TimerControlSet.class,
TagsControlSet.class,
RepeatControlSet.class,
CommentBarFragment.class
})
@Module
public class FragmentModule {
private final Fragment fragment;
public FragmentModule(Fragment fragment) {
@ -66,12 +20,6 @@ public class FragmentModule {
return fragment.getActivity();
}
@Provides
public Activity getActivity() {
return fragment.getActivity();
}
@Singleton
@Provides
public Fragment getFragment() {
return fragment;

@ -0,0 +1,7 @@
package org.tasks.injection;
public interface InjectingActivity {
void inject(ActivityComponent component);
ActivityComponent getComponent();
}

@ -7,17 +7,15 @@ import org.tasks.analytics.Tracker;
import javax.inject.Inject;
import dagger.ObjectGraph;
public abstract class InjectingAppCompatActivity extends AppCompatActivity implements Injector {
private ObjectGraph objectGraph;
public abstract class InjectingAppCompatActivity extends AppCompatActivity implements InjectingActivity {
private ActivityComponent activityComponent;
@Inject Tracker tracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
objectGraph = ((Injector) getApplication()).getObjectGraph().plus(new ActivityModule(this));
inject(this);
activityComponent = ((InjectingApplication) getApplication()).getComponent().plus(new ActivityModule(this));
inject(activityComponent);
super.onCreate(savedInstanceState);
}
@ -30,12 +28,7 @@ public abstract class InjectingAppCompatActivity extends AppCompatActivity imple
}
@Override
public void inject(Object caller) {
objectGraph.inject(caller);
}
@Override
public ObjectGraph getObjectGraph() {
return objectGraph;
public ActivityComponent getComponent() {
return activityComponent;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save