Switched Roboguice/Guice out for Dagger 2

This commit is contained in:
Ernir Erlingsson
2016-03-03 10:24:40 +01:00
parent e5d7038195
commit 1be400eb84
89 changed files with 1640 additions and 802 deletions

View File

@@ -1,18 +1,37 @@
package org.briarproject.system;
import com.google.inject.AbstractModule;
import android.app.Application;
import org.briarproject.api.system.Clock;
import org.briarproject.api.system.LocationUtils;
import org.briarproject.api.system.SeedProvider;
import org.briarproject.api.system.Timer;
public class AndroidSystemModule extends AbstractModule {
import dagger.Module;
import dagger.Provides;
protected void configure() {
bind(Clock.class).to(SystemClock.class);
bind(Timer.class).to(SystemTimer.class);
bind(SeedProvider.class).to(AndroidSeedProvider.class);
bind(LocationUtils.class).to(AndroidLocationUtils.class);
@Module
public class AndroidSystemModule {
@Provides
Clock provideClock() {
return new SystemClock();
}
@Provides
Timer provideTimer() {
return new SystemTimer();
}
@Provides
SeedProvider provideSeedProvider(final Application app) {
return new AndroidSeedProvider(app);
}
@Provides
LocationUtils provideLocationUtils(final Application app) {
return new AndroidLocationUtils(app);
}
}