Fix dagger warnings

pull/437/head
Alex Baker 8 years ago
parent 04b053cd37
commit 47eabbfffc

@ -9,16 +9,16 @@ import com.todoroo.astrid.dao.Database;
import org.tasks.injection.InjectingTestCase;
import javax.inject.Inject;
public abstract class DatabaseTestCase extends InjectingTestCase {
@Inject protected Database database;
protected Database database;
@Override
protected void setUp() {
super.setUp();
database = component.getDatabase();
database.close();
getContext().deleteDatabase(database.getName());
database.openForWriting();

@ -6,11 +6,13 @@ import static org.tasks.TestUtilities.initializeMockito;
public abstract class InjectingTestCase extends AndroidTestCase {
protected TestComponent component;
@Override
protected void setUp() {
initializeMockito(getContext());
TestComponent component = DaggerTestComponent.builder()
component = DaggerTestComponent.builder()
.testModule(new TestModule(getContext()))
.build();
inject(component);

@ -1,5 +1,6 @@
package org.tasks.injection;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.gtasks.GtasksIndentActionTest;
import com.todoroo.astrid.gtasks.GtasksListServiceTest;
import com.todoroo.astrid.gtasks.GtasksMetadataServiceTest;
@ -14,6 +15,8 @@ import dagger.Component;
@Component(modules = TestModule.class)
public interface TestComponent extends BaseTestComponent {
Database getDatabase();
GtasksMetadataServiceTest.GtasksMetadataServiceTestComponent plus(GtasksMetadataServiceTest.GtasksMetadataServiceTestModule gtasksMetadataServiceTestModule);
void inject(GtasksIndentActionTest gtasksIndentActionTest);

@ -13,6 +13,7 @@ import dagger.Subcomponent;
@Singleton
@Subcomponent(modules = ActivityModule.class)
public interface ActivityComponent extends BaseActivityComponent {
void inject(GtasksPreferences gtasksPreferences);
void inject(TaskerSettingsActivity taskerSettingsActivity);

@ -34,12 +34,15 @@ import org.tasks.preferences.MiscellaneousPreferences;
import org.tasks.reminders.MissedCallActivity;
import org.tasks.reminders.NotificationActivity;
import org.tasks.reminders.SnoozeActivity;
import org.tasks.themes.Theme;
import org.tasks.voice.VoiceCommandActivity;
import org.tasks.widget.ShortcutConfigActivity;
import org.tasks.widget.WidgetConfigActivity;
public interface BaseActivityComponent {
Theme getTheme();
FragmentComponent plus(FragmentModule module);
DialogFragmentComponent plus(DialogFragmentModule dialogFragmentModule);

@ -17,8 +17,6 @@ import org.tasks.preferences.AppCompatPreferenceActivity;
import org.tasks.themes.Theme;
import org.tasks.ui.MenuColorizer;
import javax.inject.Inject;
import timber.log.Timber;
public abstract class InjectingPreferenceActivity extends AppCompatPreferenceActivity implements InjectingActivity {
@ -27,8 +25,6 @@ public abstract class InjectingPreferenceActivity extends AppCompatPreferenceAct
protected Toolbar toolbar;
@Inject Theme theme;
public InjectingPreferenceActivity() {
Locale.getInstance(this).applyOverrideConfiguration(this);
}
@ -40,6 +36,8 @@ public abstract class InjectingPreferenceActivity extends AppCompatPreferenceAct
.plus(new ActivityModule(this));
inject(activityComponent);
Theme theme = activityComponent.getTheme();
theme.applyThemeAndStatusBarColor(this, getDelegate());
super.onCreate(savedInstanceState);

Loading…
Cancel
Save