use of io.jawg.osmcontributor.modules.OsmTemplateModule in project osm-contributor by jawg.
the class OsmTemplateApplication method onCreate.
/*=========================================*/
/*---------------OVERRIDE------------------*/
/*=========================================*/
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
Fabric.with(this, new Crashlytics());
// Init Stetho for debug purpose (database)
Stetho.initializeWithDefaults(this);
// Init Dagger
osmTemplateComponent = DaggerOsmTemplateComponent.builder().osmTemplateModule(new OsmTemplateModule(this)).build();
osmTemplateComponent.inject(this);
// Init Flickr object
StoreConfigManager configManager = new StoreConfigManager();
flickr = new Flickr(configManager.getFlickrApiKey(), configManager.getFlickrApiKeySecret(), new REST());
// Cache Disk for Fresco
DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this).setBaseDirectoryPath(new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), getPackageName())).setBaseDirectoryName("images").build();
// Cache Memory for Fresco
ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this).setBitmapMemoryCacheParamsSupplier(new Supplier<MemoryCacheParams>() {
@Override
public MemoryCacheParams get() {
return new MemoryCacheParams(10485760, 100, 100, 100, 100);
}
}).setMainDiskCacheConfig(diskCacheConfig).build();
// Init Fresco
Fresco.initialize(this, imagePipelineConfig);
// Init event bus
EventBus bus = osmTemplateComponent.getEventBus();
bus.register(getOsmTemplateComponent().getLoginManager());
bus.register(getOsmTemplateComponent().getEditPoiManager());
bus.register(getOsmTemplateComponent().getPoiManager());
bus.register(getOsmTemplateComponent().getNoteManager());
bus.register(getOsmTemplateComponent().getSyncManager());
bus.register(getOsmTemplateComponent().getTypeManager());
bus.register(getOsmTemplateComponent().getPresetsManager());
bus.register(getOsmTemplateComponent().getGeocoder());
bus.register(getOsmTemplateComponent().getEditVectorialWayManager());
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.shared_prefs_preset_default), false)) {
editor.putBoolean(getString(R.string.shared_prefs_preset_default), true);
}
editor.apply();
MapboxAccountManager.start(this, BuildConfig.MAPBOX_TOKEN);
}
Aggregations