package com.thebluealliance.androidclient.modules;

import android.app.Activity;

import com.google.gson.Gson;
import com.thebluealliance.androidclient.TBAAndroid;
import com.thebluealliance.androidclient.database.Database;
import com.thebluealliance.androidclient.modules.components.DaggerApplicationComponent;
import com.thebluealliance.androidclient.subscribers.AllianceListSubscriber;
import com.thebluealliance.androidclient.subscribers.AwardsListSubscriber;
import com.thebluealliance.androidclient.subscribers.DistrictPointsListSubscriber;
import com.thebluealliance.androidclient.subscribers.EventInfoSubscriber;
import com.thebluealliance.androidclient.subscribers.EventListSubscriber;
import com.thebluealliance.androidclient.subscribers.MatchListSubscriber;
import com.thebluealliance.androidclient.subscribers.MediaListSubscriber;
import com.thebluealliance.androidclient.subscribers.RankingsListSubscriber;
import com.thebluealliance.androidclient.subscribers.StatsListSubscriber;
import com.thebluealliance.androidclient.subscribers.TeamInfoSubscriber;
import com.thebluealliance.androidclient.subscribers.TeamListSubscriber;

import javax.inject.Inject;

import dagger.Module;
import dagger.Provides;

@Module(includes = TBAAndroidModule.class)
public class SubscriberModule {

    private Activity mActivity;
    @Inject Database mDb;
    @Inject Gson mGson;

    public SubscriberModule(Activity activity) {
        mActivity = activity;
        TBAAndroid application = ((TBAAndroid) activity.getApplication());
        DaggerApplicationComponent.builder()
          .tBAAndroidModule(application.getModule())
          .datafeedModule(application.getDatafeedModule())
          .build()
          .inject(this);
    }

    @Provides
    public TeamInfoSubscriber provideTeamInfoSubscriber() {
        return new TeamInfoSubscriber();
    }

    @Provides
    public EventListSubscriber provideEventListSubscriber() {
        return new EventListSubscriber(mActivity);
    }

    @Provides
    public MediaListSubscriber provideMediaListSubscriber() {
        return new MediaListSubscriber(mActivity);
    }

    @Provides
    public EventInfoSubscriber provideEventInfoSubscriber() {
        return new EventInfoSubscriber();
    }

    @Provides
    public TeamListSubscriber provideTeamListSubscriber() {
        return new TeamListSubscriber(mActivity);
    }

    @Provides
    public RankingsListSubscriber provideRankingsListSubscriber() {
        return new RankingsListSubscriber(mActivity, mDb);
    }

    @Provides
    public MatchListSubscriber provideMatchListSubscriber() {
        return new MatchListSubscriber(mActivity, mDb);
    }

    @Provides
    public AllianceListSubscriber provideAllianceListSubscriber() {
        return new AllianceListSubscriber(mActivity);
    }

    @Provides
    public DistrictPointsListSubscriber provideDistrictPointsListSubscriber() {
        return new DistrictPointsListSubscriber(mActivity, mDb, mGson);
    }

    @Provides
    public StatsListSubscriber provideStatsListSubscriber() {
        return new StatsListSubscriber(mActivity, mDb);
    }

    @Provides
    public AwardsListSubscriber provideAwardsListSubscriber() {
        return new AwardsListSubscriber(mActivity, mDb);
    }
}

@@ -449,32 +449,104 @@
 ListSubscriber;%0A
+import com.thebluealliance.androidclient.subscribers.BaseAPISubscriber;%0A
 import com.thebl
@@ -604,32 +604,32 @@
 ListSubscriber;%0A
-
 import com.thebl
@@ -1233,16 +1233,47 @@
 .Inject;
+%0Aimport javax.inject.Singleton;
 %0A%0Aimport
@@ -1313,16 +1313,249 @@
 vides;%0A%0A
+/**%0A * Module that injects %7B@link BaseAPISubscriber%7D objects to bind datafeed values to views%0A * Each of these are annotated as @Singleton, so references are shared within their component%0A * (e.g. unique references per activity)%0A */%0A
 @Module(
@@ -2072,32 +2072,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Team
@@ -2205,32 +2205,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Even
@@ -2350,32 +2350,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Medi
@@ -2495,32 +2495,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Even
@@ -2631,32 +2631,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Team
@@ -2773,32 +2773,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Rank
@@ -2932,32 +2932,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Matc
@@ -3082,32 +3082,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Alli
@@ -3236,32 +3236,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Dist
@@ -3420,32 +3420,43 @@
 %7D%0A%0A    @Provides
+ @Singleton
 %0A    public Stat
@@ -3557,32 +3557,32 @@
 y, mDb);%0A    %7D%0A%0A
-
     @Provides%0A  
@@ -3578,16 +3578,27 @@
 Provides
+ @Singleton
 %0A    pub

Make subscribers @Singleton