Android Open Source - keepmoving Dagger Module

From Project

Back to project page keepmoving.


The source code is released under:

GNU General Public License

If you think the Android project keepmoving listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package it.rainbowbreeze.keepmoving.common;
//from   w  ww . j  ava 2s . c om
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import it.rainbowbreeze.keepmoving.logic.PositionManager;
import it.rainbowbreeze.keepmoving.logic.RouteManager;
import it.rainbowbreeze.keepmoving.logic.TimetableController;
import it.rainbowbreeze.keepmoving.ui.TimetableActivity;

 * This file is part of KeepMoving. KeepMoving is free software: you can
 * redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, version 2.
 * <p/>
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * <p/>
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * <p/>
 * Copyright Alfredo Morresi
 * <p/>
 * Created by Alfredo "Rainbowbreeze" Morresi on 15/06/14.
@Module (
        library = false,
        injects = {
                //Put here class that need injected objects once we have one,
                // in the meantime, library = true
//                GeoPointDao.class,
//                RouteManager.class
public class DaggerModule {
    @Provides @Singleton ILogManager provideLogManager() {
        return new LogManager(MyApp.APP_NAME_FOR_LOG);

    @Provides @Singleton Config provideConfig() {
        return new Config();

    @Provides @Singleton
    IGeoPointRepository provideGeoPointRepository(ILogManager logManager) {
        return new GeoPointFixedRepository(logManager);

    @Provides @Singleton
    PositionManager providePositionManager(ILogManager logManager) {
        return new PositionManager(logManager);

    @Provides @Singleton GeoPointDao provideGeoPointDao(
            ILogManager logManager,
            Config config,
            IGeoPointRepository geoPointRepository) {
        return new GeoPointDao(logManager, config, geoPointRepository);

    @Provides @Singleton RouteManager provideRouteManager(
            ILogManager logManager,
            Config config,
            GeoPointDao geoPointDao) {
        return new RouteManager(logManager, config, geoPointDao);

    @Provides @Singleton TimetableController provideTimetableController(
            ILogManager logManager,
            PositionManager positionManager,
            RouteManager routeManager) {
        return new TimetableController(logManager, positionManager, routeManager);


Java Source Code List