Inject QuickAddBar

pull/189/head
Alex Baker 11 years ago
parent e955378c5c
commit ff83c18d8b

@ -24,9 +24,7 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener; import android.widget.TextView.OnEditorActionListener;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.AstridActivity; import com.todoroo.astrid.activity.AstridActivity;
@ -34,7 +32,6 @@ import com.todoroo.astrid.activity.TaskEditFragment;
import com.todoroo.astrid.activity.TaskListFragment; import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.activity.TaskListFragment.OnTaskListItemClickedListener; import com.todoroo.astrid.activity.TaskListFragment.OnTaskListItemClickedListener;
import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.dao.TaskAttachmentDao;
import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.SyncFlags; import com.todoroo.astrid.data.SyncFlags;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
@ -50,9 +47,12 @@ import com.todoroo.astrid.voice.VoiceRecognizer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.tasks.R; import org.tasks.R;
import org.tasks.injection.Injector;
import java.util.HashSet; import java.util.HashSet;
import javax.inject.Inject;
/** /**
* Quick Add Bar lets you add tasks. * Quick Add Bar lets you add tasks.
* *
@ -73,33 +73,33 @@ public class QuickAddBar extends LinearLayout {
private RepeatControlSet repeatControl; private RepeatControlSet repeatControl;
private GCalControlSet gcalControl; private GCalControlSet gcalControl;
@Autowired private TaskAttachmentDao taskAttachmentDao; @Inject TagService tagService;
@Autowired private TagService tagService;
private VoiceRecognizer voiceRecognizer; private VoiceRecognizer voiceRecognizer;
private AstridActivity activity; private AstridActivity activity;
private TaskListFragment fragment; private TaskListFragment fragment;
public QuickAddBar(Context context, AttributeSet attrs, int defStyle) { public QuickAddBar(Context context) {
super(context, attrs, defStyle); super(context);
} }
public QuickAddBar(Context context, AttributeSet attrs) { public QuickAddBar(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
public QuickAddBar(Context context) { public QuickAddBar(Context context, AttributeSet attrs, int defStyle) {
super(context); super(context, attrs, defStyle);
} }
public void initialize(AstridActivity myActivity, TaskListFragment myFragment, public void initialize(AstridActivity myActivity, TaskListFragment myFragment,
final OnTaskListItemClickedListener mListener) { final OnTaskListItemClickedListener mListener) {
((Injector) myActivity.getApplication()).inject(this);
activity = myActivity; activity = myActivity;
fragment = myFragment; fragment = myFragment;
DependencyInjectionService.getInstance().inject(this);
LayoutInflater.from(activity).inflate(R.layout.quick_add_bar, this); LayoutInflater.from(activity).inflate(R.layout.quick_add_bar, this);
quickAddControls = (LinearLayout) findViewById(R.id.taskListQuickaddControls); quickAddControls = (LinearLayout) findViewById(R.id.taskListQuickaddControls);

@ -2,6 +2,7 @@ package org.tasks;
import com.todoroo.astrid.adapter.FilterAdapter; import com.todoroo.astrid.adapter.FilterAdapter;
import com.todoroo.astrid.service.AstridDependencyInjector; import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.ui.QuickAddBar;
import org.tasks.widget.ScrollableViewsFactory; import org.tasks.widget.ScrollableViewsFactory;
@ -11,6 +12,7 @@ import dagger.Module;
injects = { injects = {
AstridDependencyInjector.class, AstridDependencyInjector.class,
ScrollableViewsFactory.class, ScrollableViewsFactory.class,
QuickAddBar.class,
FilterAdapter.class FilterAdapter.class
} }
) )

Loading…
Cancel
Save