2014-05-08 21:39:29 -04:00
|
|
|
package org.bspeice.minimalbible.activities.downloader;
|
2014-05-08 20:39:38 -04:00
|
|
|
|
2014-05-08 21:39:29 -04:00
|
|
|
import org.bspeice.minimalbible.MinimalBible;
|
2014-05-24 21:12:20 -04:00
|
|
|
import org.bspeice.minimalbible.activities.downloader.manager.BookDownloadManager;
|
|
|
|
import org.bspeice.minimalbible.activities.downloader.manager.BookDownloadThread;
|
2014-05-08 21:39:29 -04:00
|
|
|
import org.bspeice.minimalbible.activities.downloader.manager.BookRefreshTask;
|
|
|
|
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
|
2014-05-24 21:12:20 -04:00
|
|
|
import org.crosswire.common.progress.JobManager;
|
2014-05-07 02:06:38 -04:00
|
|
|
|
|
|
|
import javax.inject.Singleton;
|
|
|
|
|
|
|
|
import dagger.Module;
|
|
|
|
import dagger.Provides;
|
2014-05-19 22:52:00 -04:00
|
|
|
import de.devland.esperandro.Esperandro;
|
2014-05-07 02:06:38 -04:00
|
|
|
import de.greenrobot.event.EventBus;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module mappings for the classes under the Download Activity
|
|
|
|
*/
|
|
|
|
@Module(
|
|
|
|
injects = {
|
|
|
|
BookListFragment.class,
|
2014-05-08 21:39:29 -04:00
|
|
|
DownloadManager.class,
|
2014-05-19 23:20:47 -04:00
|
|
|
BookRefreshTask.class,
|
2014-05-24 21:12:20 -04:00
|
|
|
BookItemHolder.class,
|
|
|
|
BookDownloadManager.class,
|
|
|
|
BookDownloadThread.class
|
2014-05-07 02:06:38 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
public class ActivityDownloaderModule {
|
|
|
|
|
2014-05-08 20:39:38 -04:00
|
|
|
/**
|
|
|
|
* Provide a Singleton DownloadManager for injection
|
|
|
|
* Note that we need to annotate Singleton here, only annotating on the
|
|
|
|
* DownloadManager itself is not enough.
|
2014-05-10 20:20:16 -04:00
|
|
|
* @return Global DownloadManager instance
|
2014-05-08 20:39:38 -04:00
|
|
|
*/
|
2014-05-07 02:06:38 -04:00
|
|
|
@Provides @Singleton
|
|
|
|
DownloadManager provideDownloadManager() {
|
|
|
|
return new DownloadManager();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Provides
|
|
|
|
EventBus provideBus() {
|
|
|
|
return new EventBus();
|
|
|
|
}
|
2014-05-08 21:39:29 -04:00
|
|
|
|
2014-05-08 23:47:07 -04:00
|
|
|
@Provides //@Singleton
|
2014-05-19 22:52:00 -04:00
|
|
|
DownloadPrefs provideDownloadPrefs() {
|
|
|
|
return Esperandro.getPreferences(DownloadPrefs.class, MinimalBible.getAppContext());
|
2014-05-08 21:39:29 -04:00
|
|
|
}
|
2014-05-07 02:06:38 -04:00
|
|
|
}
|