Back to project page android-sdk.
The source code is released under:
MIT License
If you think the Android project android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.relayr; /*w ww. ja v a 2s . co m*/ import android.content.Context; import dagger.ObjectGraph; public class RelayrApp { private static Context sApplicationContext; private static RelayrApp sRelayrApp; private static ObjectGraph sObjectGraph; private RelayrApp(Context context, boolean mockMode) { sRelayrApp = this; sApplicationContext = context.getApplicationContext(); buildObjectGraphAndInject(mockMode); } public static void init(Context context, boolean mockMode) { if (sRelayrApp == null) { synchronized (new Object()) { if (sRelayrApp == null) { new RelayrApp(context, mockMode); } } } } private static void buildObjectGraphAndInject(boolean mockMode) { sObjectGraph = mockMode ? ObjectGraph.create(DebugModules.list(sApplicationContext)): ObjectGraph.create(Modules.list(sApplicationContext)); sObjectGraph.injectStatics(); sObjectGraph.inject(sRelayrApp); } public static void inject(Object o) { sObjectGraph.inject(o); } public static Context get() { return sApplicationContext; } public static void reset() { sApplicationContext = null; sRelayrApp = null; sObjectGraph = null; } }